1 from spec_util import abstract, setnodedefaults
4 "Base class for firm nodes"
8 "Unary nodes have exactly 1 input"
16 "Binary nodes have exactly 2 inputs"
18 ins = [ "left", "right" ]
27 flags = ["commutative"]
30 ins = [ "mem", "count" ]
32 ("M", "memory result", "pn_Generic_M"),
33 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
34 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
35 ("res", "pointer to newly allocated memory", "pn_Generic_other"),
37 flags = [ "fragile", "uses_memory" ]
45 type = "ir_where_alloc"
49 attr_struct = "alloc_attr"
54 flags = [ "dump_noblock" ]
56 attr_struct = "irg_attr"
61 flags = [ "commutative" ]
66 flags = [ "keep", "uses_memory" ]
68 pinned_init = "op_pin_state_pinned"
69 attr_struct = "asm_attr"
73 name = "input_constraints",
74 type = "ir_asm_constraint*",
77 name = "n_output_constraints",
82 name = "output_constraints",
83 type = "ir_asm_constraint*",
103 flags = [ "cfopcode", "start_block", "dump_noblock" ]
107 attr_struct = "irg_attr"
109 res->attr.irg.irg = irg;
119 flags = [ "labeled" ]
120 attr_struct = "block_attr"
124 /* macroblock header */
127 res->attr.block.is_dead = 0;
128 res->attr.block.is_mb_head = 1;
129 res->attr.block.irg.irg = irg;
130 res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
131 res->attr.block.in_cg = NULL;
132 res->attr.block.cg_backedge = NULL;
133 res->attr.block.extblk = NULL;
134 res->attr.block.mb_depth = 0;
135 res->attr.block.entity = NULL;
137 set_Block_matured(res, 1);
138 set_Block_block_visited(res, 0);
140 /* Create and initialize array for Phi-node construction. */
141 if (get_irg_phase_state(irg) == phase_building) {
142 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc);
143 memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*));
148 public void addPred(Node node) {
149 binding_cons.add_immBlock_pred(ptr, node.ptr);
152 public void mature() {
153 binding_cons.mature_immBlock(ptr);
157 public Block getBlock() {
161 public boolean blockVisited() {
162 return 0 != binding.Block_block_visited(ptr);
165 public void markBlockVisited() {
166 binding.mark_Block_block_visited(ptr);
169 public boolean isBad() {
170 return binding.is_Bad(ptr) != 0;
178 ins = [ "mem", "index", "lower", "upper" ]
180 ("M", "memory result", "pn_Generic_M"),
181 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
182 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
183 ("res", "the checked index", "pn_Generic_other"),
185 flags = [ "fragile", "highlevel" ]
187 pinned_init = "op_pin_state_pinned"
188 attr_struct = "bound_attr"
195 ("M", "memory result", "pn_Generic_M"),
196 ("1_result", "first result", "pn_Generic_other"),
198 flags = [ "uses_memory" ]
201 type = "ir_builtin_kind",
210 pinned_init = "op_pin_state_pinned"
211 attr_struct = "builtin_attr"
213 assert((get_unknown_type() == type) || is_Method_type(type));
217 ins = [ "mem", "ptr" ]
220 ("M", "memory result", "pn_Generic_M"),
221 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
222 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
223 ("T_result", "tuple containing all results", "pn_Generic_other"),
224 ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
226 flags = [ "fragile", "uses_memory" ]
235 # the tail call attribute can only be set by analysis
239 attr_struct = "call_attr"
241 pinned_init = "op_pin_state_pinned"
243 assert((get_unknown_type() == type) || is_Method_type(type));
247 flags = [ "commutative" ]
250 mode = "get_irn_mode(irn_op)"
251 flags = [ "highlevel" ]
258 attr_struct = "cast_attr"
259 init = "assert(is_atomic_type(type));"
263 ("False", "always false", "0"),
264 ("Eq", "equal", "1"),
266 ("Le", "less or equal", "pn_Cmp_Eq|pn_Cmp_Lt"),
267 ("Gt", "greater", "4"),
268 ("Ge", "greater or equal", "pn_Cmp_Eq|pn_Cmp_Gt"),
269 ("Lg", "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
270 ("Leg", "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
271 ("Uo", "unordered", "8"),
272 ("Ue", "unordered or equal", "pn_Cmp_Uo|pn_Cmp_Eq"),
273 ("Ul", "unordered or less", "pn_Cmp_Uo|pn_Cmp_Lt"),
274 ("Ule", "unordered, less or equal", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
275 ("Ug", "unordered or greater", "pn_Cmp_Uo|pn_Cmp_Gt"),
276 ("Uge", "onordered, greater or equal", "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
277 ("Ne", "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
278 ("True", "always true", "15"),
285 ("false", "control flow if operand is \"false\""),
286 ("true", "control flow if operand is \"true\""),
288 flags = [ "cfopcode", "forking" ]
292 name = "default_proj",
298 type = "cond_jmp_predicate",
299 init = "COND_JMP_PRED_NONE"
302 attr_struct = "cond_attr"
305 ins = [ "value", "bound" ]
306 mode = "get_irn_mode(irn_value)"
307 flags = [ "highlevel" ]
315 attr_struct = "confirm_attr"
316 attrs_name = "confirm"
320 flags = [ "constlike", "start_block" ]
330 attr_struct = "const_attr"
345 attr_struct = "conv_attr"
349 ins = [ "mem", "dst", "src" ]
351 ("M", "memory result", "pn_Generic_M"),
352 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
353 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
355 flags = [ "fragile", "highlevel", "uses_memory" ]
362 attr_struct = "copyb_attr"
365 pinned_init = "op_pin_state_pinned"
368 ins = [ "mem", "left", "right" ]
370 ("M", "memory result", "pn_Generic_M"),
371 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
372 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
373 ("res", "result of computation", "pn_Generic_other"),
375 flags = [ "fragile", "uses_memory" ]
376 attrs_name = "divmod"
383 name = "no_remainder",
392 attr_struct = "divmod_attr"
395 arity_override = "oparity_binary"
398 ins = [ "mem", "left", "right" ]
400 ("M", "memory result", "pn_Generic_M"),
401 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
402 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
403 ("res_div", "result of computation a/b", "pn_Generic_other"),
404 ("res_mod", "result of computation a%b"),
406 flags = [ "fragile", "uses_memory" ]
407 attrs_name = "divmod"
414 attr_struct = "divmod_attr"
417 arity_override = "oparity_binary"
421 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
424 block = "get_irg_start_block(irg)"
430 flags = [ "cfopcode" ]
434 flags = [ "commutative" ]
437 ins = [ "mem", "ptr", "size" ]
439 flags = [ "uses_memory" ]
448 type = "ir_where_alloc"
451 attr_struct = "free_attr"
462 flags = [ "cfopcode", "forking", "keep" ]
465 ins = [ "store", "obj" ]
467 ("M", "memory result", "pn_Generic_M"),
468 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
469 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
470 ("res", "checked object pointer", "pn_Generic_other"),
472 flags = [ "highlevel" ]
479 attr_struct = "io_attr"
481 pinned_init = "op_pin_state_floats"
487 flags = [ "cfopcode" ]
490 ins = [ "mem", "ptr" ]
492 ("M", "memory result", "pn_Generic_M"),
493 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
494 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
495 ("res", "result of load operation", "pn_Generic_other"),
497 flags = [ "fragile", "uses_memory" ]
499 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
504 java_name = "load_mode"
507 attr_struct = "load_attr"
510 type = "ir_cons_flags",
519 ins = [ "mem", "left", "right" ]
521 ("M", "memory result", "pn_Generic_M"),
522 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
523 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
524 ("res", "result of computation", "pn_Generic_other"),
526 flags = [ "fragile", "uses_memory" ]
527 attrs_name = "divmod"
534 attr_struct = "divmod_attr"
537 arity_override = "oparity_binary"
540 flags = [ "commutative" ]
543 flags = [ "commutative" ]
546 ins = [ "sel", "false", "true" ]
552 flags = [ "dump_noblock", "dump_noinput" ]
561 flags = [ "commutative" ]
567 attr_struct = "phi_attr"
570 /* Memory Phis in endless loops must be kept alive.
571 As we can't distinguish these easily we keep all of them alive. */
572 if (is_Phi(res) && mode == mode_M)
573 add_End_keepalive(get_irg_end(irg), res);
578 mode = "get_irn_mode(irn_op)"
579 flags = [ "highlevel" ]
588 block = "get_nodes_block(irn_pred)"
589 graph = "get_irn_irg(irn_pred)"
601 ins = [ "mem", "left", "right" ]
603 ("M", "memory result", "pn_Generic_M"),
604 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
605 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
606 ("res", "result of computation", "pn_Generic_other"),
608 flags = [ "fragile", "uses_memory" ]
609 attrs_name = "divmod"
616 attr_struct = "divmod_attr"
619 arity_override = "oparity_binary"
622 ins = [ "mem", "exo_ptr" ]
624 ("M", "memory result", "pn_Generic_M"),
625 ("X", "control flow to exception handler", "pn_Generic_X_regular"),
627 flags = [ "highlevel", "cfopcode" ]
634 flags = [ "cfopcode" ]
641 ins = [ "mem", "ptr" ]
644 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
652 attr_struct = "sel_attr"
665 ("X_initial_exec", "control flow"),
666 ("M", "initial memory"),
667 ("P_frame_base", "frame base pointer"),
668 ("P_tls", "pointer to thread local storage segment"),
669 ("T_args", "function arguments")
673 flags = [ "cfopcode" ]
677 ins = [ "mem", "ptr", "value" ]
679 ("M", "memory result", "pn_Generic_M"),
680 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
681 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
683 flags = [ "fragile", "uses_memory" ]
685 attr_struct = "store_attr"
686 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
689 type = "ir_cons_flags",
699 flags = [ "constlike", "start_block" ]
709 attr_struct = "symconst_attr"
723 flags = [ "labeled" ]
729 block = "get_irg_start_block(irg)"
730 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
734 def getOpList(namespace):
736 for t in namespace.values():
740 if issubclass(t, Op):
745 nodes = getOpList(globals())
746 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))