shithub: mc

Download patch

ref: b33ad4ba9ef23d2dbeec7fcd895d80c1c7d45026
parent: b8545d80c9f3e18e2357be1a44b69dc9ad914458
author: Ori Bernstein <[email protected]>
date: Fri Feb 1 10:05:59 EST 2013

Revert "Broke some tests, but now we do a better job of callee-save."

This reverts commit b8545d80c9f3e18e2357be1a44b69dc9ad914458.

    Breaking tests in the main branch is bad.

--- 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,11 +790,14 @@
     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 */
 }
 
@@ -802,7 +805,7 @@
 {
     Loc *rsp, *rbp;
     Loc *ret;
-    size_t i;
+    //size_t i;
 
     rsp = locphysreg(Rrsp);
     rbp = locphysreg(Rrbp);
@@ -810,10 +813,12 @@
         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, v, &t); t++)
+    for (t = 0; adjiter(s, u, &t); t++)
         if (!ok(s, t, u))
             return 0;
     return 1;