commit f6d5193cace797542d075190cdc3c62058bb5e54
parent 6f808867f1579008e40b33916f5c711e272860ec
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sat, 27 Feb 2016 13:41:57 -0500
use a new bits type for bitmaps
Diffstat:
4 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/lisc/isel.c b/lisc/isel.c
@@ -538,10 +538,10 @@ int rclob[] = {RBX, R12, R13, R14, R15};
MAKESURE(rsave_has_correct_size, sizeof rsave == NRSave * sizeof(int));
MAKESURE(rclob_has_correct_size, sizeof rclob == NRClob * sizeof(int));
-ulong
+bits
calldef(Ins i, int p[2])
{
- ulong b;
+ bits b;
int ni, nf;
b = 0;
@@ -562,10 +562,10 @@ calldef(Ins i, int p[2])
return b;
}
-ulong
+bits
calluse(Ins i, int p[2])
{
- ulong b;
+ bits b;
int j, ni, nf;
b = 0;
diff --git a/lisc/lisc.h b/lisc/lisc.h
@@ -10,8 +10,7 @@
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned long ulong;
-
-#define BIT(n) (1ul << (n))
+typedef unsigned long bits;
typedef struct BSet BSet;
typedef struct Ref Ref;
@@ -86,14 +85,16 @@ enum {
NTyp = 128,
BITS = 4,
- NBit = CHAR_BIT * sizeof(ulong),
+ NBit = CHAR_BIT * sizeof(bits),
};
MAKESURE(NBit_is_enough, NBit >= (int)Tmp0);
+#define BIT(n) ((bits)1 << (n))
+
struct BSet {
uint nt;
- ulong *t;
+ bits *t;
};
struct Ref {
@@ -366,7 +367,7 @@ struct Tmp {
short cls;
struct {
int r;
- ulong m;
+ bits m;
} hint;
int phi;
int visit;
@@ -407,7 +408,7 @@ struct Fn {
int nblk;
int retty;
Blk **rpo;
- ulong reg;
+ bits reg;
int slot;
char name[NString];
};
@@ -506,8 +507,8 @@ void filllive(Fn *);
/* isel.c */
extern int rsave[/* NRSave */];
extern int rclob[/* NRClob */];
-ulong calldef(Ins, int[2]);
-ulong calluse(Ins, int[2]);
+bits calldef(Ins, int[2]);
+bits calluse(Ins, int[2]);
void isel(Fn *);
/* spill.c */
diff --git a/lisc/rega.c b/lisc/rega.c
@@ -13,7 +13,7 @@ struct RMap {
int n;
};
-static ulong regu; /* registers used */
+static bits regu; /* registers used */
static Tmp *tmp; /* function temporaries */
static Mem *mem; /* function mem references */
static struct {
@@ -31,7 +31,7 @@ hint(int t)
static void
sethint(int t, int r)
{
- ulong m;
+ bits m;
m = tmp[phicls(t, tmp)].hint.m;
if (*hint(t) == -1)
@@ -92,7 +92,7 @@ radd(RMap *m, int t, int r)
static Ref
ralloc(RMap *m, int t)
{
- ulong regs;
+ bits regs;
int r, r0, r1;
if (t < Tmp0) {
@@ -284,7 +284,7 @@ dopm(Blk *b, Ins *i, RMap *m)
RMap m0;
int n, r, r1, t, s;
Ins *i0, *i1, *ip, *ir;
- ulong def;
+ bits def;
m0 = *m;
i1 = ++i;
@@ -357,7 +357,7 @@ static void
doblk(Blk *b, RMap *cur)
{
int x, r, nr;
- ulong rs;
+ bits rs;
Ins *i;
Mem *m;
Ref *ra[4];
diff --git a/lisc/spill.c b/lisc/spill.c
@@ -230,7 +230,7 @@ limit2(BSet *b, int k1, int k2, BSet *fst)
}
static void
-sethint(BSet *u, ulong r)
+sethint(BSet *u, bits r)
{
uint t;
@@ -272,7 +272,7 @@ dopm(Blk *b, Ins *i, BSet *v)
int n, t;
BSet u[1];
Ins *i1;
- ulong r;
+ bits r;
bsinit(u, ntmp); /* todo, free those */
/* consecutive copies from
@@ -336,7 +336,7 @@ spill(Fn *fn)
Ins *i;
Phi *p;
Mem *m;
- ulong r;
+ bits r;
tmp = fn->tmp;
ntmp = fn->ntmp;