]>
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 | |
5c79bb68 | 20 | | ARG of Blarg * Temp.size (* I am j4cbo *) |
12aa4087 | 21 | | BINOP of binop * exp * exp |
0a24e44d | 22 | | UNOP of unop * exp |
5c79bb68 JW |
23 | | CALL of Ast.ident * (exp * Temp.size) list * Temp.size |
24 | | MEMORY of exp * Temp.size | |
1144856b | 25 | | ALLOC of exp |
5c79bb68 JW |
26 | | COND of exp * exp * exp |
27 | | STMVAR of stm list * exp | |
28 | | NULLPTR | |
12aa4087 | 29 | and stm = |
5c79bb68 JW |
30 | MOVE of exp * exp |
31 | | RETURN of exp * Temp.size | |
32 | | EFFECT of exp | |
0a24e44d JW |
33 | | LABEL of Label.label |
34 | | JUMPIFN of exp * Label.label | |
35 | | JUMP of Label.label | |
6ade8b0a JW |
36 | and func = |
37 | FUNCTION of Ast.ident * stm list | |
12aa4087 | 38 | |
6ade8b0a | 39 | type program = func list |
12aa4087 JW |
40 | end |
41 | ||
42 | structure Tree :> TREE = | |
43 | struct | |
5c79bb68 | 44 | datatype binop = ADD | SUB | MUL | DIV | MOD | LSH | RSH | LOGOR | LOGAND | BITOR | BITAND | BITXOR | NEQ | EQ | LT | GT | LE | GE | BE |
0a24e44d | 45 | datatype unop = NEG | BITNOT | BANG |
12aa4087 | 46 | |
6ade8b0a JW |
47 | type Blarg = int |
48 | ||
12aa4087 JW |
49 | datatype exp = |
50 | CONST of Word32.word | |
51 | | TEMP of Temp.temp | |
5c79bb68 | 52 | | ARG of Blarg * Temp.size (* I am j4cbo *) |
12aa4087 | 53 | | BINOP of binop * exp * exp |
0a24e44d | 54 | | UNOP of unop * exp |
5c79bb68 JW |
55 | | CALL of Ast.ident * (exp * Temp.size) list * Temp.size |
56 | | MEMORY of exp * Temp.size | |
1144856b | 57 | | ALLOC of exp |
5c79bb68 JW |
58 | | COND of exp * exp * exp |
59 | | STMVAR of stm list * exp | |
60 | | NULLPTR | |
12aa4087 | 61 | and stm = |
5c79bb68 JW |
62 | MOVE of exp * exp |
63 | | RETURN of exp * Temp.size | |
64 | | EFFECT of exp | |
0a24e44d JW |
65 | | LABEL of Label.label |
66 | | JUMPIFN of exp * Label.label | |
67 | | JUMP of Label.label | |
6ade8b0a JW |
68 | and func = |
69 | FUNCTION of Ast.ident * stm list | |
12aa4087 | 70 | |
6ade8b0a | 71 | type program = func list |
12aa4087 | 72 | end |