summary refs log tree commit diff
path: root/spill.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2017-05-16 11:44:52 -0400
committerQuentin Carbonneaux <quentin@c9x.me>2017-05-16 11:44:52 -0400
commit436d0fc07e4551dd4265cfed0b0bc459c71ed8ce (patch)
treeec169d76affef4746212dac6b39da51fe4faede8 /spill.c
parent425a2ed09c08222e1254d93dba24c7a50e7a08b9 (diff)
downloadroux-436d0fc07e4551dd4265cfed0b0bc459c71ed8ce.tar.gz
change the computation of spill costs for phis
I now take the view that a phi is "used" at the
end of all the predecessors.  (Think that copies
are made to phis at the end of all predecessors.)
Diffstat (limited to 'spill.c')
-rw-r--r--spill.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/spill.c b/spill.c
index 3871247..d3a11f7 100644
--- a/spill.c
+++ b/spill.c
@@ -68,13 +68,11 @@ fillcost(Fn *fn)
 	}
 	for (b=fn->start; b; b=b->link) {
 		for (p=b->phi; p; p=p->link) {
-			/* todo, the cost computation
-			 * for p->to is not great... */
+			t = &fn->tmp[p->to.val];
 			tmpuse(p->to, 0, 0, fn);
 			for (a=0; a<p->narg; a++) {
 				n = p->blk[a]->loop;
-				assert(b->npred==p->narg && "wrong cfg");
-				n /= b->npred;
+				t->cost += n;
 				tmpuse(p->arg[a], 1, n, fn);
 			}
 		}