summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-02-02 14:17:35 -0500
committerOri Bernstein <ori@eigenstate.org>2013-02-02 14:17:35 -0500
commit46a5568cdeeb3d83c2c19eea218f232a9515f887 (patch)
tree088068d7ce74277797090bf2c1a18161f2ce1ffe
parent3ba26321481a71d648b37e6ab001e7d17bb63c67 (diff)
downloadmc-46a5568cdeeb3d83c2c19eea218f232a9515f887.tar.gz
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.
-rw-r--r--6/ra.c24
-rw-r--r--parse/util.c2
2 files changed, 16 insertions, 10 deletions
diff --git a/6/ra.c b/6/ra.c
index f18feef..879c490 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -19,6 +19,7 @@ struct Usemap {
};
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,14 +444,16 @@ static size_t nodemoves(Isel *s, regid n, Insn ***pil)
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++) {
if (s->wlmove[j] == s->rmoves[n][i]) {
if (pil)
lappend(pil, &count, s->rmoves[n][i]);
- continue;
+ else
+ count++;
}
}
}
@@ -549,12 +552,12 @@ static void wladd(Isel *s, regid u)
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 @@ void regalloc(Isel *s)
if (spilled)
rewrite(s);
} while (spilled);
- printf("Done\n");
bsfree(s->prepainted);
bsfree(s->shouldspill);
bsfree(s->neverspill);
@@ -1242,6 +1244,10 @@ static void check(Isel *s)
foo[n] = 't';
n++;
}
+ if (bshas(s->coalesced, i)) {
+ foo[n] = 'k';
+ n++;
+ }
if (bshas(s->spilled, i)) {
foo[n] = 'l';
n++;
diff --git a/parse/util.c b/parse/util.c
index 8760b68..f5bbbec 100644
--- a/parse/util.c
+++ b/parse/util.c
@@ -39,7 +39,7 @@ void *zrealloc(void *mem, size_t oldsz, size_t sz)
char *p;
p = xrealloc(mem, sz);
- if ((ssize_t)sz - (ssize_t)oldsz > 0)
+ if (sz > oldsz)
bzero(&p[oldsz], sz - oldsz);
return p;
}