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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_64/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 1059 and 1062

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

Rev 1059 Rev 1062
Line 80... Line 80...
  if (ii->index < 0 || ii->index > II_LAST) return "???";
  if (ii->index < 0 || ii->index > II_LAST) return "???";
  else return known[ii->index].name;
  else return known[ii->index].name;
}
}
 
 
/* Prints out instructions */
/* Prints out instructions */
void print_insns (cuc_insn *insn, int ninsn, int verbose)
void print_insns (int bb, cuc_insn *insn, int ninsn, int verbose)
{
{
  int i, j;
  int i, j;
  for (i = 0; i < ninsn; i++) {
  for (i = 0; i < ninsn; i++) {
 
    char tmp[10];
    dep_list *l = insn[i].dep;
    dep_list *l = insn[i].dep;
    PRINTF ("%4x%c %-4s ", i, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i]));
    sprintf (tmp, "[%x_%x]", bb, i);
 
    PRINTF ("%-8s%c %-4s ", tmp, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i]));
    if (verbose) {
    if (verbose) {
      PRINTF ("%-20s insn = %08x, index = %i, type = %04x ",
      PRINTF ("%-20s insn = %08x, index = %i, type = %04x ",
                      insn[i].disasm, insn[i].insn, insn[i].index, insn[i].type);
                      insn[i].disasm, insn[i].insn, insn[i].index, insn[i].type);
    } else PRINTF ("type = %04x ", insn[i].type);
    } else PRINTF ("type = %04x ", insn[i].type);
    for (j = 0; j < MAX_OPERANDS; j++) {
    for (j = 0; j < MAX_OPERANDS; j++) {
Line 97... Line 99...
      switch (insn[i].opt[j] & ~OPT_DEST) {
      switch (insn[i].opt[j] & ~OPT_DEST) {
        case OPT_NONE: break;
        case OPT_NONE: break;
        case OPT_CONST: if (insn[i].type & IT_COND && (insn[i].index == II_CMOV
        case OPT_CONST: if (insn[i].type & IT_COND && (insn[i].index == II_CMOV
                         || insn[i].index == II_ADD)) PRINTF ("%x, ", insn[i].op[j]);
                         || insn[i].index == II_ADD)) PRINTF ("%x, ", insn[i].op[j]);
                        else PRINTF ("0x%08x, ", insn[i].op[j]); break;
                        else PRINTF ("0x%08x, ", insn[i].op[j]); break;
        case OPT_JUMP: PRINTF ("J%x ", insn[i].op[j]); break;
        case OPT_JUMP: PRINTF ("J%x, ", insn[i].op[j]); break;
        case OPT_REGISTER: PRINTF ("r%i, ", insn[i].op[j]); break;
        case OPT_REGISTER: PRINTF ("r%i, ", insn[i].op[j]); break;
        case OPT_REF: PRINTF ("[%x.%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break;
        case OPT_REF: PRINTF ("[%x_%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break;
        case OPT_BB: PRINTF ("BB "); print_bb_num (insn[i].op[j]); PRINTF (", "); break;
        case OPT_BB: PRINTF ("BB "); print_bb_num (insn[i].op[j]); PRINTF (", "); break;
        case OPT_LRBB: PRINTF ("LRBB, "); break;
        case OPT_LRBB: PRINTF ("LRBB, "); break;
        default:
        default:
          fprintf (stderr, "Invalid operand type %s(%x.%x) = %x\n",
          fprintf (stderr, "Invalid operand type %s(%x_%x) = %x\n",
                         cuc_insn_name (&insn[i]), i, j, insn[i].opt[j]);
                         cuc_insn_name (&insn[i]), i, j, insn[i].opt[j]);
          assert (0);
          assert (0);
      }
      }
    }
    }
    if (l) {
    if (l) {
      PRINTF ("\n\tdep:");
      PRINTF ("\n\tdep:");
      while (l) {
      while (l) {
        PRINTF (" [%x.%x],", REF_BB (l->ref), REF_I (l->ref));
        PRINTF (" [%x_%x],", REF_BB (l->ref), REF_I (l->ref));
        l = l->next;
        l = l->next;
      }
      }
    }
    }
    PRINTF ("\n");
    PRINTF ("\n");
  }
  }
Line 635... Line 637...
          cuc_check (f);
          cuc_check (f);
        }
        }
        tmp = *a;
        tmp = *a;
        cmov = f->INSN(ref2);
        cmov = f->INSN(ref2);
        tmp.op[diff] = ref; tmp.opt[diff] = OPT_REF;
        tmp.op[diff] = ref; tmp.opt[diff] = OPT_REF;
 
        cmov.op[0] = -1; cmov.opt[0] = OPT_REGISTER | OPT_DEST;
        cmov.op[1] = a->op[diff]; cmov.opt[1] = a->opt[diff];
        cmov.op[1] = a->op[diff]; cmov.opt[1] = a->opt[diff];
        cmov.op[2] = b->op[diff]; cmov.opt[2] = b->opt[diff];
        cmov.op[2] = b->op[diff]; cmov.opt[2] = b->opt[diff];
        change_insn_type (&cmov, II_CMOV);
        change_insn_type (&cmov, II_CMOV);
        cmov.type &= ~IT_COND;
        cmov.type &= ~IT_COND;
        cucdebug (4, "ref2 = %x %x %x\n", ref2, cmov.op[1], cmov.op[2]);
        cucdebug (4, "ref2 = %x %x %x\n", ref2, cmov.op[1], cmov.op[2]);

powered by: WebSVN 2.1.0

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