summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--all.h14
-rw-r--r--live.c2
-rw-r--r--load.c2
3 files changed, 10 insertions, 8 deletions
diff --git a/all.h b/all.h
index 24a1755..e125f3a 100644
--- a/all.h
+++ b/all.h
@@ -171,12 +171,14 @@ enum {
 	Jjf1 = Jjffuo,
 };
 
-#define isstore(o) (Ostoreb <= o && o <= Ostored)
-#define isload(o) (Oloadsb <= o && o <= Oload)
-#define isext(o) (Oextsb <= o && o <= Oextuw)
-#define ispar(o) (Opar <= o && o <= Opare)
-#define isarg(o) (Oarg <= o && o <= Oarge)
-#define isret(j) (Jret0 <= j && j <= Jretc)
+#define INRANGE(x, l, u) ((unsigned)(x) - l <= u - l) /* linear in x */
+#define iscall(o) INRANGE(o, Ocall, Ovacall)
+#define isstore(o) INRANGE(o, Ostoreb, Ostored)
+#define isload(o) INRANGE(o, Oloadsb, Oload)
+#define isext(o) INRANGE(o, Oextsb, Oextuw)
+#define ispar(o) INRANGE(o, Opar, Opare)
+#define isarg(o) INRANGE(o, Oarg, Oarge)
+#define isret(j) INRANGE(j, Jret0, Jretc)
 
 enum Class {
 	Kx = -1, /* "top" class (see usecheck() and clsmerge()) */
diff --git a/live.c b/live.c
index 4198995..c22e063 100644
--- a/live.c
+++ b/live.c
@@ -82,7 +82,7 @@ Again:
 		for (k=0; k<2; k++)
 			b->nlive[k] = nlv[k];
 		for (i=&b->ins[b->nins]; i!=b->ins;) {
-			if ((--i)->op == Ocall && rtype(i->arg[1]) == RCall) {
+			if (iscall((--i)->op) && rtype(i->arg[1]) == RCall) {
 				b->in->t[0] &= ~T.retregs(i->arg[1], m);
 				for (k=0; k<2; k++) {
 					nlv[k] -= m[k];
diff --git a/load.c b/load.c
index 8e1328e..c8471f6 100644
--- a/load.c
+++ b/load.c
@@ -231,7 +231,7 @@ def(Slice sl, bits msk, Blk *b, Ins *i, Loc *il)
 	while (i > b->ins) {
 		--i;
 		if (killsl(i->to, sl)
-		|| ((i->op == Ocall || i->op == Ovacall) && escapes(sl.ref, curf)))
+		|| (iscall(i->op) && escapes(sl.ref, curf)))
 			goto Load;
 		ld = isload(i->op);
 		if (ld) {