irio: Fixed ir_cons_flags import for Load and Store. Added support for Div and DivMod
[libfirm] / scripts / ir_spec.py
1 nodes = dict(
2 Start = dict(
3         mode       = "mode_T",
4         op_flags   = "cfopcode",
5         state      = "pinned",
6         knownBlock = True,
7         noconstr   = True,
8 ),
9
10 End = dict(
11         mode       = "mode_X",
12         op_flags   = "cfopcode",
13         state      = "pinned",
14         arity      = "dynamic",
15         knownBlock = True,
16         noconstr   = True,
17 ),
18
19 Phi = dict(
20         noconstr = True,
21         state    = "pinned",
22         arity    = "variable",
23 ),
24
25 Jmp = dict(
26         mode     = "mode_X",
27         op_flags = "cfopcode",
28         state    = "pinned",
29         ins      = [],
30 ),
31
32 IJmp = dict(
33         mode     = "mode_X",
34         op_flags = "cfopcode",
35         state    = "pinned",
36         ins      = [ "target" ],
37 ),
38
39 Const = dict(
40         mode       = "",
41         knownBlock = True,
42         attrs      = [
43                 dict(
44                         type = "tarval*",
45                         name = "tarval",
46                 )
47         ],
48 ),
49
50 Block = dict(
51         mode   = "mode_BB",
52         knownBlock = True,
53         noconstr   = True,
54         arity      = "variable",
55         java_add   = '''
56         public void addPred(Node node) {
57                 binding_cons.add_immBlock_pred(ptr, node.ptr);
58         }
59
60         public void mature() {
61                 binding_cons.mature_immBlock(ptr);
62         }
63
64         @Override
65         public Block getBlock() {
66                 return null;
67         }
68
69         public boolean blockVisited() {
70                 return 0 != binding.Block_block_visited(ptr);
71         }
72
73         public void markBlockVisited() {
74                 binding.mark_Block_block_visited(ptr);
75         }''',
76 ),
77
78 SymConst = dict(
79         mode       = "mode_P",
80         knownBlock = True,
81         noconstr   = True,
82         attrs      = [
83                 dict(
84                         type = "ir_entity*",
85                         name = "entity"
86                 )
87         ],
88 ),
89
90 # SymConst
91
92 Call = dict(
93         ins      = [ "mem", "ptr" ],
94         arity    = "variable",
95         outs     = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ],
96         attrs    = [
97                 dict(
98                         type = "ir_type*",
99                         name = "type"
100                 )
101         ]
102 ),
103
104 binop = dict(
105         abstract = True,
106         ins      = [ "left", "right" ]
107 ),
108
109 Add = dict(
110         is_a     = "binop"
111 ),
112
113 Carry = dict(
114         is_a     = "binop"
115 ),
116
117 Sub = dict(
118         is_a     = "binop"
119 ),
120
121 Borrow = dict(
122         is_a     = "binop"
123 ),
124
125 Mul = dict(
126         is_a     = "binop"
127 ),
128
129 Mulh = dict(
130         is_a     = "binop"
131 ),
132
133 Abs = dict(
134         is_a     = "unop"
135 ),
136
137 And = dict(
138         is_a     = "binop"
139 ),
140
141 Or = dict(
142         is_a     = "binop"
143 ),
144
145 Eor = dict(
146         is_a     = "binop"
147 ),
148
149 Not = dict(
150         is_a     = "unop"
151 ),
152
153 Shl = dict(
154         is_a     = "binop"
155 ),
156
157 Shr = dict(
158         is_a     = "binop"
159 ),
160
161 Shrs = dict(
162         is_a     = "binop"
163 ),
164
165 Rotl = dict(
166         is_a     = "binop"
167 ),
168
169 Div = dict(
170         ins   = [ "mem", "dividend", "divisor" ],
171         outs  = [ "M", "X_regular", "X_except", "res" ],
172         attrs = [
173                 dict(
174                         type = "ir_mode*",
175                         name = "resmode"
176                 ),
177                 dict(
178                         name = "state",
179                         type = "op_pin_state"
180                 )
181         ]
182 ),
183
184 DivMod = dict(
185         ins   = [ "mem", "dividend", "divisor" ],
186         outs  = [ "M", "X_regular", "X_except", "res_div", "res_mod" ],
187         attrs = [
188                 dict(
189                         type = "ir_mode*",
190                         name = "resmode"
191                 ),
192                 dict(
193                         name = "state",
194                         type = "op_pin_state"
195                 )
196         ]
197 ),
198
199 Load = dict(
200         ins      = [ "mem", "ptr" ],
201         outs     = [ "M", "X_regular", "X_except", "res" ],
202         attrs    = [
203                 dict(
204                         type = "ir_mode*",
205                         name = "mode",
206                         java_name = "load_mode"
207                 ),
208         ],
209         constructor_args = [
210                 dict(
211                         type = "cons_flags",
212                         name = "flags",
213                 ),
214         ],
215 ),
216
217 Store = dict(
218         ins      = [ "mem", "ptr", "value" ],
219         outs     = [ "M", "X_regular", "X_except" ],
220         constructor_args = [
221                 dict(
222                         type = "cons_flags",
223                         name = "flags",
224                 ),
225         ],
226 ),
227
228 Anchor = dict(
229         mode       = "mode_ANY",
230         ins        = [ "end_block", "start_block", "end", "start",
231                        "end_reg", "end_except", "initial_exec",
232                                    "frame", "tls", "initial_mem", "args",
233                                    "bad", "no_mem" ],
234         knownBlock = True,
235         noconstr   = True
236 ),
237
238 NoMem = dict(
239         mode       = "mode_M",
240         knownBlock = True,
241 ),
242
243 Bad = dict(
244         mode       = "mode_Bad",
245         knownBlock = True,
246 ),
247
248 Pin = dict(
249         ins      = [ "op" ],
250         mode     = "get_irn_mode(op);"
251 ),
252
253 Proj = dict(
254         ins      = [ "pred" ],
255         attrs    = [
256                 dict(
257                         type = "long",
258                         name = "proj"
259                 )
260         ]
261 ),
262
263 Sel = dict(
264         ins    = [ "mem", "ptr" ],
265         arity  = "variable",
266         mode   = "mode_P",
267         attrs    = [
268                 dict(
269                         type = "ir_entity*",
270                         name = "entity"
271                 )
272         ]
273 ),
274
275 Sync = dict(
276         mode     = "mode_M",
277         arity    = "dynamic"
278 ),
279
280 Tuple = dict(
281         arity    = "variable",
282         mode     = "mode_T",
283 ),
284
285 Unknown = dict(
286         knownBlock = True
287 ),
288
289 Confirm = dict(
290         ins      = [ "value", "bound" ],
291         block    = "get_nodes_block(value)",
292         mode     = "get_irn_mode(value)",
293         attrs    = [
294                 dict(
295                         name = "cmp",
296                         type = "pn_Cmp"
297                 ),
298         ],
299 ),
300
301 Return = dict(
302         ins      = [ "mem" ],
303         arity    = "variable",
304         mode     = "mode_X"
305 ),
306
307 unop = dict(
308         abstract = True,
309         ins      = [ "op" ]
310 ),
311
312 Minus = dict(
313         is_a     = "unop"
314 ),
315
316 Mux = dict(
317         ins      = [ "sel", "false", "true" ]
318 ),
319
320 Cond = dict(
321         ins      = [ "selector" ],
322         outs     = [ "false", "true" ],
323 ),
324
325 Cmp = dict(
326         is_a     = "binop",
327         outs     = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ],
328 ),
329
330 Conv = dict(
331         is_a     = "unop"
332 ),
333
334 Alloc = dict(
335         ins   = [ "mem", "size" ],
336         outs  = [ "M", "X_regular", "X_except", "res" ],
337         attrs = [
338                 dict(
339                         name = "type",
340                         type = "ir_type*"
341                 ),
342                 dict(
343                         name = "where",
344                         type = "ir_where_alloc"
345                 )
346         ]
347 ),
348
349 Free = dict(
350         ins   = [ "mem", "ptr", "size" ],
351         mode  = "mode_M",
352         attrs = [
353                 dict(
354                         name = "type",
355                         type = "ir_type*"
356                 ),
357                 dict(
358                         name = "where",
359                         type = "ir_where_alloc"
360                 )
361         ]
362 ),
363 )