summary refs log tree commit diff
path: root/lisc/lisc.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-13 16:10:54 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:31 -0400
commit5fc8104e00187335411e35ec951bef53562c8fcd (patch)
treeb4f26312a5eef7062c3aa8501a6a8f6efe77a675 /lisc/lisc.h
parent78bf28f56e7dcdd89efba5c69bd90ed858658162 (diff)
downloadroux-5fc8104e00187335411e35ec951bef53562c8fcd.tar.gz
major lifting: get rid of RReg
I've been septic since I introduced it, this commit
proves that it costs more than it helps.  I've also fixed
a bad bug in rega() where I alloc'ed the wrong size for
internal arrays.  Enums now have names so I can use them
to cast in gdb to get the name corresponding to a constant.
Diffstat (limited to 'lisc/lisc.h')
-rw-r--r--lisc/lisc.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h
index abf9c1f..3ae5c56 100644
--- a/lisc/lisc.h
+++ b/lisc/lisc.h
@@ -18,7 +18,7 @@ typedef struct Fn Fn;
 
 typedef enum { U, F, T } B3;
 
-enum {
+enum Reg {
 	RXX,
 
 	RAX, /* caller-save */
@@ -56,8 +56,9 @@ enum {
 	R14D,
 	R15D,
 
-	// NReg = R15 - RAX + 1
-	NReg = 3 /* for test purposes */
+	Tmp0, /* first non-reg temporary */
+
+	NReg = RDX - RAX + 1
 };
 
 #define RWORD(r) (r + (EAX-RAX))
@@ -90,7 +91,6 @@ enum {
 	RTmp,
 	RCon,
 	RSlot,
-	RReg,
 	NRef = (1<<14) - 1
 };
 
@@ -99,14 +99,13 @@ enum {
 #define CON(x)   (Ref){RCon, x}
 #define CON_Z    CON(0)          /* reserved zero constant */
 #define SLOT(x)  (Ref){RSlot, x}
-#define REG(x)   (Ref){RReg, x}
 
 static inline int req(Ref a, Ref b)
 { return a.type == b.type && a.val == b.val; }
 static inline int rtype(Ref r)
 { return req(r, R) ? -1 : r.type; }
 
-enum {
+enum Cmp {
 	Ceq,
 	Csle,
 	Cslt,
@@ -118,7 +117,7 @@ enum {
 
 #define COP(c) (c==Ceq||c==Cne ? c : NCmp-1 - c)
 
-enum {
+enum Op {
 	OXXX,
 
 	/* public instructions */
@@ -154,7 +153,7 @@ enum {
 	NOp
 };
 
-enum {
+enum Jmp {
 	JXXX,
 	JRet,
 	JJmp,
@@ -211,6 +210,7 @@ struct Tmp {
 		TUndef,
 		TWord,
 		TLong,
+		TReg,
 	} type;
 	char name[NString];
 	uint ndef, nuse;