diff options
author | Teddy <ted.sybil@gmail.com> | 2014-05-06 10:58:07 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2014-05-06 10:58:07 +0800 |
commit | bd6cd038d82f31ee86aa5c656c4181cd19e9070d (patch) | |
tree | 9dbfe8c9e5e0457098012e645b98d4316cc968cc /ssa.c | |
parent | 6ec15abe28a2589e5d03d56438f0727261e3cef6 (diff) |
correct subexp opt
Diffstat (limited to 'ssa.c')
-rw-r--r-- | ssa.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1912,15 +1912,14 @@ void init_def(void) { opr->spill = cinterv_repr(opr); } /* coalescing */ - /* for (p = entry; p; p = p->next) { CInst_t i, ih = p->insts; for (i = ih->next; i != ih; i = i->next) - if (i->op == MOVE && i->dest->kind == TMP && i->src1->kind == TMP) + if (i->op == MOVE && i->dest->kind == TMP && + (i->src1->kind == TMP || i->src1->kind == VAR)) cinterv_union(i->dest, i->src1); } - */ } void print_intervals(void) { @@ -2452,19 +2451,22 @@ void subexp_elimination_(CBlock_t b, CExpMap_t cem) { case SHL: case SHR: case AND: case XOR: case OR: case NOR: case EQ: case NE: case LT: case GT: case LE: case GE: case NEG: - cexpmap_insert(cem, i); + if (i->dest->kind == TMP) cexpmap_insert(cem, i); break; default: ; } } } - cexpmap_clear(cem); for (e = dtree.head[b->id]; e; e = e->next) subexp_elimination_(e->to, cem); + cexpmap_clear(cem); } void subexp_elimination(void) { CExpMap_t cem = cexpmap_create(); +/* int i; + for (i = bcnt - 1; i >= 0; i--) + */ subexp_elimination_(entry, cem); cexpmap_destroy(cem); } |