summary refs log tree commit diff
path: root/lisc/lisc.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-03 13:17:44 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:29 -0400
commit9456200d91840b09cb876146c271c5cbe503d767 (patch)
tree89d1500294b163f05498549babff5a4be60adfc8 /lisc/lisc.h
parent93601b6d0234875cf97e57b7e56fdd5a1803eac0 (diff)
downloadroux-9456200d91840b09cb876146c271c5cbe503d767.tar.gz
use a new Ref type for registers
This might not be a good idea, the problem was that
many spurious registers would be added to the Bits
data-structures during compilation (and would
always remain 0).  However, doing the above
modification de-uniformizes the handling of temps
and regs, this makes the code longer and not
really nicer.  Also, additional Bits structures
are required to track the registers independently.

Overall this might be a bad idea to revert.
Diffstat (limited to 'lisc/lisc.h')
-rw-r--r--lisc/lisc.h49
1 files changed, 34 insertions, 15 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h
index 30feac4..dc60794 100644
--- a/lisc/lisc.h
+++ b/lisc/lisc.h
@@ -12,8 +12,8 @@ typedef struct OpDesc OpDesc;
 typedef struct Ins Ins;
 typedef struct Phi Phi;
 typedef struct Blk Blk;
-typedef struct Sym Sym;
-typedef struct Cons Cons;
+typedef struct Tmp Tmp;
+typedef struct Con Con;
 typedef struct Fn Fn;
 
 typedef enum { U, F, T } B3;
@@ -40,10 +40,28 @@ enum {
 	RBP, /* reserved */
 	RSP,
 
+	EAX, /* 32bits */
+	ECX,
+	EDX,
+	ESI,
+	EDI,
+	R8D,
+	R9D,
+	R10D,
+	R11D,
+
+	EBX,
+	R12D,
+	R13D,
+	R14D,
+	R15D,
+
 	// NReg = R15 - RAX + 1
 	NReg = 3 /* for test purposes */
 };
 
+#define LTW(r) (r + (EAX-RAX))
+
 enum {
 	NString = 32,
 	NPred   = 15,
@@ -68,16 +86,16 @@ struct Ref {
 };
 
 enum {
-	RSym,
-	RCons,
+	RTmp,
+	RCon,
 	RSlot,
 	RReg,
 	NRef = (1<<14) - 1
 };
 
 #define R        (Ref){0, 0}
-#define SYM(x)   (Ref){RSym, x}
-#define CONS(x)  (Ref){RCons, x}
+#define TMP(x)   (Ref){RTmp, x}
+#define CON(x)   (Ref){RCon, x}
 #define SLOT(x)  (Ref){RSlot, x}
 #define REG(x)   (Ref){RReg, x}
 
@@ -153,11 +171,11 @@ struct Blk {
 	char name[NString];
 };
 
-struct Sym {
+struct Tmp {
 	enum {
-		SUndef,
-		SWord,
-		SLong,
+		TUndef,
+		TWord,
+		TLong,
 	} type;
 	char name[NString];
 	uint ndef, nuse;
@@ -166,7 +184,7 @@ struct Sym {
 	int hint;
 };
 
-struct Cons {
+struct Con {
 	enum {
 		CUndef,
 		CNum,
@@ -178,9 +196,10 @@ struct Cons {
 
 struct Fn {
 	Blk *start;
-	Sym *sym;
-	Cons *cons;
-	int nsym;
+	Tmp *tmp;
+	Con *con;
+	int ntmp;
+	int ncon;
 	int nblk;
 	Blk **rpo;
 	uint nspill;
@@ -189,7 +208,7 @@ struct Fn {
 
 /* main.c */
 extern char debug['Z'+1];
-void dumpss(Bits *, Sym *, FILE *);
+void dumpts(Bits *, Tmp *, FILE *);
 
 /* parse.c */
 extern OpDesc opdesc[];