aboutsummaryrefslogtreecommitdiff
path: root/spill.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2019-05-02 20:26:16 +0200
committerQuentin Carbonneaux <[email protected]>2019-05-02 20:31:39 +0200
commit2e7d6b24eaa1314eb4fe663ef5dc529e461fb8ce (patch)
tree1e5a0857b5581f3c214515f7cecc86467c148a7c /spill.c
parent4b7f02c09710b379a706708ae5880a1811519539 (diff)
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!
Diffstat (limited to 'spill.c')
-rw-r--r--spill.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/spill.c b/spill.c
index 0742caa..c1599c0 100644
--- a/spill.c
+++ b/spill.c
@@ -309,7 +309,7 @@ void
spill(Fn *fn)
{
Blk *b, *s1, *s2, *hd, **bp;
- int j, l, t, k, s, lvarg[2];
+ int j, l, t, k, lvarg[2];
uint n;
BSet u[1], v[1], w[1];
Ins *i;
@@ -404,11 +404,9 @@ spill(Fn *fn)
continue;
}
bszero(w);
- s = -1;
if (!req(i->to, R)) {
assert(rtype(i->to) == RTmp);
t = i->to.val;
- s = tmp[t].slot;
if (bshas(v, t))
bsclr(v, t);
else {
@@ -442,13 +440,6 @@ spill(Fn *fn)
bsset(v, t);
if (j-- <= 0)
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;
}
bscopy(u, v);
@@ -456,10 +447,7 @@ spill(Fn *fn)
for (n=0; n<2; n++)
if (rtype(i->arg[n]) == RTmp) {
t = i->arg[n].val;
- if (bshas(v, t)) {
- if (tmp[t].slot == s)
- tmp[t].slot = -1;
- } else {
+ if (!bshas(v, t)) {
/* do not reload if the
* argument is dead
*/