mirror of
git://c9x.me/qbe.git
synced 2026-04-05 09:59:47 +00:00
fix jmp arg spilling
In case we need to spill to accomodate for the jump argument, piggyback the reloads from slots to regalloc so that they can be correctly inserted on edges.
This commit is contained in:
parent
e0ded59639
commit
6a2dca8b99
22
spill.c
22
spill.c
@ -406,26 +406,20 @@ spill(Fn *fn)
|
|||||||
if (rtype(b->jmp.arg) == RCall)
|
if (rtype(b->jmp.arg) == RCall)
|
||||||
v->t[0] |= T.retregs(b->jmp.arg, 0);
|
v->t[0] |= T.retregs(b->jmp.arg, 0);
|
||||||
}
|
}
|
||||||
|
if (rtype(b->jmp.arg) == RTmp) {
|
||||||
|
t = b->jmp.arg.val;
|
||||||
|
assert(KBASE(tmp[t].cls) == 0);
|
||||||
|
bsset(v, t);
|
||||||
|
limit2(v, 0, 0, NULL);
|
||||||
|
if (!bshas(v, t))
|
||||||
|
b->jmp.arg = slot(t);
|
||||||
|
}
|
||||||
for (t=Tmp0; bsiter(b->out, &t); t++)
|
for (t=Tmp0; bsiter(b->out, &t); t++)
|
||||||
if (!bshas(v, t))
|
if (!bshas(v, t))
|
||||||
slot(t);
|
slot(t);
|
||||||
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--;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user