OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 902 and 903

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 902 Rev 903
Line 260... Line 260...
static int cmov_needed (cuc_func *f, int ref)
static int cmov_needed (cuc_func *f, int ref)
{
{
  cuc_insn *ii = &f->INSN(ref);
  cuc_insn *ii = &f->INSN(ref);
  int j;
  int j;
 
 
  //printf (" %x", ref);
  cucdebug (4, " %x", ref);
  /* mark visited, if already marked, we have a loop, ignore */
  /* mark visited, if already marked, we have a loop, ignore */
  if (ii->tmp) return 0;
  if (ii->tmp) return 0;
  ii->tmp = 1;
  ii->tmp = 1;
 
 
  /* handle normal movs separately */
  /* handle normal movs separately */
Line 299... Line 299...
      ii->tmp = 0;
      ii->tmp = 0;
      return 1;
      return 1;
    }
    }
 
 
  for (j = 1; j < 3; j++) {
  for (j = 1; j < 3; j++) {
    //printf ("(%x:%i)", ref, j);
    cucdebug (4, "(%x:%i)", ref, j);
    if (ii->opt[j] == OPT_REF) {
    if (ii->opt[j] == OPT_REF) {
      if (cmov_needed (f, ii->op[j])) {
      if (cmov_needed (f, ii->op[j])) {
        ii->tmp = 0;
        ii->tmp = 0;
        return 1;
        return 1;
      }
      }
Line 334... Line 334...
  for (b = 0; b < f->num_bb; b++) if (!(f->bb[b].type & BB_DEAD)) {
  for (b = 0; b < f->num_bb; b++) if (!(f->bb[b].type & BB_DEAD)) {
    for (i = 0; i < f->bb[b].ninsn; i++) {
    for (i = 0; i < f->bb[b].ninsn; i++) {
      cuc_insn *ii = &f->bb[b].insn[i];
      cuc_insn *ii = &f->bb[b].insn[i];
      if (ii->index == II_CMOV && !(ii->type & IT_VOLATILE)) {
      if (ii->index == II_CMOV && !(ii->type & IT_VOLATILE)) {
        tmp_opt = OPT_NONE;
        tmp_opt = OPT_NONE;
        printf ("\n");
        cucdebug (4, "\n");
        if (!cmov_needed (f, REF(b, i))) {
        if (!cmov_needed (f, REF(b, i))) {
          assert (tmp_opt != OPT_NONE);
          assert (tmp_opt != OPT_NONE);
          change_insn_type (ii, II_ADD);
          change_insn_type (ii, II_ADD);
          ii->op[1] = tmp_op; ii->opt[1] = tmp_opt;
          ii->op[1] = tmp_op; ii->opt[1] = tmp_opt;
          ii->op[2] = 0; ii->opt[2] = OPT_CONST;
          ii->op[2] = 0; ii->opt[2] = OPT_CONST;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.