summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-03-11 19:24:28 -0800
committerQuentin Carbonneaux <quentin@c9x.me>2021-03-18 12:43:49 +0100
commite0b94a3d6ade2f99ded481318e9e6d9f16953662 (patch)
tree2570c110b56de93f491b84e29438fd0434cf26ac
parent097dc86c45cc2f20cf98ec0385dbb57aaba419ec (diff)
downloadroux-e0b94a3d6ade2f99ded481318e9e6d9f16953662.tar.gz
spill: use stronger assertion for registers in use at start of function
-rw-r--r--amd64/sysv.c1
-rw-r--r--arm64/abi.c1
-rw-r--r--spill.c6
3 files changed, 6 insertions, 2 deletions
diff --git a/amd64/sysv.c b/amd64/sysv.c
index 3125069..045ec85 100644
--- a/amd64/sysv.c
+++ b/amd64/sysv.c
@@ -427,6 +427,7 @@ selpar(Fn *fn, Ins *i0, Ins *i1)
 		fa = argsclass(i0, i1, ac, Opar, &aret, &env);
 	} else
 		fa = argsclass(i0, i1, ac, Opar, 0, &env);
+	fn->reg = amd64_sysv_argregs(CALL(fa), 0);
 
 	for (i=i0, a=ac; i<i1; i++, a++) {
 		if (i->op != Oparc || a->inmem)
diff --git a/arm64/abi.c b/arm64/abi.c
index eef47bc..5fe9553 100644
--- a/arm64/abi.c
+++ b/arm64/abi.c
@@ -423,6 +423,7 @@ selpar(Fn *fn, Ins *i0, Ins *i1)
 	curi = &insb[NIns];
 
 	cty = argsclass(i0, i1, ca, &env);
+	fn->reg = arm64_argregs(CALL(cty), 0);
 
 	il = 0;
 	t = tmp;
diff --git a/spill.c b/spill.c
index 1aab8e5..132e0e9 100644
--- a/spill.c
+++ b/spill.c
@@ -397,7 +397,6 @@ spill(Fn *fn)
 		bscopy(b->out, v);
 
 		/* 2. process the block instructions */
-		r = v->t[0];
 		curi = &insb[NIns];
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
 			i--;
@@ -469,7 +468,10 @@ spill(Fn *fn)
 			if (r)
 				sethint(v, r);
 		}
-		assert(r == T.rglob || b == fn->start);
+		if (b == fn->start)
+			assert(v->t[0] == (T.rglob | fn->reg));
+		else
+			assert(v->t[0] == T.rglob);
 
 		for (p=b->phi; p; p=p->link) {
 			assert(rtype(p->to) == RTmp);