shithub: mc

Download patch

ref: 46a5568cdeeb3d83c2c19eea218f232a9515f887
parent: 3ba26321481a71d648b37e6ab001e7d17bb63c67
author: Ori Bernstein <[email protected]>
date: Sat Feb 2 09:17:35 EST 2013

Fix moverelated.

    If we didn't pass in the instruction list pointer, we wouldn't
    have updated the count. This was incorrect for checking if we were
    move related, because would have returned '0' for the number of
    move related nodes.

--- a/6/ra.c
+++ b/6/ra.c
@@ -19,6 +19,7 @@
 };
 
 void wlprint(FILE *fd, char *name, Loc **wl, size_t nwl);
+static int moverelated(Isel *s, regid n);
 static void printedge(FILE *fd, char *msg, size_t a, size_t b);
 static void check(Isel *s);
 
@@ -443,7 +444,8 @@
             if (s->mactive[j] == s->rmoves[n][i]) {
                 if (pil)
                     lappend(pil, &count, s->rmoves[n][i]);
-                continue;
+                else
+                    count++;
             }
         }
         for (j = 0; j < s->nwlmove; j++) {
@@ -450,7 +452,8 @@
             if (s->wlmove[j] == s->rmoves[n][i]) {
                 if (pil)
                     lappend(pil, &count, s->rmoves[n][i]);
-                continue;
+                else
+                    count++;
             }
         }
     }
@@ -549,12 +552,12 @@
         return;
 
     check(s);
-    if (wlhas(s->wlsimp, s->nwlfreeze, u, &x)) printf("%zd on simp\n", i);
-    if (wlhas(s->wlfreeze, s->nwlfreeze, u, &x)) printf("%zd on freeze\n", i);
-    if (wlhas(s->wlspill, s->nwlspill, u, &x)) printf("%zd on spill\n", i);
-    if (wlhas(s->selstk, s->nselstk, u, &x)) printf("%zd selecst stack\n", i);
-    if (bshas(s->coalesced, u)) printf("%zd coalesced\n", i);
-    if (bshas(s->spilled, u)) printf("%zd on stack\n", i);
+    if (wlhas(s->wlsimp, s->nwlsimp, u, &x)) printf("%zd on simp\n", u);
+    if (wlhas(s->wlfreeze, s->nwlfreeze, u, &x)) printf("%zd on freeze\n", u);
+    if (wlhas(s->wlspill, s->nwlspill, u, &x)) printf("%zd on spill\n", u);
+    if (wlhas(s->selstk, s->nselstk, u, &x)) printf("%zd on select stack\n", u);
+    if (bshas(s->coalesced, u)) printf("%zd on coalesced\n", u);
+    if (bshas(s->spilled, u)) printf("%zd on stack\n", u);
     assert(wlhas(s->wlfreeze, s->nwlfreeze, u, &i));
     ldel(&s->wlfreeze, &s->nwlfreeze, i);
     lappend(&s->wlsimp, &s->nwlsimp, locmap[u]);
@@ -1069,7 +1072,6 @@
         if (spilled)
             rewrite(s);
     } while (spilled);
-    printf("Done\n");
     bsfree(s->prepainted);
     bsfree(s->shouldspill);
     bsfree(s->neverspill);
@@ -1240,6 +1242,10 @@
         }
         if (wlhas(s->selstk, s->nselstk, i, &idx)) {
             foo[n] = 't';
+            n++;
+        }
+        if (bshas(s->coalesced, i)) {
+            foo[n] = 'k';
             n++;
         }
         if (bshas(s->spilled, i)) {
--- a/parse/util.c
+++ b/parse/util.c
@@ -39,7 +39,7 @@
     char *p;
 
     p = xrealloc(mem, sz);
-    if ((ssize_t)sz - (ssize_t)oldsz > 0)
+    if (sz > oldsz)
         bzero(&p[oldsz], sz - oldsz);
     return p;
 }