Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/mltree/mltree.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/mltree/mltree.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1381 - (view) (download)

1 : monnier 245 (* mltree.sml
2 :     *
3 :     * COPYRIGHT (c) 1994 AT&T Bell Laboratories.
4 :     *
5 :     *)
6 : leunga 775 functor MLTreeF(structure Constant : CONSTANT
7 : leunga 744 structure Region : REGION
8 : george 555 structure Extension : MLTREE_EXTENSION
9 : monnier 411 ) : MLTREE =
10 : monnier 245 struct
11 : leunga 775 structure Constant = Constant
12 : george 555 structure Region = Region
13 : monnier 475 structure Basis = MLTreeBasis
14 : george 555 structure Extension = Extension
15 : blume 1181 structure I = MachineInt
16 : monnier 245
17 : monnier 475 type ty = Basis.ty
18 :     type fty = Basis.fty
19 : leunga 744 type var = CellsBasis.cell (* variable *)
20 : monnier 411 type src = var (* source variable *)
21 :     type dst = var (* destination variable *)
22 :     type reg = var (* physical register *)
23 : leunga 744 type an = Annotations.annotation
24 : monnier 245
25 : monnier 475 datatype cond = datatype Basis.cond
26 :     datatype fcond = datatype Basis.fcond
27 : george 545 datatype rounding_mode = datatype Basis.rounding_mode
28 : blume 1181 datatype div_rounding_mode = datatype Basis.div_rounding_mode
29 : monnier 475 datatype ext = datatype Basis.ext
30 :    
31 : george 545 (* Statements/effects. These types are parameterized by the statement
32 :     * extension type. Unfortunately, this has to be made polymorphic to make
33 : blume 1181 * it possible for recursive type definitions to work.
34 : george 545 *)
35 : george 555 datatype stm =
36 : george 545 (* assignment *)
37 : blume 1181 MV of ty * dst * rexp
38 : george 555 | CCMV of dst * ccexp
39 : blume 1181 | FMV of fty * dst * fexp
40 : george 545
41 :     (* parallel copies *)
42 : blume 1181 | COPY of ty * dst list * src list
43 : monnier 411 | FCOPY of fty * dst list * src list
44 : monnier 245
45 : george 1003 (* Control flow *)
46 : blume 1181 | JMP of rexp * controlflow
47 : leunga 744 | BCC of ccexp * Label.label
48 : leunga 591 | CALL of {funct:rexp, targets:controlflow,
49 :     defs:mlrisc list, uses:mlrisc list,
50 : blume 839 region: Region.region, pops: Int32.int}
51 : blume 1181 | FLOW_TO of stm * controlflow
52 :     | RET of controlflow
53 :     | IF of ccexp * stm * stm
54 : monnier 245
55 : george 545 (* memory update: ea, data *)
56 : blume 1181 | STORE of ty * rexp * rexp * Region.region
57 :     | FSTORE of fty * rexp * fexp * Region.region
58 : george 545
59 :     (* control dependence *)
60 : george 555 | REGION of stm * ctrl
61 : george 545
62 : george 555 | SEQ of stm list (* sequencing *)
63 : george 545 | DEFINE of Label.label (* define local label *)
64 :    
65 : george 555 | ANNOTATION of stm * an
66 :     | EXT of sext (* extension *)
67 : george 545
68 : george 1003 | LIVE of mlrisc list
69 :     | KILL of mlrisc list
70 :    
71 : george 545 (* RTL operators:
72 : blume 1181 * The following are used internally
73 : leunga 744 * for describing instruction semantics.
74 : george 545 * The frontend must not use these.
75 : monnier 411 *)
76 : leunga 775 | PHI of {preds:int list,block:int}
77 : leunga 744 | ASSIGN of ty * rexp * rexp
78 : blume 1181 | SOURCE
79 :     | SINK
80 : leunga 695 | RTL of {hash:word, attribs:Basis.attribs ref, e:stm}
81 : leunga 744
82 : blume 1181 and rexp =
83 :     REG of ty * reg
84 : monnier 411
85 :     (* sizes of constants are inferred by context *)
86 : blume 1181 | LI of I.machine_int
87 : leunga 775 | LABEL of Label.label
88 : monnier 245 | CONST of Constant.const
89 : leunga 775 | LABEXP of rexp
90 : monnier 245
91 : blume 1181 | NEG of ty * rexp
92 :     | ADD of ty * rexp * rexp
93 :     | SUB of ty * rexp * rexp
94 : monnier 245
95 : monnier 411 (* signed multiplication etc. *)
96 : blume 1181 | MULS of ty * rexp * rexp
97 :     | DIVS of div_rounding_mode * ty * rexp * rexp
98 :     | REMS of div_rounding_mode * ty * rexp * rexp
99 : monnier 245
100 : monnier 411 (* unsigned multiplication etc. *)
101 : blume 1181 | MULU of ty * rexp * rexp
102 :     | DIVU of ty * rexp * rexp
103 :     | REMU of ty * rexp * rexp
104 : monnier 245
105 : blume 1183 (* overflow-trapping versions of above. These are all signed *)
106 : blume 1181 | NEGT of ty * rexp
107 :     | ADDT of ty * rexp * rexp
108 :     | SUBT of ty * rexp * rexp
109 :     | MULT of ty * rexp * rexp
110 :     | DIVT of div_rounding_mode * ty * rexp * rexp
111 : monnier 245
112 : george 545 (* bit operations *)
113 : blume 1181 | ANDB of ty * rexp * rexp
114 :     | ORB of ty * rexp * rexp
115 :     | XORB of ty * rexp * rexp
116 : leunga 744 | EQVB of ty * rexp * rexp
117 : blume 1181 | NOTB of ty * rexp
118 : monnier 245
119 : blume 1181 | SRA of ty * rexp * rexp (* value, shift *)
120 :     | SRL of ty * rexp * rexp
121 :     | SLL of ty * rexp * rexp
122 : monnier 411
123 : george 545 (* type promotion/conversion *)
124 : blume 1181 | SX of ty * ty * rexp (* toTy, fromTy *)
125 : leunga 744 | ZX of ty * ty * rexp (* toTy, fromTy *)
126 : blume 1181 | CVTF2I of ty * rounding_mode * fty * fexp
127 : monnier 411
128 : blume 1181 (*
129 : george 545 * COND(ty,cc,e1,e2):
130 : blume 1181 * Evaluate into either e1 or e2, depending on cc.
131 : george 545 * Both e1 and e2 are allowed to be evaluated eagerly.
132 :     *)
133 : blume 1181 | COND of ty * ccexp * rexp * rexp
134 : monnier 411
135 :     (* integer load *)
136 : blume 1181 | LOAD of ty * rexp * Region.region
137 : monnier 411
138 : george 545 (* predication *)
139 : blume 1181 | PRED of rexp * ctrl
140 : monnier 245
141 : george 555 | LET of stm * rexp
142 : monnier 411
143 : george 555 | REXT of ty * rext
144 : monnier 411
145 : george 555 | MARK of rexp * an
146 : monnier 411
147 : blume 1181 | OP of ty * oper * rexp list
148 :     | ARG of ty * rep ref * string
149 : leunga 744 | $ of ty * CellsBasis.cellkind * rexp
150 : blume 1181 | PARAM of int
151 : leunga 744 | BITSLICE of ty * (int * int) list * rexp
152 : blume 1181 | ???
153 : leunga 744
154 :     and rep = REP of string
155 :    
156 :     and oper = OPER of Basis.misc_op
157 : blume 1181
158 : george 555 and fexp =
159 : monnier 411 FREG of fty * src
160 : blume 1181 | FLOAD of fty * rexp * Region.region
161 : monnier 245
162 : george 555 | FADD of fty * fexp * fexp
163 :     | FMUL of fty * fexp * fexp
164 : blume 1181 | FSUB of fty * fexp * fexp
165 : george 555 | FDIV of fty * fexp * fexp
166 : blume 1181 | FABS of fty * fexp
167 : george 555 | FNEG of fty * fexp
168 :     | FSQRT of fty * fexp
169 : blume 1181 | FCOND of fty * ccexp *
170 : george 555 fexp * fexp
171 :     | FCOPYSIGN of fty * fexp (*sign*) * fexp (*magnitude*)
172 : monnier 245
173 : george 555 | CVTI2F of fty * ty * rexp (* from signed integer *)
174 :     | CVTF2F of fty * fty * fexp (* float to float conversion *)
175 : monnier 245
176 : george 555 | FPRED of fexp * ctrl
177 : blume 1181
178 : george 555 | FEXT of fty * fext
179 : monnier 411
180 : george 555 | FMARK of fexp * an
181 : monnier 411
182 : george 555 and ccexp =
183 : blume 1181 CC of Basis.cond * src
184 :     | FCC of Basis.fcond * src
185 :     | TRUE
186 :     | FALSE
187 :     | NOT of ccexp
188 :     | AND of ccexp * ccexp
189 :     | OR of ccexp * ccexp
190 :     | XOR of ccexp * ccexp
191 :     | EQV of ccexp * ccexp
192 : leunga 744 | CMP of ty * Basis.cond * rexp * rexp
193 : george 555 | FCMP of fty * Basis.fcond * fexp * fexp
194 :     | CCMARK of ccexp * an
195 :     | CCEXT of ty * ccext
196 : monnier 411
197 : blume 1181 and mlrisc =
198 :     CCR of ccexp
199 :     | GPR of rexp
200 :     | FPR of fexp
201 : monnier 245
202 : george 545 withtype controlflow = Label.label list (* control flow info *)
203 : george 555 and ctrl = var (* control dependence info *)
204 :     and ctrls = ctrl list
205 :     and sext = (stm, rexp, fexp, ccexp) Extension.sx
206 :     and rext = (stm, rexp, fexp, ccexp) Extension.rx
207 :     and fext = (stm, rexp, fexp, ccexp) Extension.fx
208 :     and ccext = (stm, rexp, fexp, ccexp) Extension.ccx
209 : leunga 775 and labexp = rexp
210 : monnier 245
211 : george 545 (*
212 : george 555 * Useful type abbreviations for working for MLTree.
213 :     *)
214 :     type rewriter = (* rewriting functions *)
215 :     {stm:stm->stm, rexp:rexp->rexp, fexp:fexp->fexp, ccexp:ccexp->ccexp}
216 :     type 'a folder = (* aggregation functions *)
217 :     {stm:stm*'a->'a, rexp:rexp*'a->'a, fexp:fexp*'a->'a, ccexp:ccexp*'a->'a}
218 :     type hasher = (* hashing functions *)
219 :     {stm:stm->word, rexp:rexp->word, fexp:fexp->word, ccexp:ccexp->word}
220 :     type equality = (* comparison functions *)
221 : blume 1181 {stm:stm * stm->bool, rexp:rexp * rexp->bool,
222 : george 555 fexp:fexp * fexp->bool, ccexp:ccexp * ccexp->bool}
223 :     type printer = (* pretty printing functions *)
224 :     {stm:stm->string, rexp:rexp->string, fexp:fexp->string, ccexp:ccexp->string,
225 :     dstReg : ty * var -> string, srcReg : ty * var -> string}
226 : george 545
227 : monnier 411 end (* MLTREE *)
228 : leunga 624

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0