summaryrefslogtreecommitdiff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-05 16:26:21 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit7cb3e8587f7dbcbe795114f9ea5584009842ea29 (patch)
tree09bcb3cfdec15dadf39ef45e89a89b305fc1169b /lisc
parent078522cf5d5b7adbe56fb1300e47f642616354d5 (diff)
downloadroux-7cb3e8587f7dbcbe795114f9ea5584009842ea29.tar.gz
use nreg only when != NReg
Diffstat (limited to 'lisc')
-rw-r--r--lisc/spill.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/lisc/spill.c b/lisc/spill.c
index f963a1b..8b7c67e 100644
--- a/lisc/spill.c
+++ b/lisc/spill.c
@@ -288,7 +288,6 @@ spill(Fn *fn)
for (n=fn->nblk-1; n>=0; n--) {
/* invariant: m>n => in,out of m updated */
b = fn->rpo[n];
- nreg = NReg;
assert(bcnt(&br) == 0);
/* 1. find temporaries in registers at
@@ -309,16 +308,16 @@ spill(Fn *fn)
for (z=0; z<BITS; z++)
v.t[z] = hd->gen.t[z] & b->out.t[z];
j = bcnt(&v);
- if (j < nreg) {
+ if (j < NReg) {
w = b->out;
for (z=0; z<BITS; z++)
w.t[z] &= ~v.t[z];
j = bcnt(&w); /* live through */
- w = limit(&w, nreg - (l - j), 0);
+ w = limit(&w, NReg - (l - j), 0);
for (z=0; z<BITS; z++)
v.t[z] |= w.t[z];
- } else if (j > nreg)
- v = limit(&v, nreg, 0);
+ } else if (j > NReg)
+ v = limit(&v, NReg, 0);
} else if (s1) {
v = s1->in;
w = s1->in;
@@ -327,23 +326,14 @@ spill(Fn *fn)
v.t[z] |= s2->in.t[z];
w.t[z] &= s2->in.t[z];
}
- assert(bcnt(&w) <= nreg);
- v = limit(&v, nreg, &w);
+ assert(bcnt(&w) <= NReg);
+ v = limit(&v, NReg, &w);
}
b->out = v;
- assert(bcnt(&v) <= nreg);
+ assert(bcnt(&v) <= NReg);
/* 2. process the block instructions */
-#if 0
- if (rtype(b->jmp.arg) == RTmp) {
- j = b->jmp.arg.val;
- if (!BGET(v, j) && l==nreg) {
- v = limit(&v, l-1, 0);
- b->out = v;
- }
- BSET(v, j);
- }
-#endif
+ nreg = NReg;
curi = &insb[NIns];
for (i=&b->ins[b->nins]; i!=b->ins;) {
assert(bcnt(&v) <= nreg);
@@ -351,7 +341,7 @@ spill(Fn *fn)
s = 0;
switch (rtype(i->to)) {
default:
- assert(!"unhandled destination");
+ diag("spill: unhandled destination");
case RTmp:
j = i->to.val;
if (BGET(v, j))