commit 165392ab63ee1dc3040917fc7c316847a16a210f
parent abc25578395587c5d76d8dbb877726a19c419b2c
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 27 Feb 2016 22:36:58 -0500
leave only the most important free todos
Diffstat:
4 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/lisc/live.c b/lisc/live.c
@@ -75,7 +75,7 @@ filllive(Fn *f)
BSet u[1], v[1];
Mem *ma;
- bsinit(u, f->ntmp); /* todo, free those */
+ bsinit(u, f->ntmp);
bsinit(v, f->ntmp);
phi = emalloc(f->ntmp * sizeof phi[0]);
for (b=f->start; b; b=b->link) {
diff --git a/lisc/rega.c b/lisc/rega.c
@@ -434,8 +434,7 @@ rega(Fn *fn)
mem = fn->mem;
end = alloc(fn->nblk * sizeof end[0]);
beg = alloc(fn->nblk * sizeof beg[0]);
-
- for (n=0; n<fn->nblk; n++) { /* todo, free those */
+ for (n=0; n<fn->nblk; n++) {
bsinit(end[n].b, fn->ntmp);
bsinit(beg[n].b, fn->ntmp);
}
diff --git a/lisc/spill.c b/lisc/spill.c
@@ -180,7 +180,8 @@ static void
limit(BSet *b, int k, BSet *f)
{
static int *tarr, maxt;
- int i, t, nt;
+ int i, nt;
+ uint t;
nt = bscount(b);
if (nt <= k)
@@ -190,13 +191,10 @@ limit(BSet *b, int k, BSet *f)
tarr = emalloc(nt * sizeof tarr[0]);
maxt = nt;
}
- i = 0;
- for (t=0; t<ntmp; t++)
- if (bshas(b, t)) {
- bsclr(b, t);
- tarr[i++] = t;
- }
- assert(i == nt);
+ for (i=0, t=0; bsiter(b, &t); t++) {
+ bsclr(b, t);
+ tarr[i++] = t;
+ }
if (!f)
qsort(tarr, nt, sizeof tarr[0], tcmp0);
else {
@@ -212,21 +210,18 @@ limit(BSet *b, int k, BSet *f)
static void
limit2(BSet *b, int k1, int k2, BSet *fst)
{
- BSet u[1], t[1];
- int k;
-
- bsinit(u, ntmp); /* todo, free those */
- bsinit(t, ntmp);
- bscopy(t, b);
- bszero(b);
- k1 = NIReg - k1;
- k2 = NFReg - k2;
- for (k=0; k<2; k++) {
- bscopy(u, t);
- bsinter(u, mask[k]);
- limit(u, k == 0 ? k1 : k2, fst);
- bsunion(b, u);
- }
+ BSet b1[1], b2[1];
+
+ bsinit(b1, ntmp); /* todo, free those */
+ bsinit(b2, ntmp);
+ bscopy(b1, b);
+ bscopy(b2, b);
+ bsinter(b1, mask[0]);
+ bsinter(b2, mask[1]);
+ limit(b1, NIReg - k1, fst);
+ limit(b2, NFReg - k2, fst);
+ bscopy(b, b1);
+ bsunion(b, b2);
}
static void
@@ -340,13 +335,11 @@ spill(Fn *fn)
tmp = fn->tmp;
ntmp = fn->ntmp;
-
- bsinit(u, ntmp); /* todo, free those */
+ bsinit(u, ntmp);
bsinit(v, ntmp);
bsinit(w, ntmp);
bsinit(mask[0], ntmp);
bsinit(mask[1], ntmp);
-
locs = fn->slot;
slot4 = 0;
slot8 = 0;
diff --git a/lisc/ssa.c b/lisc/ssa.c
@@ -295,7 +295,7 @@ phiins(Fn *fn)
Ref r;
int t, n, k, nt;
- bsinit(u, fn->nblk); /* todo, free those */
+ bsinit(u, fn->nblk);
bsinit(defs, fn->nblk);
blist = emalloc(fn->nblk * sizeof blist[0]);
be = &blist[fn->nblk];