summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-04 14:45:49 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-04 14:45:49 -0400
commit74562a93debff6954f16a4c3434efa69d37c954b (patch)
tree245c03672bc2c895eff933de2262d111c2a18ebb
parentf71206500c6693eed4393d72e8ab95d6a7e07d98 (diff)
downloadroux-74562a93debff6954f16a4c3434efa69d37c954b.tar.gz
reorder instructions
-rw-r--r--all.h32
-rw-r--r--mem.c4
-rw-r--r--spill.c7
3 files changed, 19 insertions, 24 deletions
diff --git a/all.h b/all.h
index cecc754..a983108 100644
--- a/all.h
+++ b/all.h
@@ -232,28 +232,28 @@ enum Op {
 	OCmpd,
 	OCmpd1 = OCmpd + NFCmp-1,
 
-	OStored,
-	OStores,
-	OStorel,
-	OStorew,
-	OStoreh,
 	OStoreb,
-#define isstore(o) (OStored <= o && o <= OStoreb)
-	OLoadsw,  /* needs to match OExt (mem.c) */
-	OLoaduw,
+	OStoreh,
+	OStorew,
+	OStorel,
+	OStores,
+	OStored,
+#define isstore(o) (OStoreb <= o && o <= OStored)
+	OLoadsb,  /* needs to match OExt (mem.c) */
+	OLoadub,
 	OLoadsh,
 	OLoaduh,
-	OLoadsb,
-	OLoadub,
+	OLoadsw,
+	OLoaduw,
 	OLoad,
-#define isload(o) (OLoadsw <= o && o <= OLoad)
-	OExtsw,
-	OExtuw,
-	OExtsh,
-	OExtuh,
+#define isload(o) (OLoadsb <= o && o <= OLoad)
 	OExtsb,
 	OExtub,
-#define isext(o) (OExtsw <= o && o <= OExtub)
+	OExtsh,
+	OExtuh,
+	OExtsw,
+	OExtuw,
+#define isext(o) (OExtsw <= o && o <= OExtuw)
 
 	OExts,
 	OTruncd,
diff --git a/mem.c b/mem.c
index 98556e1..521fa96 100644
--- a/mem.c
+++ b/mem.c
@@ -67,8 +67,8 @@ memopt(Fn *fn)
 					break;
 				default:
 					/* keep l->cls */
-					a = l->op - OLoadsw;
-					l->op = OExtsw + a;
+					a = l->op - OLoadsb;
+					l->op = OExtsb + a;
 					break;
 				}
 		}
diff --git a/spill.c b/spill.c
index bda7532..dad18d2 100644
--- a/spill.c
+++ b/spill.c
@@ -240,13 +240,8 @@ reloads(BSet *u, BSet *v)
 static void
 store(Ref r, int s)
 {
-	static int kstore[] = {
-		[Kw] = OStorew, [Kl] = OStorel,
-		[Ks] = OStores, [Kd] = OStored,
-	};
-
 	if (s != -1)
-		emit(kstore[tmp[r.val].cls], 0, R, r, SLOT(s));
+		emit(OStorew + tmp[r.val].cls, 0, R, r, SLOT(s));
 }
 
 static int