summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-09 21:34:59 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-09 21:34:59 -0500
commit8ed8f1cd4c8251c6aba3f694b711179a44c91397 (patch)
tree390b006f92f4efae3504e9796fa996241049cdf7 /lisc
parentb5330f2a44466c5ceeed4b2e35dca6b37ca659a5 (diff)
downloadroux-8ed8f1cd4c8251c6aba3f694b711179a44c91397.tar.gz
provide BZERO macro for bitsets
Diffstat (limited to 'lisc')
-rw-r--r--lisc/lisc.h1
-rw-r--r--lisc/live.c6
-rw-r--r--lisc/rega.c2
-rw-r--r--lisc/spill.c4
-rw-r--r--lisc/ssa.c2
5 files changed, 8 insertions, 7 deletions
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; t<fn->ntmp; 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; 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) {