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/branches/SMLNJ/src/MLRISC/mltree/mltree.sig
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/MLRISC/mltree/mltree.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 475 - (view) (download) (as text)

1 : monnier 245 (* mltree.sig
2 :     *
3 :     * COPYRIGHT (c) 1994 AT&T Bell Laboratories.
4 :     *
5 :     *)
6 : monnier 411
7 :     (*
8 :     * Note, this version MLTREE is now typed.
9 :     * Furthermore, it is also used as an RTL language for SSA optimizations.
10 :     *
11 :     * --- Allen
12 :     *)
13 : monnier 245 signature MLTREE = sig
14 :     structure Constant : CONSTANT
15 :     structure PseudoOp : PSEUDO_OPS
16 :     structure Region : REGION
17 : monnier 429 structure Stream : INSTRUCTION_STREAM
18 : monnier 475 structure Basis : MLTREE_BASIS
19 :     structure Util : MLTREE_UTIL
20 : monnier 429 sharing Stream.P = PseudoOp
21 : monnier 475 sharing Util.Basis = Basis
22 : monnier 245
23 : monnier 411 type rextension
24 :     type fextension
25 : monnier 245
26 : monnier 475 type ty = Basis.ty
27 :     type fty = Basis.fty
28 : monnier 411 type var = int (* variable *)
29 :     type src = var (* source variable *)
30 :     type dst = var (* destination variable *)
31 :     type reg = var (* physical register *)
32 : monnier 245
33 : monnier 475 datatype cond = datatype Basis.cond
34 :     datatype fcond = datatype Basis.fcond
35 :     datatype ext = datatype Basis.ext
36 :     datatype rounding_mode = datatype Basis.rounding_mode
37 : monnier 429
38 : monnier 411 (* phi-functions for SSA form *)
39 :     datatype phi =
40 :     PHI of ty * dst * src list
41 :     | FPHI of fty * dst * src list
42 :     | CCPHI of dst * src list
43 : monnier 245
44 : monnier 411 (* aliasing declarations
45 :     * These are used to define physical register bindings for SSA names
46 :     *)
47 : monnier 429 type alias = var * reg (* var is aliased to register *)
48 : monnier 411
49 :     (* statements *)
50 :     datatype stm =
51 :     MV of ty * dst * rexp
52 :     | CCMV of dst * ccexp
53 :     | FMV of fty * dst * fexp
54 :     | COPY of ty * dst list * src list
55 :     | FCOPY of fty * dst list * src list
56 :     | JMP of rexp * Label.label list
57 :     | CALL of rexp * mlrisc list * mlrisc list * Region.region
58 : monnier 245 | RET
59 :    
60 : monnier 411 | STORE of ty * rexp * rexp * Region.region (* address, data *)
61 :     | STORE_UNALIGNED of ty * rexp * rexp * Region.region
62 :     | FSTORE of fty * rexp * fexp * Region.region (* address, data *)
63 :     | FSTORE_UNALIGNED of fty * rexp * fexp * Region.region
64 : monnier 475 | BCC of Basis.cond * ccexp * Label.label
65 :     | FBCC of Basis.fcond * ccexp * Label.label
66 : monnier 411 | ANNOTATION of stm * Annotations.annotation
67 : monnier 245
68 : monnier 411 (* The following are used internally by SSA optimizations;
69 :     * The frontend should not generate these.
70 :     *)
71 :     | RTL of word ref * word * stm (* a RTL that has been cached *)
72 :     | RTLPHI of int (* a phi-function at block id *)
73 :     | RTLPINNED of stm (* pinned statement *)
74 :     | RTLPAR of stm list (* parallel execution *)
75 :    
76 : monnier 245 and rexp =
77 : monnier 411 REG of ty * src
78 :    
79 :     (* sizes of constants are inferred by context *)
80 :     | LI of int
81 : monnier 245 | LI32 of Word32.word
82 : monnier 411 | LI64 of Word64.word
83 : monnier 245 | LABEL of LabelExp.labexp
84 :     | CONST of Constant.const
85 :    
86 : monnier 411 | ADD of ty * rexp * rexp
87 :     | SUB of ty * rexp * rexp
88 : monnier 245
89 : monnier 411 (* signed multiplication etc. *)
90 :     | MULS of ty * rexp * rexp
91 :     | DIVS of ty * rexp * rexp
92 :     | REMS of ty * rexp * rexp
93 : monnier 245
94 : monnier 411 (* unsigned multiplication etc. *)
95 :     | MULU of ty * rexp * rexp
96 :     | DIVU of ty * rexp * rexp
97 :     | REMU of ty * rexp * rexp
98 : monnier 245
99 : monnier 411 (* trapping versions of above. These are all signed *)
100 :     | ADDT of ty * rexp * rexp
101 :     | SUBT of ty * rexp * rexp
102 :     | MULT of ty * rexp * rexp
103 :     | DIVT of ty * rexp * rexp
104 :     | REMT of ty * rexp * rexp
105 : monnier 245
106 : monnier 411 | ANDB of ty * rexp * rexp
107 :     | ORB of ty * rexp * rexp
108 :     | XORB of ty * rexp * rexp
109 :     | NOTB of ty * rexp
110 : monnier 245
111 : monnier 411 | SRA of ty * rexp * rexp (* value, shift *)
112 :     | SRL of ty * rexp * rexp
113 :     | SLL of ty * rexp * rexp
114 : monnier 245
115 : monnier 411 (* type promotion *)
116 : monnier 475 | CVTI2I of ty * Basis.ext * ty * rexp
117 :     | CVTF2I of ty * Basis.rounding_mode * fty * fexp
118 : monnier 411
119 :     (*
120 :     * COND(ty,cc,e1,e2):
121 :     * Evaluate into either e1 or e2, depending on cc.
122 :     * Both e1 and e2 can be evaluated eagerly.
123 :     *)
124 :     | COND of ty * ccexp * rexp * rexp
125 :    
126 :     (* integer load *)
127 :     | LOAD of ty * rexp * Region.region
128 :     | LOAD_UNALIGNED of ty * rexp * Region.region
129 :    
130 : monnier 245 | SEQ of stm * rexp
131 :    
132 : monnier 475 | EXT of ty * rextension * rexp list
133 : monnier 411
134 :     | MARK of rexp * Annotations.annotation
135 :    
136 :     (* Used in RTL *)
137 :     | RTLPC (* the program counter; used for describing relative addressing *)
138 : monnier 475 | RTLMISC of Basis.misc_op ref * rexp list
139 : monnier 411
140 : monnier 245 and fexp =
141 : monnier 411 FREG of fty * src
142 :     | FLOAD of fty * rexp * Region.region
143 :     | FLOAD_UNALIGNED of fty * rexp * Region.region
144 : monnier 245
145 : monnier 411 | FADD of fty * fexp * fexp
146 :     | FMUL of fty * fexp * fexp
147 :     | FSUB of fty * fexp * fexp
148 :     | FDIV of fty * fexp * fexp
149 :     | FABS of fty * fexp
150 :     | FNEG of fty * fexp
151 :     | FSQRT of fty * fexp
152 : monnier 245
153 : monnier 475 | CVTI2F of fty * Basis.ext * ty * rexp
154 :     | CVTF2F of fty * Basis.rounding_mode * fty * fexp
155 : monnier 245 | FSEQ of stm * fexp
156 :    
157 : monnier 475 | FEXT of fty * fextension * fexp list
158 : monnier 411
159 :     | FMARK of fexp * Annotations.annotation
160 :    
161 :     (* used in RTL *)
162 : monnier 475 | RTLFMISC of Basis.misc_op ref * fexp list
163 : monnier 411
164 : monnier 245 and ccexp =
165 : monnier 411 CC of src
166 : monnier 475 | CMP of ty * Basis.cond * rexp * rexp
167 :     | FCMP of fty * Basis.fcond * fexp * fexp
168 : monnier 411 | CCMARK of ccexp * Annotations.annotation
169 : monnier 475 | RTLCCMISC of Basis.misc_op ref * ccexp list
170 : monnier 245
171 :     and mlrisc = CCR of ccexp | GPR of rexp | FPR of fexp
172 :    
173 : monnier 411 exception Unsupported of string * rexp
174 :    
175 : monnier 429 type ('i,'regmap) stream =
176 :     ('i -> unit,'regmap,Annotations.annotations,
177 :     mlrisc list, alias, phi) Stream.stream
178 :    
179 : monnier 245 end (* MLTREE *)
180 :    

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