- walk_const_code now walks all segments, not just global.
[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 Builtin = dict(
105         ins      = [ "mem" ],
106         arity    = "variable",
107         outs     = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ],
108         attrs    = [
109                 dict(
110                         type = "ir_builtin_kind",
111                         name = "kind"
112                 ),
113                 dict(
114                         type = "ir_type*",
115                         name = "type"
116                 )
117         ]
118 ),
119
120 binop = dict(
121         abstract = True,
122         ins      = [ "left", "right" ]
123 ),
124
125 Add = dict(
126         is_a     = "binop"
127 ),
128
129 Carry = dict(
130         is_a     = "binop"
131 ),
132
133 Sub = dict(
134         is_a     = "binop"
135 ),
136
137 Borrow = dict(
138         is_a     = "binop"
139 ),
140
141 Mul = dict(
142         is_a     = "binop"
143 ),
144
145 Mulh = dict(
146         is_a     = "binop"
147 ),
148
149 Abs = dict(
150         is_a     = "unop"
151 ),
152
153 And = dict(
154         is_a     = "binop"
155 ),
156
157 Or = dict(
158         is_a     = "binop"
159 ),
160
161 Eor = dict(
162         is_a     = "binop"
163 ),
164
165 Not = dict(
166         is_a     = "unop"
167 ),
168
169 Shl = dict(
170         is_a     = "binop"
171 ),
172
173 Shr = dict(
174         is_a     = "binop"
175 ),
176
177 Shrs = dict(
178         is_a     = "binop"
179 ),
180
181 Rotl = dict(
182         is_a     = "binop"
183 ),
184
185 Quot = dict(
186         ins   = [ "mem", "dividend", "divisor" ],
187         outs  = [ "M", "X_regular", "X_except", "res" ],
188         attrs = [
189                 dict(
190                         type = "ir_mode*",
191                         name = "resmode"
192                 ),
193                 dict(
194                         name = "state",
195                         type = "op_pin_state"
196                 )
197         ]
198 ),
199
200 Div = dict(
201         ins   = [ "mem", "dividend", "divisor" ],
202         outs  = [ "M", "X_regular", "X_except", "res" ],
203         attrs = [
204                 dict(
205                         type = "ir_mode*",
206                         name = "resmode"
207                 ),
208                 dict(
209                         name = "state",
210                         type = "op_pin_state"
211                 ),
212                 dict(
213                         name = "no_remainder",
214                         type = "int",
215                         init = "0",
216                         special = dict(
217                                 suffix = "RL",
218                                 init = "1"
219                         )
220                 )
221         ]
222 ),
223
224 DivMod = dict(
225         ins   = [ "mem", "dividend", "divisor" ],
226         outs  = [ "M", "X_regular", "X_except", "res_div", "res_mod" ],
227         attrs = [
228                 dict(
229                         type = "ir_mode*",
230                         name = "resmode"
231                 ),
232                 dict(
233                         name = "state",
234                         type = "op_pin_state"
235                 )
236         ]
237 ),
238
239 Mod = dict(
240         ins   = [ "mem", "dividend", "divisor" ],
241         outs  = [ "M", "X_regular", "X_except", "res" ],
242         attrs = [
243                 dict(
244                         type = "ir_mode*",
245                         name = "resmode"
246                 ),
247                 dict(
248                         name = "state",
249                         type = "op_pin_state"
250                 )
251         ]
252 ),
253
254 Load = dict(
255         ins      = [ "mem", "ptr" ],
256         outs     = [ "M", "X_regular", "X_except", "res" ],
257         attrs    = [
258                 dict(
259                         type = "ir_mode*",
260                         name = "mode",
261                         java_name = "load_mode"
262                 ),
263         ],
264         constructor_args = [
265                 dict(
266                         type = "cons_flags",
267                         name = "flags",
268                 ),
269         ],
270 ),
271
272 Store = dict(
273         ins      = [ "mem", "ptr", "value" ],
274         outs     = [ "M", "X_regular", "X_except" ],
275         constructor_args = [
276                 dict(
277                         type = "cons_flags",
278                         name = "flags",
279                 ),
280         ],
281 ),
282
283 Anchor = dict(
284         mode       = "mode_ANY",
285         ins        = [ "end_block", "start_block", "end", "start",
286                        "end_reg", "end_except", "initial_exec",
287                                    "frame", "tls", "initial_mem", "args",
288                                    "bad", "no_mem" ],
289         knownBlock = True,
290         noconstr   = True
291 ),
292
293 NoMem = dict(
294         mode       = "mode_M",
295         knownBlock = True,
296 ),
297
298 Bad = dict(
299         mode       = "mode_Bad",
300         knownBlock = True,
301 ),
302
303 Pin = dict(
304         ins      = [ "op" ],
305         mode     = "get_irn_mode(op);"
306 ),
307
308 Proj = dict(
309         ins      = [ "pred" ],
310         attrs    = [
311                 dict(
312                         type = "long",
313                         name = "proj"
314                 )
315         ]
316 ),
317
318 Sel = dict(
319         ins    = [ "mem", "ptr" ],
320         arity  = "variable",
321         mode   = "mode_P",
322         attrs    = [
323                 dict(
324                         type = "ir_entity*",
325                         name = "entity"
326                 )
327         ]
328 ),
329
330 Sync = dict(
331         mode     = "mode_M",
332         arity    = "dynamic"
333 ),
334
335 Tuple = dict(
336         arity    = "variable",
337         mode     = "mode_T",
338 ),
339
340 Unknown = dict(
341         knownBlock = True
342 ),
343
344 Confirm = dict(
345         ins      = [ "value", "bound" ],
346         mode     = "get_irn_mode(value)",
347         attrs    = [
348                 dict(
349                         name = "cmp",
350                         type = "pn_Cmp"
351                 ),
352         ],
353 ),
354
355 Return = dict(
356         ins      = [ "mem" ],
357         arity    = "variable",
358         mode     = "mode_X"
359 ),
360
361 unop = dict(
362         abstract = True,
363         ins      = [ "op" ]
364 ),
365
366 Minus = dict(
367         is_a     = "unop"
368 ),
369
370 Mux = dict(
371         ins      = [ "sel", "false", "true" ]
372 ),
373
374 Cond = dict(
375         ins      = [ "selector" ],
376         outs     = [ "false", "true" ],
377         attrs    = [
378                 dict(
379                         name = "kind",
380                         type = "cond_kind",
381                         init = "dense"
382                 ),
383                 dict(
384                         name = "default_proj",
385                         type = "long",
386                         init = "0"
387                 ),
388                 dict(
389                         name = "jmp_pred",
390                         type = "cond_jmp_predicate",
391                         init = "COND_JMP_PRED_NONE"
392                 )
393         ]
394 ),
395
396 Cmp = dict(
397         is_a     = "binop",
398         outs     = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ],
399 ),
400
401 Conv = dict(
402         is_a     = "unop",
403         attrs = [
404                 dict(
405                         name = "strict",
406                         type = "int",
407                         init = "0",
408                         special = dict(
409                                 prefix = "strict",
410                                 init = "1"
411                         )
412                 )
413         ]
414 ),
415
416 Alloc = dict(
417         ins   = [ "mem", "size" ],
418         outs  = [ "M", "X_regular", "X_except", "res" ],
419         attrs = [
420                 dict(
421                         name = "type",
422                         type = "ir_type*"
423                 ),
424                 dict(
425                         name = "where",
426                         type = "ir_where_alloc"
427                 )
428         ]
429 ),
430
431 Free = dict(
432         ins   = [ "mem", "ptr", "size" ],
433         mode  = "mode_M",
434         attrs = [
435                 dict(
436                         name = "type",
437                         type = "ir_type*"
438                 ),
439                 dict(
440                         name = "where",
441                         type = "ir_where_alloc"
442                 )
443         ]
444 ),
445
446 CopyB = dict(
447         ins   = [ "mem", "dst", "src" ],
448         outs  = [ "M", "X_regular", "X_except" ],
449         attrs = [
450                 dict(
451                         name = "type",
452                         type = "ir_type*"
453                 )
454         ]
455 ),
456 )