summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmil Skoeldberg <emil@skoeldberg.net>2018-04-26 18:11:55 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2018-04-26 22:49:36 +0200
commite7a387585992a9378ba2f2319c2408c62a0b14e8 (patch)
treef7d21d2165b8017f3a28a3452a0da716f8e34b87
parent39b1f468b09d94cac6ec65a8c0fbc210e3c9989e (diff)
downloadroux-e7a387585992a9378ba2f2319c2408c62a0b14e8.tar.gz
Fix compiler warnings.
Compiler warned about comparison between signed and unsigned values.
-rw-r--r--amd64/isel.c4
-rw-r--r--amd64/sysv.c2
-rw-r--r--arm64/abi.c2
-rw-r--r--arm64/isel.c2
-rw-r--r--copy.c4
-rw-r--r--fold.c4
-rw-r--r--mem.c2
-rw-r--r--parse.c6
-rw-r--r--rega.c2
-rw-r--r--spill.c2
-rw-r--r--ssa.c12
11 files changed, 21 insertions, 21 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 46ed259..cb409c4 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -458,7 +458,7 @@ anumber(ANum *ai, Blk *b, Con *con)
 	int a, a1, a2, n1, n2, t1, t2;
 	Ins *i;
 
-	for (i=b->ins; i-b->ins < b->nins; i++) {
+	for (i=b->ins; i<&b->ins[b->nins]; i++) {
 		if (rtype(i->to) == RTmp)
 			ai[i->to.val].i = i;
 		if (i->op != Oadd && i->op != Omul)
@@ -574,7 +574,7 @@ amd64_isel(Fn *fn)
 	b = fn->start;
 	/* specific to NAlign == 3 */ /* or change n=4 and sz /= 4 below */
 	for (al=Oalloc, n=4; al<=Oalloc1; al++, n*=2)
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			if (i->op == al) {
 				if (rtype(i->arg[0]) != RCon)
 					break;
diff --git a/amd64/sysv.c b/amd64/sysv.c
index 014452a..d70e70d 100644
--- a/amd64/sysv.c
+++ b/amd64/sysv.c
@@ -642,7 +642,7 @@ amd64_sysv_abi(Fn *fn)
 		b->visit = 0;
 
 	/* lower parameters */
-	for (b=fn->start, i=b->ins; i-b->ins<b->nins; i++)
+	for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++)
 		if (!ispar(i->op))
 			break;
 	fa = selpar(fn, b->ins, i);
diff --git a/arm64/abi.c b/arm64/abi.c
index b340af2..17ea1d1 100644
--- a/arm64/abi.c
+++ b/arm64/abi.c
@@ -645,7 +645,7 @@ arm64_abi(Fn *fn)
 		b->visit = 0;
 
 	/* lower parameters */
-	for (b=fn->start, i=b->ins; i-b->ins<b->nins; i++)
+	for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++)
 		if (!ispar(i->op))
 			break;
 	p = selpar(fn, b->ins, i);
diff --git a/arm64/isel.c b/arm64/isel.c
index 59f1579..031ba11 100644
--- a/arm64/isel.c
+++ b/arm64/isel.c
@@ -232,7 +232,7 @@ arm64_isel(Fn *fn)
 	b = fn->start;
 	/* specific to NAlign == 3 */ /* or change n=4 and sz /= 4 below */
 	for (al=Oalloc, n=4; al<=Oalloc1; al++, n*=2)
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			if (i->op == al) {
 				if (rtype(i->arg[0]) != RCon)
 					break;
diff --git a/copy.c b/copy.c
index 55c31b2..4432986 100644
--- a/copy.c
+++ b/copy.c
@@ -121,7 +121,7 @@ copy(Fn *fn)
 	for (b=fn->start; b; b=b->link) {
 		for (p=b->phi; p; p=p->link)
 			visitphi(p, cp, &pw);
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			visitins(i, cp, &pw, fn);
 	}
 	while ((w1=w)) {
@@ -155,7 +155,7 @@ copy(Fn *fn)
 				subst(&p->arg[a], cp);
 			pp=&p->link;
 		}
-		for (i=b->ins; i-b->ins < b->nins; i++) {
+		for (i=b->ins; i<&b->ins[b->nins]; i++) {
 			r = copyof(i->to, cp);
 			if (!req(r, i->to)) {
 				*i = (Ins){.op = Onop};
diff --git a/fold.c b/fold.c
index c2375df..8fc64c5 100644
--- a/fold.c
+++ b/fold.c
@@ -221,7 +221,7 @@ fold(Fn *fn)
 			for (p=b->phi; p; p=p->link)
 				visitphi(p, n, fn);
 			if (b->visit == 0) {
-				for (i=b->ins; i-b->ins < b->nins; i++)
+				for (i=b->ins; i<&b->ins[b->nins]; i++)
 					visitins(i, fn);
 				visitjmp(b, n, fn);
 			}
@@ -289,7 +289,7 @@ fold(Fn *fn)
 						renref(&p->arg[a]);
 				pp = &p->link;
 			}
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			if (renref(&i->to))
 				*i = (Ins){.op = Onop};
 			else
diff --git a/mem.c b/mem.c
index eda3d18..159b6bc 100644
--- a/mem.c
+++ b/mem.c
@@ -12,7 +12,7 @@ memopt(Fn *fn)
 
 	/* promote uniform stack slots to temporaries */
 	b = fn->start;
-	for (i=b->ins; i-b->ins < b->nins; i++) {
+	for (i=b->ins; i<&b->ins[b->nins]; i++) {
 		if (Oalloc > i->op || i->op > Oalloc1)
 			continue;
 		/* specific to NAlign == 3 */
diff --git a/parse.c b/parse.c
index d9aa1b1..592e079 100644
--- a/parse.c
+++ b/parse.c
@@ -691,7 +691,7 @@ typecheck(Fn *fn)
 	for (b=fn->start; b; b=b->link) {
 		for (p=b->phi; p; p=p->link)
 			fn->tmp[p->to.val].cls = p->cls;
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			if (rtype(i->to) == RTmp) {
 				t = &fn->tmp[i->to.val];
 				if (clsmerge(&t->cls, i->cls))
@@ -719,7 +719,7 @@ typecheck(Fn *fn)
 			if (!bsequal(pb, ppb))
 				err("predecessors not matched in phi %%%s", t->name);
 		}
-		for (i=b->ins; i-b->ins < b->nins; i++)
+		for (i=b->ins; i<&b->ins[b->nins]; i++)
 			for (n=0; n<2; n++) {
 				k = optab[i->op].argcls[n][i->cls];
 				r = i->arg[n];
@@ -1180,7 +1180,7 @@ printfn(Fn *fn, FILE *f)
 					fprintf(f, ", ");
 			}
 		}
-		for (i=b->ins; i-b->ins < b->nins; i++) {
+		for (i=b->ins; i<&b->ins[b->nins]; i++) {
 			fprintf(f, "\t");
 			if (!req(i->to, R)) {
 				printref(i->to, fn, f);
diff --git a/rega.c b/rega.c
index 2f01c07..619b0e2 100644
--- a/rega.c
+++ b/rega.c
@@ -506,7 +506,7 @@ rega(Fn *fn)
 	for (bp=blk, b=fn->start; b; b=b->link)
 		*bp++ = b;
 	qsort(blk, fn->nblk, sizeof blk[0], carve);
-	for (b=fn->start, i=b->ins; i-b->ins < b->nins; i++)
+	for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++)
 		if (i->op != Ocopy || !isreg(i->arg[0]))
 			break;
 		else {
diff --git a/spill.c b/spill.c
index d3a11f7..77496f6 100644
--- a/spill.c
+++ b/spill.c
@@ -77,7 +77,7 @@ fillcost(Fn *fn)
 			}
 		}
 		n = b->loop;
-		for (i=b->ins; i-b->ins < b->nins; i++) {
+		for (i=b->ins; i<&b->ins[b->nins]; i++) {
 			tmpuse(i->to, 0, n, fn);
 			tmpuse(i->arg[0], 1, n, fn);
 			tmpuse(i->arg[1], 1, n, fn);
diff --git a/ssa.c b/ssa.c
index 9aff73c..f7dabb8 100644
--- a/ssa.c
+++ b/ssa.c
@@ -71,7 +71,7 @@ filluse(Fn *fn)
 						tmp[t].phi = tp;
 				}
 		}
-		for (i=b->ins; i-b->ins < b->nins; i++) {
+		for (i=b->ins; i<&b->ins[b->nins]; i++) {
 			if (!req(i->to, R)) {
 				assert(rtype(i->to) == RTmp);
 				w = WFull;
@@ -131,7 +131,7 @@ phiins(Fn *fn)
 		for (b=fn->start; b; b=b->link) {
 			b->visit = 0;
 			r = R;
-			for (i=b->ins; i-b->ins < b->nins; i++) {
+			for (i=b->ins; i<&b->ins[b->nins]; i++) {
 				if (!req(r, R)) {
 					if (req(i->arg[0], TMP(t)))
 						i->arg[0] = r;
@@ -263,7 +263,7 @@ renblk(Blk *b, Name **stk, Fn *fn)
 
 	for (p=b->phi; p; p=p->link)
 		rendef(&p->to, b, stk, fn);
-	for (i=b->ins; i-b->ins < b->nins; i++) {
+	for (i=b->ins; i<&b->ins[b->nins]; i++) {
 		for (m=0; m<2; m++) {
 			t = i->arg[m].val;
 			if (rtype(i->arg[m]) == RTmp)
@@ -374,7 +374,7 @@ ssacheck(Fn *fn)
 		for (p=b->phi; p; p=p->link) {
 			r = p->to;
 			t = &fn->tmp[r.val];
-			for (u=t->use; u-t->use < t->nuse; u++) {
+			for (u=t->use; u<&t->use[t->nuse]; u++) {
 				bu = fn->rpo[u->bid];
 				if (u->type == UPhi) {
 					if (phicheck(u->u.phi, b, r))
@@ -384,12 +384,12 @@ ssacheck(Fn *fn)
 						goto Err;
 			}
 		}
-		for (i=b->ins; i-b->ins < b->nins; i++) {
+		for (i=b->ins; i<&b->ins[b->nins]; i++) {
 			if (rtype(i->to) != RTmp)
 				continue;
 			r = i->to;
 			t = &fn->tmp[r.val];
-			for (u=t->use; u-t->use < t->nuse; u++) {
+			for (u=t->use; u<&t->use[t->nuse]; u++) {
 				bu = fn->rpo[u->bid];
 				if (u->type == UPhi) {
 					if (phicheck(u->u.phi, b, r))