diff options
author | Teddy <[email protected]> | 2014-05-06 10:58:07 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2014-05-06 10:58:07 +0800 |
commit | bd6cd038d82f31ee86aa5c656c4181cd19e9070d (patch) | |
tree | 9dbfe8c9e5e0457098012e645b98d4316cc968cc | |
parent | 6ec15abe28a2589e5d03d56438f0727261e3cef6 (diff) |
correct subexp opt
-rw-r--r-- | lib.s | 6 | ||||
-rw-r--r-- | ssa.c | 12 |
2 files changed, 9 insertions, 9 deletions
@@ -64,14 +64,12 @@ __L10: # if not (t14) goto __L12 bne $10, 0, __L12 # len_11 = 1 - li $2, 1 - move $11 $2 + li $11, 1 # goto __L15 j __L15 __L12: # len_8 = 0 - li $2, 0 - move $11 $2 + li $11, 0 # goto __L14 j __L14 __L13: @@ -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); } |