From 8ed8f1cd4c8251c6aba3f694b711179a44c91397 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 9 Nov 2015 21:34:59 -0500 Subject: provide BZERO macro for bitsets --- lisc/lisc.h | 1 + lisc/live.c | 6 +++--- lisc/rega.c | 2 +- lisc/spill.c | 4 ++-- lisc/ssa.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) (limited to 'lisc') diff --git a/lisc/lisc.h b/lisc/lisc.h index b73b8a0..aa25c20 100644 --- 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 index dc8060d..053e01a 100644 --- 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 index a55a871..4c8ae04 100644 --- 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; tntmp; t++) { assert(BGET(b->out, t) || diff --git a/lisc/spill.c b/lisc/spill.c index b0dcd1b..0b88574 100644 --- 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 index 4b3ff68..d31cfad 100644 --- a/lisc/ssa.c +++ b/lisc/ssa.c @@ -207,7 +207,7 @@ phiins(Fn *fn) for (t=Tmp0; ttmp[t].phi != 0) continue; - u = (Bits){{0}}; + BZERO(u); w = -1; bp = be; for (b=fn->start; b; b=b->link) { -- cgit 1.4.1