summary refs log tree commit diff
path: root/spill.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-02-12 02:27:46 -0800
committerQuentin Carbonneaux <quentin@c9x.me>2022-02-17 22:35:22 +0100
commit630127c68b872dcb7ddb22079f91f001b73945fc (patch)
tree45adf0b29e94f8f4660c03987587c8e85c74d980 /spill.c
parente092473be1cf48216085f8349677cefc8f19b3b2 (diff)
downloadroux-630127c68b872dcb7ddb22079f91f001b73945fc.tar.gz
spill: consider jump argument as use of register
Diffstat (limited to 'spill.c')
-rw-r--r--spill.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/spill.c b/spill.c
index 4c11d9f..2ce1d4f 100644
--- a/spill.c
+++ b/spill.c
@@ -412,6 +412,20 @@ spill(Fn *fn)
 		bscopy(b->out, v);
 
 		/* 2. process the block instructions */
+		if (rtype(b->jmp.arg) == RTmp) {
+			t = b->jmp.arg.val;
+			assert(KBASE(tmp[t].cls) == 0);
+			lvarg[0] = bshas(v, t);
+			bsset(v, t);
+			bscopy(u, v);
+			limit2(v, 0, 0, NULL);
+			if (!bshas(v, t)) {
+				if (!lvarg[0])
+					bsclr(u, t);
+				b->jmp.arg = slot(t);
+			}
+			reloads(u, v);
+		}
 		curi = &insb[NIns];
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
 			i--;