summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
Diffstat (limited to 'lisc')
-rw-r--r--lisc/emit.c6
-rw-r--r--lisc/isel.c4
-rw-r--r--lisc/lisc.h10
-rw-r--r--lisc/parse.c46
4 files changed, 33 insertions, 33 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 6a485a7..54f552c 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -4,7 +4,7 @@
 static void
 eref(Ref r, Fn *fn, FILE *f)
 {
-	Const *c;
+	Cons *c;
 
 	switch (rtype(r)) {
 	case RSym:
@@ -14,8 +14,8 @@ eref(Ref r, Fn *fn, FILE *f)
 	case RSlot:
 		fprintf(f, "-%d(%%rbp)", 8 * r.val);
 		break;
-	case RConst:
-		c = &fn->cst[r.val];
+	case RCons:
+		c = &fn->cons[r.val];
 		switch (c->type) {
 		case CAddr:
 			fprintf(f, "$%s", c->label);
diff --git a/lisc/isel.c b/lisc/isel.c
index 9d494ce..e2d21ab 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -41,7 +41,7 @@ sel(Ins *i, Fn *fn)
 	}
 		emit(OCopy, i->to, r0, R);
 		emit(OCopy, R, r1, R);
-		if (rtype(i->arg[1]) == RConst) {
+		if (rtype(i->arg[1]) == RCons) {
 			/* immediates not allowed for
 			 * divisions in x86
 			 */
@@ -52,7 +52,7 @@ sel(Ins *i, Fn *fn)
 		emit(OIADiv, R, r0, R);
 		emit(OIACltd, SYM(RDX), R, R);
 		emit(OCopy, SYM(RAX), i->arg[0], R);
-		if (rtype(i->arg[1]) == RConst)
+		if (rtype(i->arg[1]) == RCons)
 			emit(OCopy, r0, i->arg[1], R);
 		break;
 	case OAdd:
diff --git a/lisc/lisc.h b/lisc/lisc.h
index 2f00e09..4d70f31 100644
--- a/lisc/lisc.h
+++ b/lisc/lisc.h
@@ -13,7 +13,7 @@ typedef struct Ins Ins;
 typedef struct Phi Phi;
 typedef struct Blk Blk;
 typedef struct Sym Sym;
-typedef struct Const Const;
+typedef struct Cons Cons;
 typedef struct Fn Fn;
 
 typedef enum { U, F, T } B3;
@@ -66,14 +66,14 @@ struct Ref {
 
 enum {
 	RSym,
-	RConst,
+	RCons,
 	RSlot,
 	NRef = (1<<14) - 1
 };
 
 #define R        (Ref){0, 0}
 #define SYM(x)   (Ref){RSym, x}
-#define CONST(x) (Ref){RConst, x}
+#define CONS(x)  (Ref){RCons, x}
 #define SLOT(x)  (Ref){RSlot, x}
 
 static inline int req(Ref a, Ref b)
@@ -161,7 +161,7 @@ struct Sym {
 	int hint;
 };
 
-struct Const {
+struct Cons {
 	enum {
 		CUndef,
 		CNum,
@@ -174,7 +174,7 @@ struct Const {
 struct Fn {
 	Blk *start;
 	Sym *sym;
-	Const *cst;
+	Cons *cons;
 	int ntmp;
 	int nblk;
 	Blk **rpo;
diff --git a/lisc/parse.c b/lisc/parse.c
index befc418..731b51f 100644
--- a/lisc/parse.c
+++ b/lisc/parse.c
@@ -5,7 +5,7 @@
 
 enum {
 	NSym = 256,
-	NCst = 256,
+	NCons = 256,
 };
 
 Ins insb[NIns], *curi;
@@ -84,9 +84,9 @@ static Sym sym[NSym] = {
 	[R14] = { .type = SReg, .name = "r14" },
 	[R15] = { .type = SReg, .name = "r15" },
 };
-static Const cst[NCst];
+static Cons cons[NCons];
 static int ntmp;
-static int ncst;
+static int ncons;
 static Phi **plink;
 static Blk *bmap[NBlk+1];
 static Blk *curb;
@@ -273,29 +273,29 @@ varref(char *v)
 static Ref
 parseref()
 {
-	Const c;
+	Cons c;
 	int i;
 
 	switch (next()) {
 	case TVar:
 		return varref(tokval.str);
 	case TNum:
-		c = (Const){.type = CNum, .val = tokval.num};
+		c = (Cons){.type = CNum, .val = tokval.num};
 		strcpy(c.label, "");
 	if (0) {
 	case TAddr:
-		c = (Const){.type = CAddr, .val = 0};
+		c = (Cons){.type = CAddr, .val = 0};
 		strcpy(c.label, tokval.str);
 	}
-		for (i=0; i<ncst; i++)
-			if (cst[i].type == c.type
-			&& cst[i].val == c.val
-			&& strcmp(cst[i].label, c.label) == 0)
-				return CONST(i);
-		if (ncst++ >= NCst)
+		for (i=0; i<ncons; i++)
+			if (cons[i].type == c.type
+			&& cons[i].val == c.val
+			&& strcmp(cons[i].label, c.label) == 0)
+				return CONS(i);
+		if (ncons++ >= NCons)
 			err("too many constants");
-		cst[i] = c;
-		return CONST(i);
+		cons[i] = c;
+		return CONS(i);
 	default:
 		return R;
 	}
@@ -498,7 +498,7 @@ parsefn(FILE *f)
 	for (i=Tmp0; i<NSym; i++)
 		sym[i] = (Sym){.type = SUndef};
 	ntmp = Tmp0;
-	ncst = 0;
+	ncons = 0;
 	curi = insb;
 	curb = 0;
 	lnum = 1;
@@ -515,8 +515,8 @@ parsefn(FILE *f)
 		err("last block misses jump");
 	fn->sym = alloc(ntmp * sizeof sym[0]);
 	memcpy(fn->sym, sym, ntmp * sizeof sym[0]);
-	fn->cst = alloc(ncst * sizeof cst[0]);
-	memcpy(fn->cst, cst, ncst * sizeof cst[0]);
+	fn->cons = alloc(ncons * sizeof cons[0]);
+	memcpy(fn->cons, cons, ncons * sizeof cons[0]);
 	fn->ntmp = ntmp;
 	fn->nblk = nblk;
 	fn->rpo = 0;
@@ -540,15 +540,15 @@ printref(Ref r, Fn *fn, FILE *f)
 			break;
 		}
 		break;
-	case RConst:
-		switch (fn->cst[r.val].type) {
+	case RCons:
+		switch (fn->cons[r.val].type) {
 		case CAddr:
-			fprintf(f, "$%s", fn->cst[r.val].label);
-			if (fn->cst[r.val].val)
-				fprintf(f, "%+"PRIi64, fn->cst[r.val].val);
+			fprintf(f, "$%s", fn->cons[r.val].label);
+			if (fn->cons[r.val].val)
+				fprintf(f, "%+"PRIi64, fn->cons[r.val].val);
 			break;
 		case CNum:
-			fprintf(f, "%"PRIi64, fn->cst[r.val].val);
+			fprintf(f, "%"PRIi64, fn->cons[r.val].val);
 			break;
 		case CUndef:
 			diag("printref: invalid constant");