summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-07-10 16:17:55 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:27 -0400
commite4f07478ce93aacc41e70613b5a6ded99a0799f9 (patch)
tree6254258be710c8362e5245098638c87f838debdc /lisc
parentcec786d53014db0ad69ce0b120eed273f48ddad8 (diff)
downloadroux-e4f07478ce93aacc41e70613b5a6ded99a0799f9.tar.gz
fix naming
Diffstat (limited to 'lisc')
-rw-r--r--lisc/lisc.h13
-rw-r--r--lisc/parse.c32
2 files changed, 23 insertions, 22 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h
index a26dc1e..7978c17 100644
--- a/lisc/lisc.h
+++ b/lisc/lisc.h
@@ -16,7 +16,7 @@ typedef unsigned char uchar;
 enum {
 	R = 0,  /* invalid reference */
 	NRegs = 32,
-	Temp0 = NRegs+1,
+	Tmp0 = NRegs+1,
 	NString = 32,
 	NPreds = 15,
 	NBlks = 128,
@@ -32,7 +32,7 @@ typedef struct Fn Fn;
 typedef ushort Ref;
 
 enum {
-	RTemp = 0,
+	RSym = 0,
 	RConst = 1,
 
 	RMask = 1,
@@ -40,7 +40,7 @@ enum {
 	NRefs = ((ushort)-1)>>RShift,
 };
 
-#define TEMP(x)  (((x)<<RShift) | RTemp)
+#define SYM(x)   (((x)<<RShift) | RSym)
 #define CONST(x) (((x)<<RShift) | RConst)
 
 enum {
@@ -88,17 +88,17 @@ struct Blk {
 	Blk *s2;
 	Blk *link;
 
-	char name[NString];
 	int rpo;
 	Blk **preds;
 	int npreds;
+	char name[NString];
 };
 
 struct Sym {
 	enum {
 		SUndef,
 		SReg,
-		STemp,
+		STmp,
 	} type;
 	char name[NString];
 	Blk *blk;
@@ -108,7 +108,7 @@ struct Sym {
 struct Fn {
 	Blk *start;
 	Sym *sym;
-	int ntemp;
+	int ntmp;
 	int nblk;
 	Blk **rpo;
 };
@@ -121,3 +121,4 @@ Fn *parsefn(FILE *);
 /* ssa.c */
 void fillpreds(Fn *);
 void fillrpo(Fn *);
+void ssafix(Fn *, int);
diff --git a/lisc/parse.c b/lisc/parse.c
index e17c264..ab6c0e5 100644
--- a/lisc/parse.c
+++ b/lisc/parse.c
@@ -6,7 +6,7 @@
 #include "lisc.h"
 
 enum {
-	NTemps = 256,
+	NSyms = 256,
 };
 
 typedef enum {
@@ -44,8 +44,8 @@ typedef enum {
 static FILE *inf;
 static Token thead;
 
-static Sym sym[NTemps];
-static Ref ntemp;
+static Sym sym[NSyms];
+static Ref ntmp;
 static Phi phi[NPhis], *curp;
 static Ins ins[NInss], *curi;
 static struct {
@@ -213,17 +213,17 @@ varref(char *v)
 {
 	int t;
 
-	for (t=Temp0; t<ntemp; t++)
-		if (sym[t].type == STemp)
+	for (t=Tmp0; t<ntmp; t++)
+		if (sym[t].type == STmp)
 		if (strcmp(v, sym[t].name) == 0)
-			return TEMP(t);
-	if (t >= NTemps)
-		err("too many temporaries");
-	sym[t].type = STemp;
+			return SYM(t);
+	if (t >= NSyms)
+		err("too many symbols");
+	sym[t].type = STmp;
 	strcpy(sym[t].name, v);
 	sym[t].blk = 0;
-	ntemp++;
-	return TEMP(t);
+	ntmp++;
+	return SYM(t);
 }
 
 static Ref
@@ -435,12 +435,12 @@ parsefn(FILE *f)
 		bmap[i].name[0] = 0;
 		bmap[i].blk = 0;
 	}
-	for (i=Temp0; i<NTemps; i++) {
+	for (i=Tmp0; i<NSyms; i++) {
 		sym[i].type = SUndef;
 		sym[i].name[0] = 0;
 		sym[i].blk = 0;
 	}
-	ntemp = Temp0;
+	ntmp = Tmp0;
 	curp = phi;
 	curi = ins;
 	curb = 0;
@@ -452,9 +452,9 @@ parsefn(FILE *f)
 	do
 		ps = parseline(ps);
 	while (ps != PEnd);
-	fn->sym = alloc(ntemp * sizeof sym[0]);
-	memcpy(fn->sym, sym, ntemp * sizeof sym[0]);
-	fn->ntemp = ntemp;
+	fn->sym = alloc(ntmp * sizeof sym[0]);
+	memcpy(fn->sym, sym, ntmp * sizeof sym[0]);
+	fn->ntmp = ntmp;
 	fn->nblk = nblk;
 	fn->rpo = 0;
 	return fn;