]>
Commit | Line | Data |
---|---|---|
6ade8b0a | 1 | (* L3 Compiler |
12aa4087 JW |
2 | * IR Trees |
3 | * Author: Kaustuv Chaudhuri <kaustuv+@cs.cmu.edu> | |
4 | * Modified: Alex Vaynberg <alv@andrew.cmu.edu> | |
5 | * Modified: Frank Pfenning <fp@cs.cmu.edu> | |
6ade8b0a JW |
6 | * Modified: Joshua Wise <jwise> |
7 | * Modified: Chris Lu <czl> | |
12aa4087 JW |
8 | *) |
9 | ||
10 | signature TREE = | |
11 | sig | |
5c79bb68 | 12 | datatype binop = ADD | SUB | MUL | DIV | MOD | LSH | RSH | LOGOR | LOGAND | BITOR | BITAND | BITXOR | NEQ | EQ | LT | GT | LE | GE | BE |
0a24e44d | 13 | datatype unop = NEG | BITNOT | BANG |
12aa4087 | 14 | |
6ade8b0a JW |
15 | type Blarg = int |
16 | ||
12aa4087 JW |
17 | datatype exp = |
18 | CONST of Word32.word | |
19 | | TEMP of Temp.temp | |
6c5506c5 | 20 | | ARG of Blarg (* I am j4cbo *) |
12aa4087 | 21 | | BINOP of binop * exp * exp |
0a24e44d | 22 | | UNOP of unop * exp |
6c5506c5 JW |
23 | | CALL of Ast.ident * exp list |
24 | | MEMORY of exp | |
1144856b | 25 | | ALLOC of exp |
a83f1d60 | 26 | | STRING of Stringref.stringref |
5c79bb68 JW |
27 | | COND of exp * exp * exp |
28 | | STMVAR of stm list * exp | |
29 | | NULLPTR | |
12aa4087 | 30 | and stm = |
5c79bb68 | 31 | MOVE of exp * exp |
6c5506c5 | 32 | | RETURN of exp |
5c79bb68 | 33 | | EFFECT of exp |
0a24e44d JW |
34 | | LABEL of Label.label |
35 | | JUMPIFN of exp * Label.label | |
36 | | JUMP of Label.label | |
6ade8b0a JW |
37 | and func = |
38 | FUNCTION of Ast.ident * stm list | |
12aa4087 | 39 | |
6ade8b0a | 40 | type program = func list |
12aa4087 JW |
41 | end |
42 | ||
43 | structure Tree :> TREE = | |
44 | struct | |
5c79bb68 | 45 | datatype binop = ADD | SUB | MUL | DIV | MOD | LSH | RSH | LOGOR | LOGAND | BITOR | BITAND | BITXOR | NEQ | EQ | LT | GT | LE | GE | BE |
0a24e44d | 46 | datatype unop = NEG | BITNOT | BANG |
12aa4087 | 47 | |
6ade8b0a JW |
48 | type Blarg = int |
49 | ||
12aa4087 JW |
50 | datatype exp = |
51 | CONST of Word32.word | |
52 | | TEMP of Temp.temp | |
6c5506c5 | 53 | | ARG of Blarg (* I am j4cbo *) |
12aa4087 | 54 | | BINOP of binop * exp * exp |
0a24e44d | 55 | | UNOP of unop * exp |
6c5506c5 JW |
56 | | CALL of Ast.ident * exp list |
57 | | MEMORY of exp | |
1144856b | 58 | | ALLOC of exp |
a83f1d60 | 59 | | STRING of Stringref.stringref |
5c79bb68 JW |
60 | | COND of exp * exp * exp |
61 | | STMVAR of stm list * exp | |
62 | | NULLPTR | |
12aa4087 | 63 | and stm = |
5c79bb68 | 64 | MOVE of exp * exp |
6c5506c5 | 65 | | RETURN of exp |
5c79bb68 | 66 | | EFFECT of exp |
0a24e44d JW |
67 | | LABEL of Label.label |
68 | | JUMPIFN of exp * Label.label | |
69 | | JUMP of Label.label | |
6ade8b0a JW |
70 | and func = |
71 | FUNCTION of Ast.ident * stm list | |
12aa4087 | 72 | |
6ade8b0a | 73 | type program = func list |
12aa4087 | 74 | end |