mirror of
git://c9x.me/qbe.git
synced 2026-04-05 09:59:47 +00:00
revert heuristic to reuse stack slots
The heuristic was bogus for at least
two reasons (see below), and, looking
at some generated code, it looks like
some other issues are more pressing.
1. A stack slot of 4 bytes could be
used for a temporary of 8 bytes.
2. Should 2 arguments of an operation
end up spilled, the same slot
could be allocated to both!
This commit is contained in:
parent
4b7f02c097
commit
2e7d6b24ea
16
spill.c
16
spill.c
@ -309,7 +309,7 @@ void
|
|||||||
spill(Fn *fn)
|
spill(Fn *fn)
|
||||||
{
|
{
|
||||||
Blk *b, *s1, *s2, *hd, **bp;
|
Blk *b, *s1, *s2, *hd, **bp;
|
||||||
int j, l, t, k, s, lvarg[2];
|
int j, l, t, k, lvarg[2];
|
||||||
uint n;
|
uint n;
|
||||||
BSet u[1], v[1], w[1];
|
BSet u[1], v[1], w[1];
|
||||||
Ins *i;
|
Ins *i;
|
||||||
@ -404,11 +404,9 @@ spill(Fn *fn)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bszero(w);
|
bszero(w);
|
||||||
s = -1;
|
|
||||||
if (!req(i->to, R)) {
|
if (!req(i->to, R)) {
|
||||||
assert(rtype(i->to) == RTmp);
|
assert(rtype(i->to) == RTmp);
|
||||||
t = i->to.val;
|
t = i->to.val;
|
||||||
s = tmp[t].slot;
|
|
||||||
if (bshas(v, t))
|
if (bshas(v, t))
|
||||||
bsclr(v, t);
|
bsclr(v, t);
|
||||||
else {
|
else {
|
||||||
@ -442,13 +440,6 @@ spill(Fn *fn)
|
|||||||
bsset(v, t);
|
bsset(v, t);
|
||||||
if (j-- <= 0)
|
if (j-- <= 0)
|
||||||
bsset(w, t);
|
bsset(w, t);
|
||||||
else if (!lvarg[n]) {
|
|
||||||
/* recycle the slot of
|
|
||||||
* i->to when possible
|
|
||||||
*/
|
|
||||||
if (tmp[t].slot == -1)
|
|
||||||
tmp[t].slot = s;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bscopy(u, v);
|
bscopy(u, v);
|
||||||
@ -456,10 +447,7 @@ spill(Fn *fn)
|
|||||||
for (n=0; n<2; n++)
|
for (n=0; n<2; n++)
|
||||||
if (rtype(i->arg[n]) == RTmp) {
|
if (rtype(i->arg[n]) == RTmp) {
|
||||||
t = i->arg[n].val;
|
t = i->arg[n].val;
|
||||||
if (bshas(v, t)) {
|
if (!bshas(v, t)) {
|
||||||
if (tmp[t].slot == s)
|
|
||||||
tmp[t].slot = -1;
|
|
||||||
} else {
|
|
||||||
/* do not reload if the
|
/* do not reload if the
|
||||||
* argument is dead
|
* argument is dead
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user