Browse Source

spill: consider jump argument as use of register

Michael Forney 3 years ago
parent
commit
630127c68b
1 changed files with 14 additions and 0 deletions
  1. 14 0
      spill.c

+ 14 - 0
spill.c

@@ -412,6 +412,20 @@ spill(Fn *fn)
 		bscopy(b->out, v);
 		bscopy(b->out, v);
 
 
 		/* 2. process the block instructions */
 		/* 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];
 		curi = &insb[NIns];
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
 			i--;
 			i--;