ref: b8545d80c9f3e18e2357be1a44b69dc9ad914458
parent: b474f4b5e52fdabfec503d8666aefe35bdbdb7f1
author: Ori Bernstein <[email protected]>
date: Tue Jan 29 18:29:57 EST 2013
Broke some tests, but now we do a better job of callee-save.
--- a/6/isel.c
+++ b/6/isel.c
@@ -781,7 +781,7 @@
Loc *rsp;
Loc *rbp;
Loc *stksz;
- //size_t i;
+ size_t i;
rsp = locphysreg(Rrsp);
rbp = locphysreg(Rrbp);
@@ -790,14 +790,11 @@
g(s, Ipush, rbp, NULL);
g(s, Imov, rsp, rbp, NULL);
g(s, Isub, stksz, rsp, NULL);
-#if 0
/* save registers */
for (i = 0; i < sizeof(savedregs)/sizeof(savedregs[0]); i++) {
s->calleesave[i] = locreg(ModeQ);
g(s, Imov, locphysreg(savedregs[i]), s->calleesave[i], NULL);
}
-#endif
-
s->stksz = stksz; /* need to update if we spill */
}
@@ -805,7 +802,7 @@
{
Loc *rsp, *rbp;
Loc *ret;
- //size_t i;
+ size_t i;
rsp = locphysreg(Rrsp);
rbp = locphysreg(Rrbp);
@@ -813,12 +810,10 @@
ret = loc(s, s->ret);
g(s, Imov, ret, coreg(Rax, ret->mode), NULL);
}
-#if 0
/* restore registers */
for (i = 0; i < Nsaved; i++)
g(s, Imov, s->calleesave[i], locphysreg(savedregs[i]), NULL);
/* leave function */
-#endif
g(s, Imov, rbp, rsp, NULL);
g(s, Ipop, rbp, NULL);
g(s, Iret, NULL);
--- a/6/ra.c
+++ b/6/ra.c
@@ -562,7 +562,7 @@
return 1;
/* if it is, are the adjacent nodes ok to combine with this? */
- for (t = 0; adjiter(s, u, &t); t++)
+ for (t = 0; adjiter(s, v, &t); t++)
if (!ok(s, t, u))
return 0;
return 1;