Some minor changes
[libfirm] / scripts / ir_spec.py
1 nodes = dict(
2 Start = dict(
3         mode       = "mode_T",
4         op_flags   = "cfopcode",
5         state      = "pinned",
6         noconstr   = True,
7         optimize   = False
8 ),
9
10 End = dict(
11         mode       = "mode_X",
12         op_flags   = "cfopcode",
13         state      = "pinned",
14         arity      = "dynamic",
15         noconstr   = True,
16         optimize   = False
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_name = "con",
43         attrs      = [
44                 dict(
45                         type = "tarval*",
46                         name = "tarval",
47                 )
48         ],
49 ),
50
51 Block = dict(
52         mode   = "mode_BB",
53         knownBlock = True,
54         noconstr   = True,
55         optimize   = False,
56         arity      = "variable",
57
58         init = '''
59         /* macroblock header */
60         res->in[0] = res;
61
62         res->attr.block.is_dead     = 0;
63         res->attr.block.is_mb_head  = 1;
64         res->attr.block.has_label   = 0;
65         res->attr.block.irg         = irg;
66         res->attr.block.backedge    = new_backedge_arr(irg->obst, arity);
67         res->attr.block.in_cg       = NULL;
68         res->attr.block.cg_backedge = NULL;
69         res->attr.block.extblk      = NULL;
70         res->attr.block.mb_depth    = 0;
71         res->attr.block.label       = 0;
72
73         set_Block_matured(res, 1);
74         set_Block_block_visited(res, 0);
75         ''',
76
77         java_add   = '''
78         public void addPred(Node node) {
79                 binding_cons.add_immBlock_pred(ptr, node.ptr);
80         }
81
82         public void mature() {
83                 binding_cons.mature_immBlock(ptr);
84         }
85
86         @Override
87         public Block getBlock() {
88                 return null;
89         }
90
91         public boolean blockVisited() {
92                 return 0 != binding.Block_block_visited(ptr);
93         }
94
95         public void markBlockVisited() {
96                 binding.mark_Block_block_visited(ptr);
97         }''',
98 ),
99
100 SymConst = dict(
101         mode       = "mode_P",
102         knownBlock = True,
103         noconstr   = True,
104         attrs      = [
105                 dict(
106                         type = "ir_entity*",
107                         name = "entity"
108                 )
109         ],
110 ),
111
112 # SymConst
113
114 Call = dict(
115         ins      = [ "mem", "ptr" ],
116         arity    = "variable",
117         outs     = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ],
118         attrs    = [
119                 dict(
120                         type = "ir_type*",
121                         name = "type"
122                 )
123         ]
124 ),
125
126 Builtin = dict(
127         ins      = [ "mem" ],
128         arity    = "variable",
129         outs     = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ],
130         attrs    = [
131                 dict(
132                         type = "ir_builtin_kind",
133                         name = "kind"
134                 ),
135                 dict(
136                         type = "ir_type*",
137                         name = "type"
138                 )
139         ]
140 ),
141
142 binop = dict(
143         abstract = True,
144         ins      = [ "left", "right" ]
145 ),
146
147 Add = dict(
148         is_a     = "binop"
149 ),
150
151 Carry = dict(
152         is_a     = "binop"
153 ),
154
155 Sub = dict(
156         is_a     = "binop"
157 ),
158
159 Borrow = dict(
160         is_a     = "binop"
161 ),
162
163 Mul = dict(
164         is_a     = "binop"
165 ),
166
167 Mulh = dict(
168         is_a     = "binop"
169 ),
170
171 Abs = dict(
172         is_a     = "unop"
173 ),
174
175 And = dict(
176         is_a     = "binop"
177 ),
178
179 Or = dict(
180         is_a     = "binop"
181 ),
182
183 Eor = dict(
184         is_a     = "binop"
185 ),
186
187 Not = dict(
188         is_a     = "unop"
189 ),
190
191 Shl = dict(
192         is_a     = "binop"
193 ),
194
195 Shr = dict(
196         is_a     = "binop"
197 ),
198
199 Shrs = dict(
200         is_a     = "binop"
201 ),
202
203 Rotl = dict(
204         is_a     = "binop"
205 ),
206
207 Quot = dict(
208         ins   = [ "mem", "dividend", "divisor" ],
209         outs  = [ "M", "X_regular", "X_except", "res" ],
210         attrs = [
211                 dict(
212                         type = "ir_mode*",
213                         name = "resmode"
214                 ),
215                 dict(
216                         name = "state",
217                         type = "op_pin_state"
218                 )
219         ]
220 ),
221
222 Div = dict(
223         ins   = [ "mem", "dividend", "divisor" ],
224         outs  = [ "M", "X_regular", "X_except", "res" ],
225         attrs = [
226                 dict(
227                         type = "ir_mode*",
228                         name = "resmode"
229                 ),
230                 dict(
231                         name = "state",
232                         type = "op_pin_state"
233                 ),
234                 dict(
235                         name = "no_remainder",
236                         type = "int",
237                         init = "0",
238                         special = dict(
239                                 suffix = "RL",
240                                 init = "1"
241                         )
242                 )
243         ]
244 ),
245
246 DivMod = dict(
247         ins   = [ "mem", "dividend", "divisor" ],
248         outs  = [ "M", "X_regular", "X_except", "res_div", "res_mod" ],
249         attrs = [
250                 dict(
251                         type = "ir_mode*",
252                         name = "resmode"
253                 ),
254                 dict(
255                         name = "state",
256                         type = "op_pin_state"
257                 )
258         ]
259 ),
260
261 Mod = dict(
262         ins   = [ "mem", "dividend", "divisor" ],
263         outs  = [ "M", "X_regular", "X_except", "res" ],
264         attrs = [
265                 dict(
266                         type = "ir_mode*",
267                         name = "resmode"
268                 ),
269                 dict(
270                         name = "state",
271                         type = "op_pin_state"
272                 )
273         ]
274 ),
275
276 Load = dict(
277         ins      = [ "mem", "ptr" ],
278         outs     = [ "M", "X_regular", "X_except", "res" ],
279         attrs    = [
280                 dict(
281                         type = "ir_mode*",
282                         name = "mode",
283                         java_name = "load_mode"
284                 ),
285         ],
286         constructor_args = [
287                 dict(
288                         type = "ir_cons_flags",
289                         name = "flags",
290                 ),
291         ],
292 ),
293
294 Store = dict(
295         ins      = [ "mem", "ptr", "value" ],
296         outs     = [ "M", "X_regular", "X_except" ],
297         constructor_args = [
298                 dict(
299                         type = "ir_cons_flags",
300                         name = "flags",
301                 ),
302         ],
303 ),
304
305 Anchor = dict(
306         mode       = "mode_ANY",
307         ins        = [ "end_block", "start_block", "end", "start",
308                        "end_reg", "end_except", "initial_exec",
309                                    "frame", "tls", "initial_mem", "args",
310                                    "bad", "no_mem" ],
311         knownBlock = True,
312         noconstr   = True
313 ),
314
315 NoMem = dict(
316         mode       = "mode_M",
317         knownBlock = True,
318 ),
319
320 Bad = dict(
321         mode       = "mode_Bad",
322         knownBlock = True,
323 ),
324
325 Pin = dict(
326         ins      = [ "op" ],
327         mode     = "get_irn_mode(op);"
328 ),
329
330 Proj = dict(
331         ins      = [ "pred" ],
332         attrs    = [
333                 dict(
334                         type = "long",
335                         name = "proj"
336                 )
337         ]
338 ),
339
340 Sel = dict(
341         ins    = [ "mem", "ptr" ],
342         arity  = "variable",
343         mode   = "mode_P",
344         attrs    = [
345                 dict(
346                         type = "ir_entity*",
347                         name = "entity"
348                 )
349         ]
350 ),
351
352 Sync = dict(
353         mode     = "mode_M",
354         optimize = False,
355         arity    = "dynamic"
356 ),
357
358 Tuple = dict(
359         arity    = "variable",
360         mode     = "mode_T",
361 ),
362
363 Unknown = dict(
364         knownBlock = True
365 ),
366
367 Confirm = dict(
368         ins      = [ "value", "bound" ],
369         mode     = "get_irn_mode(value)",
370         attrs    = [
371                 dict(
372                         name = "cmp",
373                         type = "pn_Cmp"
374                 ),
375         ],
376 ),
377
378 Return = dict(
379         ins      = [ "mem" ],
380         arity    = "variable",
381         mode     = "mode_X"
382 ),
383
384 unop = dict(
385         abstract = True,
386         ins      = [ "op" ]
387 ),
388
389 Minus = dict(
390         is_a     = "unop"
391 ),
392
393 Mux = dict(
394         ins      = [ "sel", "false", "true" ]
395 ),
396
397 Cond = dict(
398         ins      = [ "selector" ],
399         outs     = [ "false", "true" ],
400         attrs    = [
401                 dict(
402                         name = "kind",
403                         type = "cond_kind",
404                         init = "dense"
405                 ),
406                 dict(
407                         name = "default_proj",
408                         type = "long",
409                         init = "0"
410                 ),
411                 dict(
412                         name = "jmp_pred",
413                         type = "cond_jmp_predicate",
414                         init = "COND_JMP_PRED_NONE"
415                 )
416         ]
417 ),
418
419 Cmp = dict(
420         is_a     = "binop",
421         outs     = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ],
422 ),
423
424 Conv = dict(
425         is_a     = "unop",
426         attrs = [
427                 dict(
428                         name = "strict",
429                         type = "int",
430                         init = "0",
431                         special = dict(
432                                 prefix = "strict",
433                                 init = "1"
434                         )
435                 )
436         ]
437 ),
438
439 Alloc = dict(
440         ins   = [ "mem", "size" ],
441         outs  = [ "M", "X_regular", "X_except", "res" ],
442         attrs = [
443                 dict(
444                         name = "type",
445                         type = "ir_type*"
446                 ),
447                 dict(
448                         name = "where",
449                         type = "ir_where_alloc"
450                 )
451         ]
452 ),
453
454 Free = dict(
455         ins   = [ "mem", "ptr", "size" ],
456         mode  = "mode_M",
457         attrs = [
458                 dict(
459                         name = "type",
460                         type = "ir_type*"
461                 ),
462                 dict(
463                         name = "where",
464                         type = "ir_where_alloc"
465                 )
466         ]
467 ),
468
469 CopyB = dict(
470         ins   = [ "mem", "dst", "src" ],
471         outs  = [ "M", "X_regular", "X_except" ],
472         attrs = [
473                 dict(
474                         name = "type",
475                         type = "ir_type*"
476                 )
477         ]
478 ),
479 )