فهرست منبع

tradeoff the type of bsiter()

int is used all over the place for temporaries,
maybe this should be changed, I don't know.

Another thing to consider is that temporaries
are currently on 12 bits (and will be on 29
or 30 bits in the future), so int will always be
safe to store them.  We just loose the free
invariant of non-negativity.
Quentin Carbonneaux 9 سال پیش
والد
کامیت
e7825e70d5
4فایلهای تغییر یافته به همراه7 افزوده شده و 9 حذف شده
  1. 1 1
      all.h
  2. 1 2
      live.c
  3. 3 4
      spill.c
  4. 2 2
      util.c

+ 1 - 1
all.h

@@ -510,7 +510,7 @@ void bsunion(BSet *, BSet *);
 void bsinter(BSet *, BSet *);
 void bsinter(BSet *, BSet *);
 void bsdiff(BSet *, BSet *);
 void bsdiff(BSet *, BSet *);
 int bsequal(BSet *, BSet *);
 int bsequal(BSet *, BSet *);
-int bsiter(BSet *, uint *);
+int bsiter(BSet *, int *);
 
 
 static inline int
 static inline int
 bshas(BSet *bs, uint elt)
 bshas(BSet *bs, uint elt)

+ 1 - 2
live.c

@@ -70,8 +70,7 @@ filllive(Fn *f)
 {
 {
 	Blk *b;
 	Blk *b;
 	Ins *i;
 	Ins *i;
-	int k, m[2], n, chg, nlv[2];
-	uint t;
+	int k, t, m[2], n, chg, nlv[2];
 	short *phi;
 	short *phi;
 	BSet u[1], v[1];
 	BSet u[1], v[1];
 	Mem *ma;
 	Mem *ma;

+ 3 - 4
spill.c

@@ -178,8 +178,7 @@ static void
 limit(BSet *b, int k, BSet *f)
 limit(BSet *b, int k, BSet *f)
 {
 {
 	static int *tarr, maxt;
 	static int *tarr, maxt;
-	int i, nt;
-	uint t;
+	int i, t, nt;
 
 
 	nt = bscount(b);
 	nt = bscount(b);
 	if (nt <= k)
 	if (nt <= k)
@@ -222,7 +221,7 @@ limit2(BSet *b1, int k1, int k2, BSet *fst)
 static void
 static void
 sethint(BSet *u, bits r)
 sethint(BSet *u, bits r)
 {
 {
-	uint t;
+	int t;
 
 
 	for (t=Tmp0; bsiter(u, &t); t++)
 	for (t=Tmp0; bsiter(u, &t); t++)
 		tmp[phicls(t, tmp)].hint.m |= r;
 		tmp[phicls(t, tmp)].hint.m |= r;
@@ -231,7 +230,7 @@ sethint(BSet *u, bits r)
 static void
 static void
 reloads(BSet *u, BSet *v)
 reloads(BSet *u, BSet *v)
 {
 {
-	uint t;
+	int t;
 
 
 	for (t=Tmp0; bsiter(u, &t); t++)
 	for (t=Tmp0; bsiter(u, &t); t++)
 		if (!bshas(v, t))
 		if (!bshas(v, t))

+ 2 - 2
util.c

@@ -313,7 +313,7 @@ bszero(BSet *bs)
  *
  *
  */
  */
 int
 int
-bsiter(BSet *bs, uint *elt)
+bsiter(BSet *bs, int *elt)
 {
 {
 	uint i;
 	uint i;
 
 
@@ -332,7 +332,7 @@ bsiter(BSet *bs, uint *elt)
 void
 void
 dumpts(BSet *bs, Tmp *tmp, FILE *f)
 dumpts(BSet *bs, Tmp *tmp, FILE *f)
 {
 {
-	uint t;
+	int t;
 
 
 	fprintf(f, "[");
 	fprintf(f, "[");
 	for (t=Tmp0; bsiter(bs, &t); t++)
 	for (t=Tmp0; bsiter(bs, &t); t++)