diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-08-13 16:10:54 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:31 -0400 |
commit | 5fc8104e00187335411e35ec951bef53562c8fcd (patch) | |
tree | b4f26312a5eef7062c3aa8501a6a8f6efe77a675 /lisc/live.c | |
parent | 78bf28f56e7dcdd89efba5c69bd90ed858658162 (diff) | |
download | roux-5fc8104e00187335411e35ec951bef53562c8fcd.tar.gz |
major lifting: get rid of RReg
I've been septic since I introduced it, this commit proves that it costs more than it helps. I've also fixed a bad bug in rega() where I alloc'ed the wrong size for internal arrays. Enums now have names so I can use them to cast in gdb to get the name corresponding to a constant.
Diffstat (limited to 'lisc/live.c')
-rw-r--r-- | lisc/live.c | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/lisc/live.c b/lisc/live.c index aec7701..64fcf6a 100644 --- a/lisc/live.c +++ b/lisc/live.c @@ -1,24 +1,14 @@ #include "lisc.h" static void -bset(Ref r, Blk *b, Bits *rb, int *nlv) +bset(Ref r, Blk *b, int *nlv) { - Bits *bs; - - switch (rtype(r)) { - case RTmp: - bs = &b->in; - BSET(b->gen, r.val); - break; - case RReg: - bs = rb; - break; - default: + if (rtype(r) != RTmp) return; - } - if (!BGET(*bs, r.val)) { + BSET(b->gen, r.val); + if (!BGET(b->in, r.val)) { ++*nlv; - BSET(*bs, r.val); + BSET(b->in, r.val); } } @@ -33,7 +23,7 @@ filllive(Fn *f) Phi *p; int z, n, chg, nlv; uint a; - Bits tb, rb; + Bits tb; assert(f->ntmp <= NBit*BITS); for (b=f->start; b; b=b->link) { @@ -56,28 +46,18 @@ Again: chg |= memcmp(&b->out, &tb, sizeof(Bits)); b->in = b->out; - rb = (Bits){{0}}; nlv = bcnt(&b->in); - bset(b->jmp.arg, b, &rb, &nlv); + bset(b->jmp.arg, b, &nlv); b->nlive = nlv; for (i=&b->ins[b->nins]; i!=b->ins;) { i--; - switch (rtype(i->to)) { - default: - diag("live: unhandled destination"); - case RTmp: + if (!req(i->to, R)) { + assert(rtype(i->to) == RTmp); nlv -= BGET(b->in, i->to.val); BCLR(b->in, i->to.val); - break; - case RReg: - nlv -= BGET(rb, i->to.val); - BCLR(rb, i->to.val); - break; - case -1: - break; } - bset(i->arg[0], b, &rb, &nlv); - bset(i->arg[1], b, &rb, &nlv); + bset(i->arg[0], b, &nlv); + bset(i->arg[1], b, &nlv); if (nlv > b->nlive) b->nlive = nlv; } |