summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--alias.c2
-rw-r--r--all.h8
-rw-r--r--cfg.c21
-rw-r--r--fold.c18
-rw-r--r--load.c6
-rw-r--r--main.c2
-rw-r--r--rega.c6
-rw-r--r--ssa.c3
8 files changed, 33 insertions, 33 deletions
diff --git a/alias.c b/alias.c
index 3d1d00c..56178ca 100644
--- a/alias.c
+++ b/alias.c
@@ -101,7 +101,7 @@ esc(Ref r, Fn *fn)
 void
 fillalias(Fn *fn)
 {
-	int n;
+	uint n;
 	Blk *b;
 	Phi *p;
 	Ins *i;
diff --git a/all.h b/all.h
index 7243e09..cc94161 100644
--- a/all.h
+++ b/all.h
@@ -333,13 +333,13 @@ struct Blk {
 	Blk *s2;
 	Blk *link;
 
-	int id;
-	int visit;
+	uint id;
+	uint visit;
 
 	Blk *idom;
 	Blk *dom, *dlink;
 	Blk **fron;
-	int nfron;
+	uint nfron;
 
 	Blk **pred;
 	uint npred;
@@ -432,7 +432,7 @@ struct Fn {
 	int ntmp;
 	int ncon;
 	int nmem;
-	int nblk;
+	uint nblk;
 	int retty; /* index in typ[], -1 if no aggregate return */
 	Ref retr;
 	Blk **rpo;
diff --git a/cfg.c b/cfg.c
index 583629b..3b0c5bb 100644
--- a/cfg.c
+++ b/cfg.c
@@ -76,11 +76,11 @@ fillpreds(Fn *f)
 }
 
 static int
-rporec(Blk *b, int x)
+rporec(Blk *b, uint x)
 {
 	Blk *s1, *s2;
 
-	if (!b || b->id >= 0)
+	if (!b || b->id != -1u)
 		return x;
 	b->id = 1;
 	s1 = b->s1;
@@ -100,16 +100,16 @@ rporec(Blk *b, int x)
 void
 fillrpo(Fn *f)
 {
-	int n;
+	uint n;
 	Blk *b, **p;
 
 	for (b=f->start; b; b=b->link)
-		b->id = -1;
+		b->id = -1u;
 	n = 1 + rporec(f->start, f->nblk-1);
 	f->nblk -= n;
 	f->rpo = alloc(f->nblk * sizeof f->rpo[0]);
 	for (p=&f->start; (b=*p);) {
-		if (b->id == -1) {
+		if (b->id == -1u) {
 			blkdel(b);
 			*p = b->link;
 		} else {
@@ -150,8 +150,8 @@ void
 filldom(Fn *fn)
 {
 	Blk *b, *d;
-	int ch, n;
-	uint p;
+	int ch;
+	uint n, p;
 
 	for (b=fn->start; b; b=b->link) {
 		b->idom = 0;
@@ -201,7 +201,7 @@ dom(Blk *b1, Blk *b2)
 static void
 addfron(Blk *a, Blk *b)
 {
-	int n;
+	uint n;
 
 	for (n=0; n<a->nfron; n++)
 		if (a->fron[n] == b)
@@ -245,12 +245,11 @@ loopmark(Blk *hd, Blk *b, void f(Blk *, Blk *))
 void
 loopiter(Fn *fn, void f(Blk *, Blk *))
 {
-	int n;
-	uint p;
+	uint n, p;
 	Blk *b;
 
 	for (b=fn->start; b; b=b->link)
-		b->visit = -1;
+		b->visit = -1u;
 	for (n=0; n<fn->nblk; ++n) {
 		b = fn->rpo[n];
 		for (p=0; p<b->npred; ++p)
diff --git a/fold.c b/fold.c
index 110a23c..c8d490c 100644
--- a/fold.c
+++ b/fold.c
@@ -188,15 +188,15 @@ fold(Fn *fn)
 	Blk *b, **pb;
 	Phi *p, **pp;
 	Ins *i;
-	int n, d;
-	uint a;
+	int t, d;
+	uint n, a;
 
 	val = emalloc(fn->ntmp * sizeof val[0]);
 	edge = emalloc(fn->nblk * sizeof edge[0]);
 	usewrk = vnew(0, sizeof usewrk[0], Pheap);
 
-	for (n=0; n<fn->ntmp; n++)
-		val[n] = Top;
+	for (t=0; t<fn->ntmp; t++)
+		val[t] = Top;
 	for (n=0; n<fn->nblk; n++) {
 		b = fn->rpo[n];
 		b->visit = 0;
@@ -256,14 +256,14 @@ fold(Fn *fn)
 
 	if (debug['F']) {
 		fprintf(stderr, "\n> SCCP findings:");
-		for (n=Tmp0; n<fn->ntmp; n++) {
-			if (val[n] == Bot)
+		for (t=Tmp0; t<fn->ntmp; t++) {
+			if (val[t] == Bot)
 				continue;
-			fprintf(stderr, "\n%10s: ", fn->tmp[n].name);
-			if (val[n] == Top)
+			fprintf(stderr, "\n%10s: ", fn->tmp[t].name);
+			if (val[t] == Top)
 				fprintf(stderr, "Top");
 			else
-				printref(CON(val[n]), fn, stderr);
+				printref(CON(val[t]), fn, stderr);
 		}
 		fprintf(stderr, "\n dead code: ");
 	}
diff --git a/load.c b/load.c
index be6b53d..ca7d492 100644
--- a/load.c
+++ b/load.c
@@ -26,7 +26,7 @@ struct Slice {
 struct Insert {
 	uint isphi:1;
 	uint num:31;
-	int bid;
+	uint bid;
 	uint off;
 	union {
 		Ins ins;
@@ -329,8 +329,8 @@ loadopt(Fn *fn)
 {
 	Ins *i, *ib;
 	Blk *b;
-	int n, sz;
-	uint ni, ext, nt;
+	int sz;
+	uint n, ni, ext, nt;
 	Insert *ist;
 	Slice sl;
 	Loc l;
diff --git a/main.c b/main.c
index fd0b6e4..b60ded6 100644
--- a/main.c
+++ b/main.c
@@ -39,7 +39,7 @@ data(Dat *d)
 static void
 func(Fn *fn)
 {
-	int n;
+	uint n;
 
 	if (dbg)
 		fprintf(stderr, "**** Function %s ****", fn->name);
diff --git a/rega.c b/rega.c
index da4e9e5..fae7538 100644
--- a/rega.c
+++ b/rega.c
@@ -423,12 +423,12 @@ doblk(Blk *b, RMap *cur)
 void
 rega(Fn *fn)
 {
-	int j, t, n, r, r1, x, rl[Tmp0];
+	int j, t, r, r1, x, rl[Tmp0];
 	Blk *b, *b1, *s, ***ps, *blist;
 	RMap *end, *beg, cur, old;
 	Ins *i;
 	Phi *p;
-	uint u;
+	uint u, n;
 	Ref src, dst;
 
 	/* 1. setup */
@@ -455,7 +455,7 @@ rega(Fn *fn)
 		}
 
 	/* 2. assign registers following post-order */
-	for (n=fn->nblk-1; n>=0; n--) {
+	for (n=fn->nblk-1; n!=-1u; n--) {
 		b = fn->rpo[n];
 		cur.n = 0;
 		bszero(cur.b);
diff --git a/ssa.c b/ssa.c
index c0c340c..8a28eeb 100644
--- a/ssa.c
+++ b/ssa.c
@@ -101,7 +101,8 @@ phiins(Fn *fn)
 	Ins *i;
 	Phi *p;
 	Ref r;
-	int t, n, nt;
+	int t, nt;
+	uint n;
 	short k;
 
 	bsinit(u, fn->nblk);