aboutsummaryrefslogtreecommitdiff
path: root/rega.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2017-02-07 22:49:17 -0500
committerQuentin Carbonneaux <[email protected]>2017-02-08 10:49:55 -0500
commit8799dc30ac472545bc93957c22f070590ff44cb3 (patch)
treefd7aef35ed9eda70aae4b8c6f1216addb4bdc94c /rega.c
parentc71f44c5a86f41e65179633160edeb90a9543987 (diff)
make rsp and rbp globally live
Diffstat (limited to 'rega.c')
-rw-r--r--rega.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/rega.c b/rega.c
index fae7538..9f02a63 100644
--- a/rega.c
+++ b/rega.c
@@ -154,9 +154,10 @@ mdump(RMap *m)
int i;
for (i=0; i<m->n; i++)
- fprintf(stderr, " (%s, R%d)",
- tmp[m->t[i]].name,
- m->r[i]);
+ if (m->t[i] >= Tmp0)
+ fprintf(stderr, " (%s, R%d)",
+ tmp[m->t[i]].name,
+ m->r[i]);
fprintf(stderr, "\n");
}
@@ -360,15 +361,10 @@ doblk(Blk *b, RMap *cur)
Mem *m;
Ref *ra[4];
+ for (r=0; bsiter(b->out, &r) && r<Tmp0; r++)
+ radd(cur, r, r);
if (rtype(b->jmp.arg) == RTmp)
b->jmp.arg = ralloc(cur, b->jmp.arg.val);
- else if (rtype(b->jmp.arg) == RCall) {
- /* add return registers */
- rs = retregs(b->jmp.arg, 0);
- for (r=0; rs; rs/=2, r++)
- if (rs & 1)
- radd(cur, r, r);
- }
for (i=&b->ins[b->nins]; i!=b->ins;) {
switch ((--i)->op) {
case Ocall:
@@ -444,8 +440,8 @@ rega(Fn *fn)
bsinit(cur.b, fn->ntmp);
bsinit(old.b, fn->ntmp);
- for (t=Tmp0; t<fn->ntmp; t++)
- *hint(t) = -1;
+ for (t=0; t<fn->ntmp; t++)
+ *hint(t) = t < Tmp0 ? t : -1;
for (b=fn->start, i=b->ins; i-b->ins < b->nins; i++)
if (i->op != Ocopy || !isreg(i->arg[0]))
break;