summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-22 15:34:12 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-22 15:34:12 -0700
commitc34f7840a5c1984deb9bedf2817aa0c8d4b09b83 (patch)
tree2fe97f1dad592ea327531fcb021517671b055c68 /6
parentcdda2a180d180c48e9ba197c4a0cecc7e075b782 (diff)
downloadmc-c34f7840a5c1984deb9bedf2817aa0c8d4b09b83.tar.gz
qsort_r isn't portable.
Diffstat (limited to '6')
-rw-r--r--6/ra.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/6/ra.c b/6/ra.c
index e4ef844..2f76c2a 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -926,16 +926,14 @@ static int spillmetric(Isel *s, regid r)
return s->degree[r] * 100 / s->nuses[r];
}
-static int loccmp(const void *pa, const void *pb, void *v)
+Isel *_isel;
+static int loccmp(const void *pa, const void *pb)
{
Loc *a, *b;
- Isel *s;
a = *(Loc**)pa;
b = *(Loc**)pb;
- s = v;
-
- return spillmetric(s, b->reg.id) - spillmetric(s, a->reg.id);
+ return spillmetric(_isel, b->reg.id) - spillmetric(_isel, a->reg.id);
}
/* Select the spill candidates */
@@ -946,7 +944,8 @@ static void selspill(Isel *s)
/* FIXME: pick a better heuristic for spilling */
m = NULL;
- qsort_r(s->wlspill, s->nwlspill, sizeof s->wlspill[0], loccmp, s);
+ _isel = s;
+ qsort(s->wlspill, s->nwlspill, sizeof s->wlspill[0], loccmp);
for (i = 0; i < s->nwlspill; i++) {
if (!bshas(s->shouldspill, s->wlspill[i]->reg.id))
continue;