summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-01-29 23:29:57 -0500
committerOri Bernstein <ori@eigenstate.org>2013-01-29 23:29:57 -0500
commitb8545d80c9f3e18e2357be1a44b69dc9ad914458 (patch)
tree904d5f76e57749ef66dc543c4e4d45e9dc930108
parentb474f4b5e52fdabfec503d8666aefe35bdbdb7f1 (diff)
downloadmc-b8545d80c9f3e18e2357be1a44b69dc9ad914458.tar.gz
Broke some tests, but now we do a better job of callee-save.
-rw-r--r--6/isel.c9
-rw-r--r--6/ra.c2
2 files changed, 3 insertions, 8 deletions
diff --git a/6/isel.c b/6/isel.c
index aa97bc0..0833e16 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -781,7 +781,7 @@ static void prologue(Isel *s, size_t sz)
Loc *rsp;
Loc *rbp;
Loc *stksz;
- //size_t i;
+ size_t i;
rsp = locphysreg(Rrsp);
rbp = locphysreg(Rrbp);
@@ -790,14 +790,11 @@ static void prologue(Isel *s, size_t sz)
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 @@ static void epilogue(Isel *s)
{
Loc *rsp, *rbp;
Loc *ret;
- //size_t i;
+ size_t i;
rsp = locphysreg(Rrsp);
rbp = locphysreg(Rrbp);
@@ -813,12 +810,10 @@ static void epilogue(Isel *s)
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);
diff --git a/6/ra.c b/6/ra.c
index 6373b7d..ff8b679 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -562,7 +562,7 @@ static int combinable(Isel *s, regid u, regid v)
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;