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" ]
24 flags = ["commutative"]
27 ins = [ "mem", "count" ]
29 ("M", "memory result", "pn_Generic_M"),
30 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
31 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
32 ("res", "pointer to newly allocated memory", "pn_Generic_other"),
34 flags = [ "fragile", "uses_memory" ]
42 type = "ir_where_alloc"
46 attr_struct = "alloc_attr"
51 flags = [ "dump_noblock" ]
53 attr_struct = "irg_attr"
58 flags = [ "commutative" ]
63 flags = [ "keep", "uses_memory" ]
65 pinned_init = "op_pin_state_pinned"
66 attr_struct = "asm_attr"
70 name = "input_constraints",
71 type = "ir_asm_constraint*",
74 name = "n_output_constraints",
79 name = "output_constraints",
80 type = "ir_asm_constraint*",
100 flags = [ "cfopcode", "start_block", "dump_noblock" ]
104 attr_struct = "irg_attr"
106 res->attr.irg.irg = irg;
116 flags = [ "labeled" ]
117 attr_struct = "block_attr"
121 /* macroblock header */
124 res->attr.block.is_dead = 0;
125 res->attr.block.is_mb_head = 1;
126 res->attr.block.irg.irg = irg;
127 res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
128 res->attr.block.in_cg = NULL;
129 res->attr.block.cg_backedge = NULL;
130 res->attr.block.extblk = NULL;
131 res->attr.block.mb_depth = 0;
132 res->attr.block.entity = NULL;
134 set_Block_matured(res, 1);
135 set_Block_block_visited(res, 0);
137 /* Create and initialize array for Phi-node construction. */
138 if (get_irg_phase_state(irg) == phase_building) {
139 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc);
140 memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*));
145 public void addPred(Node node) {
146 binding_cons.add_immBlock_pred(ptr, node.ptr);
149 public void mature() {
150 binding_cons.mature_immBlock(ptr);
154 public Block getBlock() {
158 public boolean blockVisited() {
159 return 0 != binding.Block_block_visited(ptr);
162 public void markBlockVisited() {
163 binding.mark_Block_block_visited(ptr);
166 public boolean isBad() {
167 return binding.is_Bad(ptr) != 0;
175 ins = [ "mem", "index", "lower", "upper" ]
177 ("M", "memory result", "pn_Generic_M"),
178 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
179 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
180 ("res", "the checked index", "pn_Generic_other"),
182 flags = [ "fragile", "highlevel" ]
184 pinned_init = "op_pin_state_pinned"
185 attr_struct = "bound_attr"
192 ("M", "memory result", "pn_Generic_M"),
193 ("1_result", "first result", "pn_Generic_other"),
195 flags = [ "uses_memory" ]
198 type = "ir_builtin_kind",
207 pinned_init = "op_pin_state_pinned"
208 attr_struct = "builtin_attr"
210 assert((get_unknown_type() == type) || is_Method_type(type));
214 ins = [ "mem", "ptr" ]
217 ("M", "memory result", "pn_Generic_M"),
218 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
219 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
220 ("T_result", "tuple containing all results", "pn_Generic_other"),
221 ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
223 flags = [ "fragile", "uses_memory" ]
232 # the tail call attribute can only be set by analysis
236 attr_struct = "call_attr"
238 pinned_init = "op_pin_state_pinned"
240 assert((get_unknown_type() == type) || is_Method_type(type));
244 flags = [ "commutative" ]
247 mode = "get_irn_mode(irn_op)"
248 flags = [ "highlevel" ]
255 attr_struct = "cast_attr"
256 init = "assert(is_atomic_type(type));"
260 ("False", "always false", "0"),
261 ("Eq", "equal", "1"),
263 ("Le", "less or equal", "pn_Cmp_Eq|pn_Cmp_Lt"),
264 ("Gt", "greater", "4"),
265 ("Ge", "greater or equal", "pn_Cmp_Eq|pn_Cmp_Gt"),
266 ("Lg", "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
267 ("Leg", "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
268 ("Uo", "unordered", "8"),
269 ("Ue", "unordered or equal", "pn_Cmp_Uo|pn_Cmp_Eq"),
270 ("Ul", "unordered or less", "pn_Cmp_Uo|pn_Cmp_Lt"),
271 ("Ule", "unordered, less or equal", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
272 ("Ug", "unordered or greater", "pn_Cmp_Uo|pn_Cmp_Gt"),
273 ("Uge", "onordered, greater or equal", "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
274 ("Ne", "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
275 ("True", "always true", "15"),
282 ("false", "control flow if operand is \"false\""),
283 ("true", "control flow if operand is \"true\""),
285 flags = [ "cfopcode", "forking" ]
289 name = "default_proj",
295 type = "cond_jmp_predicate",
296 init = "COND_JMP_PRED_NONE"
299 attr_struct = "cond_attr"
302 ins = [ "value", "bound" ]
303 mode = "get_irn_mode(irn_value)"
304 flags = [ "highlevel" ]
312 attr_struct = "confirm_attr"
313 attrs_name = "confirm"
317 flags = [ "constlike", "start_block" ]
327 attr_struct = "const_attr"
342 attr_struct = "conv_attr"
346 ins = [ "mem", "dst", "src" ]
348 ("M", "memory result", "pn_Generic_M"),
349 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
350 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
352 flags = [ "fragile", "highlevel", "uses_memory" ]
359 attr_struct = "copyb_attr"
362 pinned_init = "op_pin_state_pinned"
365 ins = [ "mem", "left", "right" ]
367 ("M", "memory result", "pn_Generic_M"),
368 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
369 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
370 ("res", "result of computation", "pn_Generic_other"),
372 flags = [ "fragile", "uses_memory" ]
373 attrs_name = "divmod"
380 name = "no_remainder",
389 attr_struct = "divmod_attr"
392 arity_override = "oparity_binary"
395 ins = [ "mem", "left", "right" ]
397 ("M", "memory result", "pn_Generic_M"),
398 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
399 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
400 ("res_div", "result of computation a/b", "pn_Generic_other"),
401 ("res_mod", "result of computation a%b"),
403 flags = [ "fragile", "uses_memory" ]
404 attrs_name = "divmod"
411 attr_struct = "divmod_attr"
414 arity_override = "oparity_binary"
418 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
421 block = "get_irg_start_block(irg)"
427 flags = [ "cfopcode" ]
431 flags = [ "commutative" ]
434 ins = [ "mem", "ptr", "size" ]
436 flags = [ "uses_memory" ]
445 type = "ir_where_alloc"
448 attr_struct = "free_attr"
459 flags = [ "cfopcode", "forking", "keep" ]
462 ins = [ "store", "obj" ]
464 ("M", "memory result", "pn_Generic_M"),
465 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
466 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
467 ("res", "checked object pointer", "pn_Generic_other"),
469 flags = [ "highlevel" ]
476 attr_struct = "io_attr"
478 pinned_init = "op_pin_state_floats"
484 flags = [ "cfopcode" ]
487 ins = [ "mem", "ptr" ]
489 ("M", "memory result", "pn_Generic_M"),
490 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
491 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
492 ("res", "result of load operation", "pn_Generic_other"),
494 flags = [ "fragile", "uses_memory" ]
496 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
501 java_name = "load_mode"
504 attr_struct = "load_attr"
507 type = "ir_cons_flags",
516 ins = [ "mem", "left", "right" ]
518 ("M", "memory result", "pn_Generic_M"),
519 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
520 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
521 ("res", "result of computation", "pn_Generic_other"),
523 flags = [ "fragile", "uses_memory" ]
524 attrs_name = "divmod"
531 attr_struct = "divmod_attr"
534 arity_override = "oparity_binary"
537 flags = [ "commutative" ]
540 flags = [ "commutative" ]
543 ins = [ "sel", "false", "true" ]
549 flags = [ "dump_noblock", "dump_noinput" ]
558 flags = [ "commutative" ]
564 attr_struct = "phi_attr"
567 /* Memory Phis in endless loops must be kept alive.
568 As we can't distinguish these easily we keep all of them alive. */
569 if (is_Phi(res) && mode == mode_M)
570 add_End_keepalive(get_irg_end(irg), res);
575 mode = "get_irn_mode(irn_op)"
576 flags = [ "highlevel" ]
585 block = "get_nodes_block(irn_pred)"
586 graph = "get_irn_irg(irn_pred)"
598 ins = [ "mem", "left", "right" ]
600 ("M", "memory result", "pn_Generic_M"),
601 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
602 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
603 ("res", "result of computation", "pn_Generic_other"),
605 flags = [ "fragile", "uses_memory" ]
606 attrs_name = "divmod"
613 attr_struct = "divmod_attr"
616 arity_override = "oparity_binary"
619 ins = [ "mem", "exo_ptr" ]
621 ("M", "memory result", "pn_Generic_M"),
622 ("X", "control flow to exception handler", "pn_Generic_X_regular"),
624 flags = [ "highlevel", "cfopcode" ]
631 flags = [ "cfopcode" ]
638 ins = [ "mem", "ptr" ]
641 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
649 attr_struct = "sel_attr"
662 ("X_initial_exec", "control flow"),
663 ("M", "initial memory"),
664 ("P_frame_base", "frame base pointer"),
665 ("P_tls", "pointer to thread local storage segment"),
666 ("T_args", "function arguments")
670 flags = [ "cfopcode" ]
674 ins = [ "mem", "ptr", "value" ]
676 ("M", "memory result", "pn_Generic_M"),
677 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
678 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
680 flags = [ "fragile", "uses_memory" ]
682 attr_struct = "store_attr"
683 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
686 type = "ir_cons_flags",
696 flags = [ "constlike", "start_block" ]
706 attr_struct = "symconst_attr"
720 flags = [ "labeled" ]
726 block = "get_irg_start_block(irg)"
727 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
731 def getOpList(namespace):
733 for t in namespace.values():
737 if issubclass(t, Op):
742 nodes = getOpList(globals())
743 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))