summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-02-06 00:40:44 -0500
committerOri Bernstein <ori@eigenstate.org>2013-02-06 00:40:44 -0500
commita3a707822d301c6c1e3cfd164c35e67463406397 (patch)
tree7547dc1fe3abf9e5efdec0c7c6103ce94fcee802
parent44c84f416b58264e371350eeb6d63bcfee699084 (diff)
downloadmc-a3a707822d301c6c1e3cfd164c35e67463406397.tar.gz
Fix the ok heuristic again.
Set operations. The node can already be in the freeze or simplify worklist. Tricky, tricky.
-rw-r--r--6/ra.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/6/ra.c b/6/ra.c
index 67389e7..6d87125 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -300,6 +300,7 @@ static int wlhas(Loc **wl, size_t nwl, regid v, size_t *idx)
return 1;
}
}
+ *idx = -1;
return 0;
}
@@ -543,6 +544,7 @@ static void enablemove(Isel *s, regid n)
static void decdegree(Isel *s, regid m)
{
int d;
+ int found;
size_t idx;
regid n;
@@ -554,13 +556,19 @@ static void decdegree(Isel *s, regid m)
enablemove(s, m);
for (n = 0; adjiter(s, m, &n); n++)
enablemove(s, n);
- if (!wlhas(s->wlspill, s->nwlspill, m, &idx))
- die("%zd not in wlspill", m);
- ldel(&s->wlspill, &s->nwlspill, idx);
+ found = wlhas(s->wlspill, s->nwlspill, m, &idx);
+ if (found)
+ ldel(&s->wlspill, &s->nwlspill, idx);
if (moverelated(s, m)) {
- lappend(&s->wlfreeze, &s->nwlfreeze, locmap[m]);
+ if (!found)
+ assert(wlhas(s->wlfreeze, s->nwlfreeze, m, &idx));
+ else
+ lappend(&s->wlfreeze, &s->nwlfreeze, locmap[m]);
} else {
- lappend(&s->wlsimp, &s->nwlsimp, locmap[m]);
+ if (!found)
+ assert(wlhas(s->wlsimp, s->nwlsimp, m, &idx));
+ else
+ lappend(&s->wlsimp, &s->nwlsimp, locmap[m]);
}
}
}
@@ -637,7 +645,7 @@ static int conservative(Isel *s, regid u, regid v)
/* FIXME: is this actually correct? */
static int ok(Isel *s, regid t, regid r)
{
- return s->degree[t] < K - 1 || bshas(s->prepainted, t) || gbhasedge(s, t, r);
+ return s->degree[t] < K || bshas(s->prepainted, t) || gbhasedge(s, t, r);
}
static int combinable(Isel *s, regid u, regid v)