summary refs log tree commit diff
path: root/lisc/live.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-03 13:17:44 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:29 -0400
commit9456200d91840b09cb876146c271c5cbe503d767 (patch)
tree89d1500294b163f05498549babff5a4be60adfc8 /lisc/live.c
parent93601b6d0234875cf97e57b7e56fdd5a1803eac0 (diff)
downloadroux-9456200d91840b09cb876146c271c5cbe503d767.tar.gz
use a new Ref type for registers
This might not be a good idea, the problem was that
many spurious registers would be added to the Bits
data-structures during compilation (and would
always remain 0).  However, doing the above
modification de-uniformizes the handling of temps
and regs, this makes the code longer and not
really nicer.  Also, additional Bits structures
are required to track the registers independently.

Overall this might be a bad idea to revert.
Diffstat (limited to 'lisc/live.c')
-rw-r--r--lisc/live.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisc/live.c b/lisc/live.c
index d1c31a2..aec7701 100644
--- a/lisc/live.c
+++ b/lisc/live.c
@@ -6,7 +6,7 @@ bset(Ref r, Blk *b, Bits *rb, int *nlv)
 	Bits *bs;
 
 	switch (rtype(r)) {
-	case RSym:
+	case RTmp:
 		bs = &b->in;
 		BSET(b->gen, r.val);
 		break;
@@ -14,7 +14,6 @@ bset(Ref r, Blk *b, Bits *rb, int *nlv)
 		bs = rb;
 		break;
 	default:
-		diag("live: unhandled reference");
 		return;
 	}
 	if (!BGET(*bs, r.val)) {
@@ -36,7 +35,7 @@ filllive(Fn *f)
 	uint a;
 	Bits tb, rb;
 
-	assert(f->nsym <= NBit*BITS);
+	assert(f->ntmp <= NBit*BITS);
 	for (b=f->start; b; b=b->link) {
 		b->in = (Bits){{0}};
 		b->out = (Bits){{0}};
@@ -64,15 +63,18 @@ Again:
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
 			i--;
 			switch (rtype(i->to)) {
-			case RSym:
+			default:
+				diag("live: unhandled destination");
+			case 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);
-			default:
-				diag("live: unhandled destination");
+				break;
+			case -1:
+				break;
 			}
 			bset(i->arg[0], b, &rb, &nlv);
 			bset(i->arg[1], b, &rb, &nlv);
@@ -83,7 +85,7 @@ Again:
 		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]) == RSym)
+				if (rtype(p->arg[a]) == RTmp)
 					BSET(p->blk[a]->out, p->arg[a].val);
 		}
 	}