diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-26 16:33:29 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-26 16:33:29 -0400 |
commit | aa9dc343995ef2eafcb3ef630e2ab8e3ec61ac4f (patch) | |
tree | 846867688d43bd926e7bc74dfcc88726a743486c /lisc/live.c | |
parent | e80b84ebdb6c0623442a26ac10fc763cc6d9e6e9 (diff) | |
download | roux-aa9dc343995ef2eafcb3ef630e2ab8e3ec61ac4f.tar.gz |
move the liveon() function in live.c
Diffstat (limited to 'lisc/live.c')
-rw-r--r-- | lisc/live.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/lisc/live.c b/lisc/live.c index c3aae86..80bdd75 100644 --- a/lisc/live.c +++ b/lisc/live.c @@ -1,5 +1,23 @@ #include "lisc.h" +Bits +liveon(Blk *b, Blk *s) +{ + Bits v; + Phi *p; + uint a; + + v = s->in; + for (p=s->phi; p; p=p->link) { + BCLR(v, p->to.val); + for (a=0; a<p->narg; a++) + if (p->blk[a] == b) + if (rtype(p->arg[a]) == RTmp) + BSET(v, p->arg[a].val); + } + return v; +} + static void bset(Ref r, Blk *b, int *nlv) { @@ -20,10 +38,8 @@ filllive(Fn *f) { Blk *b; Ins *i; - Phi *p; int z, m, n, chg, nlv; - uint a; - Bits tb; + Bits u, v; assert(f->ntmp <= NBit*BITS); for (b=f->start; b; b=b->link) { @@ -36,14 +52,18 @@ Again: for (n=f->nblk-1; n>=0; n--) { b = f->rpo[n]; - tb = b->out; - if (b->s1) + u = b->out; + if (b->s1) { + v = liveon(b, b->s1); for (z=0; z<BITS; z++) - b->out.t[z] |= b->s1->in.t[z]; - if (b->s2) + b->out.t[z] |= v.t[z]; + } + if (b->s2) { + v = liveon(b, b->s2); for (z=0; z<BITS; z++) - b->out.t[z] |= b->s2->in.t[z]; - chg |= memcmp(&b->out, &tb, sizeof(Bits)); + b->out.t[z] |= v.t[z]; + } + chg |= memcmp(&b->out, &u, sizeof(Bits)); b->in = b->out; nlv = bcnt(&b->in); @@ -57,7 +77,6 @@ Again: b->nlive = nlv + NRSave; b->in.t[0] |= calluse(*i, &m); nlv += m; - bset(i->arg[0], b, &nlv); } if (!req(i->to, R)) { assert(rtype(i->to) == RTmp); @@ -69,13 +88,6 @@ Again: if (nlv > b->nlive) b->nlive = nlv; } - - for (p=b->phi; p; p=p->link) { - BCLR(b->in, p->to.val); - for (a=0; a<p->narg; a++) - if (rtype(p->arg[a]) == RTmp) - BSET(p->blk[a]->out, p->arg[a].val); - } } if (chg) { chg = 0; |