commit 8ed8f1cd4c8251c6aba3f694b711179a44c91397
parent b5330f2a44466c5ceeed4b2e35dca6b37ca659a5
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Mon, 9 Nov 2015 21:34:59 -0500
provide BZERO macro for bitsets
Diffstat:
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/lisc/lisc.h b/lisc/lisc.h
@@ -68,6 +68,7 @@ struct Bits {
};
#define BIT(n) (1ul << (n))
+#define BZERO(b) ((b) = (Bits){{0}})
#define BGET(b, n) (1&((b).t[n/NBit]>>(n%NBit)))
#define BSET(b, n) ((b).t[n/NBit] |= BIT(n%NBit))
#define BCLR(b, n) ((b).t[n/NBit] &= ~BIT(n%NBit))
diff --git a/lisc/live.c b/lisc/live.c
@@ -80,9 +80,9 @@ filllive(Fn *f)
assert(f->ntmp <= NBit*BITS);
phi = emalloc(f->ntmp * sizeof phi[0]);
for (b=f->start; b; b=b->link) {
- b->in = (Bits){{0}};
- b->out = (Bits){{0}};
- b->gen = (Bits){{0}};
+ BZERO(b->in);
+ BZERO(b->out);
+ BZERO(b->gen);
}
chg = 1;
Again:
diff --git a/lisc/rega.c b/lisc/rega.c
@@ -398,7 +398,7 @@ rega(Fn *fn)
for (n=fn->nblk-1; n>=0; n--) {
b = fn->rpo[n];
cur.n = 0;
- cur.b = (Bits){{0}};
+ BZERO(cur.b);
for (x=0; x<2; x++)
for (t=Tmp0; t<fn->ntmp; t++) {
assert(BGET(b->out, t) ||
diff --git a/lisc/spill.c b/lisc/spill.c
@@ -320,7 +320,7 @@ spill(Fn *fn)
curi = 0;
s1 = b->s1;
s2 = b->s2;
- v = (Bits){{0}};
+ BZERO(v);
hd = 0;
if (s1 && s1->id <= n)
hd = s1;
@@ -382,7 +382,7 @@ spill(Fn *fn)
}
s = tmp[t].slot;
}
- w = (Bits){{0}};
+ BZERO(w);
j = opdesc[i->op].nmem;
j -= rtype(i->arg[0]) == RAMem;
j -= rtype(i->arg[1]) == RAMem;
diff --git a/lisc/ssa.c b/lisc/ssa.c
@@ -207,7 +207,7 @@ phiins(Fn *fn)
for (t=Tmp0; t<nt; t++) {
if (fn->tmp[t].phi != 0)
continue;
- u = (Bits){{0}};
+ BZERO(u);
w = -1;
bp = be;
for (b=fn->start; b; b=b->link) {