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