Browse Source

reorder instructions

Quentin Carbonneaux 9 years ago
parent
commit
74562a93de
3 changed files with 19 additions and 24 deletions
  1. 16 16
      all.h
  2. 2 2
      mem.c
  3. 1 6
      spill.c

+ 16 - 16
all.h

@@ -232,28 +232,28 @@ enum Op {
 	OCmpd,
 	OCmpd,
 	OCmpd1 = OCmpd + NFCmp-1,
 	OCmpd1 = OCmpd + NFCmp-1,
 
 
-	OStored,
-	OStores,
-	OStorel,
-	OStorew,
-	OStoreh,
 	OStoreb,
 	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,
 	OLoadsh,
 	OLoaduh,
 	OLoaduh,
-	OLoadsb,
-	OLoadub,
+	OLoadsw,
+	OLoaduw,
 	OLoad,
 	OLoad,
-#define isload(o) (OLoadsw <= o && o <= OLoad)
-	OExtsw,
-	OExtuw,
-	OExtsh,
-	OExtuh,
+#define isload(o) (OLoadsb <= o && o <= OLoad)
 	OExtsb,
 	OExtsb,
 	OExtub,
 	OExtub,
-#define isext(o) (OExtsw <= o && o <= OExtub)
+	OExtsh,
+	OExtuh,
+	OExtsw,
+	OExtuw,
+#define isext(o) (OExtsw <= o && o <= OExtuw)
 
 
 	OExts,
 	OExts,
 	OTruncd,
 	OTruncd,

+ 2 - 2
mem.c

@@ -67,8 +67,8 @@ memopt(Fn *fn)
 					break;
 					break;
 				default:
 				default:
 					/* keep l->cls */
 					/* keep l->cls */
-					a = l->op - OLoadsw;
-					l->op = OExtsw + a;
+					a = l->op - OLoadsb;
+					l->op = OExtsb + a;
 					break;
 					break;
 				}
 				}
 		}
 		}

+ 1 - 6
spill.c

@@ -240,13 +240,8 @@ reloads(BSet *u, BSet *v)
 static void
 static void
 store(Ref r, int s)
 store(Ref r, int s)
 {
 {
-	static int kstore[] = {
-		[Kw] = OStorew, [Kl] = OStorel,
-		[Ks] = OStores, [Kd] = OStored,
-	};
-
 	if (s != -1)
 	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
 static int