diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-07-27 14:57:56 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:29 -0400 |
commit | 854ecd40092a33184aaa20b0bfbc023c7df6a3d0 (patch) | |
tree | 14c18bd8207b76863def9a728ac3685cf33ecc4e /lisc/rega.c | |
parent | 8899449c39f66b8d7db24c33a56708e7678e70ad (diff) | |
download | roux-854ecd40092a33184aaa20b0bfbc023c7df6a3d0.tar.gz |
add crippled dce to the allocator
Diffstat (limited to 'lisc/rega.c')
-rw-r--r-- | lisc/rega.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lisc/rega.c b/lisc/rega.c index 3c8c4bd..b1731b8 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -256,7 +256,7 @@ rega(Fn *fn) /* process instructions */ end[n] = cur; if (debug['R']) { - fprintf(stderr, "\tend %-10s ", b->name); + fprintf(stderr, "\t%-10s end", b->name); mdump(&cur); } if (rtype(b->jmp.arg) == RSym) @@ -270,8 +270,11 @@ rega(Fn *fn) } if (!req(i->to, R)) { r = rfree(&cur, i->to.val); - if (r) - i->to = SYM(r); + if (!r) { + *i = (Ins){ONop, R, {R, R}}; + continue; + } + i->to = SYM(r); } if (rtype(i->arg[0]) == RSym) { /* <arch> @@ -301,9 +304,13 @@ rega(Fn *fn) } } if (debug['R']) { - fprintf(stderr, "\tbeg %-10s ", b->name); + fprintf(stderr, "\t beg"); mdump(&cur); } + b->in = cur.bt; + for (p=b->phi; p; p=p->link) + if (rtype(p->to) == RSym) + BCLR(b->in, p->to.val); beg[n] = cur; } if (debug['R']) @@ -318,14 +325,18 @@ rega(Fn *fn) for (p=s->phi; p; p=p->link) { assert(rtype(p->to) == RSlot || rtype(p->to) == RSym); + dst = p->to; + if (rtype(dst) == RSym) { + r = rfind(&beg[s->id], dst.val); + if (!r) + continue; + dst = SYM(r); + } for (a=0; p->blk[a]!=b; a++) assert(a+1 < p->narg); - dst = p->to; src = p->arg[a]; if (rtype(src) == RSym) src = rref(&end[b->id], src.val); - if (rtype(dst) == RSym) - dst = rref(&beg[s->id], dst.val); pmadd(src, dst); } for (t=Tmp0; t<fn->ntmp; t++) |