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

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