Define the tree IR
authorSiraaj Khandkar <siraaj@khandkar.net>
Fri, 28 Sep 2018 14:01:32 +0000 (10:01 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Fri, 28 Sep 2018 14:01:32 +0000 (10:01 -0400)
compiler/src/lib/tiger/tiger_tree.ml [new file with mode: 0644]
compiler/src/lib/tiger/tiger_tree.mli [new file with mode: 0644]

diff --git a/compiler/src/lib/tiger/tiger_tree.ml b/compiler/src/lib/tiger/tiger_tree.ml
new file mode 100644 (file)
index 0000000..8b3f5f5
--- /dev/null
@@ -0,0 +1,25 @@
+type exp =
+  | CONST of int
+  | NAME of Tiger_temp.Label.t
+  | TEMP of Tiger_temp.Temp.t
+  | BINOP of binop * exp * exp
+  | MEM of exp
+  | CALL of exp * exp list
+  | ESEQ of stm * exp
+and stm =
+  | MOVE of exp * exp
+  | EXP of exp
+  | JUMP of exp * Tiger_temp.Label.t list
+  (* List is for possible locations that exp can evaluate to, which will be
+   * needed for dataflow analysis, but for now, the common case will be
+   * JUMP(NAME, l, [l]) *)
+  | CJUMP of relop * exp * exp * Tiger_temp.Label.t * Tiger_temp.Label.t
+  | SEQ of stm * stm
+  | LABEL of Tiger_temp.Label.t
+and binop =
+  | PLUS | MINUS | MUL | DIV | AND | OR | LSHIFT | RSHIFT | ARSHIFT | XOR
+and relop =
+  | EQ | NE | LT | GT | LE | GE
+  | ULT | ULE | UGT | UGE
+
+type t = exp
diff --git a/compiler/src/lib/tiger/tiger_tree.mli b/compiler/src/lib/tiger/tiger_tree.mli
new file mode 100644 (file)
index 0000000..8b3f5f5
--- /dev/null
@@ -0,0 +1,25 @@
+type exp =
+  | CONST of int
+  | NAME of Tiger_temp.Label.t
+  | TEMP of Tiger_temp.Temp.t
+  | BINOP of binop * exp * exp
+  | MEM of exp
+  | CALL of exp * exp list
+  | ESEQ of stm * exp
+and stm =
+  | MOVE of exp * exp
+  | EXP of exp
+  | JUMP of exp * Tiger_temp.Label.t list
+  (* List is for possible locations that exp can evaluate to, which will be
+   * needed for dataflow analysis, but for now, the common case will be
+   * JUMP(NAME, l, [l]) *)
+  | CJUMP of relop * exp * exp * Tiger_temp.Label.t * Tiger_temp.Label.t
+  | SEQ of stm * stm
+  | LABEL of Tiger_temp.Label.t
+and binop =
+  | PLUS | MINUS | MUL | DIV | AND | OR | LSHIFT | RSHIFT | ARSHIFT | XOR
+and relop =
+  | EQ | NE | LT | GT | LE | GE
+  | ULT | ULE | UGT | UGE
+
+type t = exp
This page took 0.021064 seconds and 4 git commands to generate.