summary refs log tree commit diff
path: root/lisc/spill.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-12-23 17:05:41 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-12-23 17:05:41 -0500
commit215914f58d363b6622b37079fb22073415cfb4b8 (patch)
treefe05a8840a6637a2bfc30efd4da3c92e04998923 /lisc/spill.c
parent56fc8bfe5cc882683ffc9a87a01591c7fdc72e71 (diff)
downloadroux-215914f58d363b6622b37079fb22073415cfb4b8.tar.gz
missing case in tmpuse() of spiller
Diffstat (limited to 'lisc/spill.c')
-rw-r--r--lisc/spill.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisc/spill.c b/lisc/spill.c
index 40bd326..7f967e4 100644
--- a/lisc/spill.c
+++ b/lisc/spill.c
@@ -31,14 +31,20 @@ loopmark(Blk *hd, Blk *b, Phi *p)
 static void
 tmpuse(Ref r, int use, int loop, Fn *fn)
 {
+	Mem *m;
 	Tmp *t;
 
-	if (rtype(r) != RTmp || r.val < Tmp0)
-		return;
-	t = &fn->tmp[r.val];
-	t->nuse += use;
-	t->ndef += !use;
-	t->cost += loop;
+	if (rtype(r) == RAMem) {
+		m = &fn->mem[r.val & AMask];
+		tmpuse(m->base, 1, loop, fn);
+		tmpuse(m->index, 1, loop, fn);
+	}
+	else if (rtype(r) == RTmp && r.val >= Tmp0) {
+		t = &fn->tmp[r.val];
+		t->nuse += use;
+		t->ndef += !use;
+		t->cost += loop;
+	}
 }
 
 /* evaluate spill costs of temporaries,