commit c56148e7f901bbaf9d87eccc3c46fefae548bf9f
parent a9a723e0089e39829dfc22d006c6c6b0873f1772
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 26 Feb 2016 16:01:52 -0500
get rid of Bits
Diffstat:
3 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/lisc/lisc.h b/lisc/lisc.h
@@ -11,7 +11,8 @@ typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned long ulong;
-typedef struct Bits Bits;
+#define BIT(n) (1ul << (n))
+
typedef struct BSet BSet;
typedef struct Ref Ref;
typedef struct OpDesc OpDesc;
@@ -95,16 +96,6 @@ struct BSet {
ulong *t;
};
-struct Bits {
- ulong t[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))
-
struct Ref {
uint16_t type:2;
uint16_t val:14;
@@ -467,7 +458,6 @@ void freeall(void);
Blk *bnew(void);
void emit(int, int, Ref, Ref, Ref);
void emiti(Ins);
-int bcnt(Bits *);
void idup(Ins **, Ins *, ulong);
Ins *icpy(Ins *, Ins *, ulong);
void *vnew(ulong, size_t);
diff --git a/lisc/spill.c b/lisc/spill.c
@@ -290,8 +290,8 @@ dopm(Blk *b, Ins *i, BSet *v)
i--;
t = i->to.val;
if (!req(i->to, R))
- if (BGET(*v, t)) {
- BCLR(*v, t);
+ if (bshas(v, t)) {
+ bsclr(v, t);
store(i->to, tmp[t].slot);
}
bsset(v, i->arg[0].val);
diff --git a/lisc/util.c b/lisc/util.c
@@ -108,23 +108,6 @@ emiti(Ins i)
emit(i.op, i.cls, i.to, i.arg[0], i.arg[1]);
}
-int
-bcnt(Bits *b)
-{
- int z, i, j;
- ulong tmp;
-
- i = 0;
- for (z=0; z<BITS; z++) {
- tmp = b->t[z];
- for (j=0; j<64; j++) {
- i += 1 & tmp;
- tmp >>= 1;
- }
- }
- return i;
-}
-
void
idup(Ins **pd, Ins *s, ulong n)
{