summary refs log tree commit diff
path: root/lisc/lisc.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-06-11 08:49:34 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:27 -0400
commitfae1b41e9d6f18b719a99e91a4219896d9c19677 (patch)
treecedea0ecf4b67213cfdb5477cdd2494057266fe6 /lisc/lisc.h
parentfd55a09b7f7454d7232c4645b349b27090ad02c4 (diff)
downloadroux-fae1b41e9d6f18b719a99e91a4219896d9c19677.tar.gz
some new C
Diffstat (limited to 'lisc/lisc.h')
-rw-r--r--lisc/lisc.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h
new file mode 100644
index 0000000..dbe4d63
--- /dev/null
+++ b/lisc/lisc.h
@@ -0,0 +1,62 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+enum {
+	R = -1,        /* Invalid reference. */
+	Temp0 = 32,    /* First temporary, below are machine registers. */
+	MaxPreds = 16, /* Maximum number of predecessors for a block. */
+	MaxBlks = 128,
+	MaxInss = 128,
+	MaxPhis = 128,
+};
+
+typedef int Ref;
+typedef struct Ins Ins;
+typedef struct Phi Phi;
+typedef struct Blk Blk;
+typedef enum Op Op;
+typedef enum Jmp Jmp;
+
+enum Op {
+	ONop,
+	OAdd,
+	OSub,
+	OSDiv,
+	OMod,
+	OParam,
+	OCall,
+
+	/* x86 instructions (reserved) */
+	XDiv,
+};
+
+enum Jmp {
+	JRet,
+	JJmp,
+	JCnd,
+};
+
+struct Ins {
+	Op op;
+	Ref res;
+	Ref arg0, arg1;
+};
+
+struct Phi {
+	Ref res;
+	int na;
+	Ref args[MaxPreds];
+};
+
+struct Blk {
+	int np;
+	int ni;
+	Phi *ps;
+	Ins *is;
+	struct {
+		Jmp ty;
+		Ref arg;
+	} jmp;
+	int suc0, suc1;
+	int dpth;
+};