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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 931 and 932

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

Rev 931 Rev 932
Line 175... Line 175...
    if (ii->opt[2] & OPT_CONST && c == 0) {
    if (ii->opt[2] & OPT_CONST && c == 0) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = 0; ii->opt[1] = OPT_CONST;
      ii->op[1] = 0; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
 
    } else if (ii->opt[2] & OPT_CONST && c == 0xffffffff) {
 
      change_insn_type (ii, II_ADD);
 
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
 
      return 1;
    } else break;
    } else break;
  case II_OR:
  case II_OR:
    if (ii->opt[2] & OPT_CONST && c == 0xffffffff) {
    if (ii->opt[2] & OPT_CONST && c == 0x0) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = c; ii->opt[1] = OPT_CONST;
      ii->op[1] = c; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
 
    } else if (ii->opt[2] & OPT_CONST && c == 0xffffffff) {
 
      change_insn_type (ii, II_ADD);
 
      ii->op[1] = 0xffffffff; ii->opt[1] = OPT_CONST;
 
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
 
      return 1;
    } else break;
    } else break;
  case II_SUB:
  case II_SUB:
    if (ii->opt[1] == ii->opt[2] && ii->op[1] == ii->op[2]) {
    if (ii->opt[1] == ii->opt[2] && ii->op[1] == ii->op[2]) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = 0; ii->opt[1] = OPT_CONST;
      ii->op[1] = 0; ii->opt[1] = OPT_CONST;
Line 730... Line 739...
      }
      }
  }
  }
  return modified;
  return modified;
}
}
 
 
 
static void unmark_tree (cuc_func *f, int ref)
 
{
 
  cuc_insn *ii = &f->INSN(ref);
 
  printf ("%x ", ref);
 
  if (ii->type & IT_UNUSED) {
 
    int j;
 
    ii->type &= ~IT_UNUSED;
 
    for (j = 0; j < MAX_OPERANDS; j++)
 
      if (ii->opt[j] & OPT_REF) unmark_tree (f, ii->op[j]);
 
  }
 
}
 
 
/* Remove unused assignments */
/* Remove unused assignments */
int remove_dead (cuc_func *f)
int remove_dead (cuc_func *f)
{
{
  int b, i, j;
  int b, i, j;
  for (b = 0; b < f->num_bb; b++)
  for (b = 0; b < f->num_bb; b++)
    for (i = 0; i < f->bb[b].ninsn; i++)
    for (i = 0; i < f->bb[b].ninsn; i++)
      if (!(f->bb[b].insn[i].type & (IT_VOLATILE | IT_OUTPUT)))
 
        f->bb[b].insn[i].type |= IT_UNUSED;
        f->bb[b].insn[i].type |= IT_UNUSED;
 
 
  for (b = 0; b < f->num_bb; b++) {
  for (b = 0; b < f->num_bb; b++)
    for (i = 0; i < f->bb[b].ninsn; i++)
    for (i = 0; i < f->bb[b].ninsn; i++) {
      for (j = 0; j < MAX_OPERANDS; j++)
      cuc_insn *ii = &f->bb[b].insn[i];
        if (f->bb[b].insn[i].opt[j] & OPT_REF) {
      if (ii->type & IT_VOLATILE || ii->type & IT_OUTPUT
          f->INSN(f->bb[b].insn[i].op[j]).type &= ~IT_UNUSED;
       || II_IS_LOAD (ii->index) && (f->memory_order == MO_NONE || f->memory_order == MO_WEAK)
 
       || II_IS_STORE (ii->index)) {
 
        unmark_tree (f, REF (b, i));
 
        printf ("\n");
        }
        }
  }
  }
 
 
  for (b = 0; b < f->num_bb; b++)
  for (b = 0; b < f->num_bb; b++)
    for (i = 0; i < f->bb[b].ninsn; i++)
    for (i = 0; i < f->bb[b].ninsn; i++)

powered by: WebSVN 2.1.0

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