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"
59 flags = [ "commutative" ]
64 flags = [ "keep", "uses_memory" ]
66 pinned_init = "op_pin_state_pinned"
67 attr_struct = "asm_attr"
71 name = "input_constraints",
72 type = "ir_asm_constraint*",
75 name = "n_output_constraints",
80 name = "output_constraints",
81 type = "ir_asm_constraint*",
100 flags = [ "cfopcode", "start_block", "dump_noblock" ]
103 block = "get_irg_start_block(irg)"
105 attr_struct = "bad_attr"
107 res->attr.bad.irg.irg = irg;
122 flags = [ "labeled" ]
123 attr_struct = "block_attr"
126 res->attr.block.irg.irg = irg;
127 res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
128 set_Block_matured(res, 1);
130 /* Create and initialize array for Phi-node construction. */
131 if (get_irg_phase_state(irg) == phase_building) {
132 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc);
133 memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*));
138 public void addPred(Node node) {
139 binding_ircons.add_immBlock_pred(ptr, node.ptr);
142 public void mature() {
143 binding_ircons.mature_immBlock(ptr);
147 public Block getBlock() {
151 public boolean blockVisited() {
152 return 0 != binding_irnode.Block_block_visited(ptr);
155 public void markBlockVisited() {
156 binding_irnode.mark_Block_block_visited(ptr);
159 public boolean isBad() {
160 return binding_irnode.is_Bad(ptr) != 0;
168 ins = [ "mem", "index", "lower", "upper" ]
170 ("M", "memory result", "pn_Generic_M"),
171 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
172 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
173 ("res", "the checked index", "pn_Generic_other"),
175 flags = [ "fragile", "highlevel" ]
177 pinned_init = "op_pin_state_pinned"
178 attr_struct = "bound_attr"
185 ("M", "memory result", "pn_Generic_M"),
186 ("1_result", "first result", "pn_Generic_other"),
188 flags = [ "uses_memory" ]
191 type = "ir_builtin_kind",
200 pinned_init = "op_pin_state_pinned"
201 attr_struct = "builtin_attr"
203 assert((get_unknown_type() == type) || is_Method_type(type));
207 ins = [ "mem", "ptr" ]
210 ("M", "memory result", "pn_Generic_M"),
211 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
212 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
213 ("T_result", "tuple containing all results", "pn_Generic_other"),
214 ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
216 flags = [ "fragile", "uses_memory" ]
225 # the tail call attribute can only be set by analysis
229 attr_struct = "call_attr"
231 pinned_init = "op_pin_state_pinned"
233 assert((get_unknown_type() == type) || is_Method_type(type));
237 flags = [ "commutative" ]
240 mode = "get_irn_mode(irn_op)"
241 flags = [ "highlevel" ]
248 attr_struct = "cast_attr"
249 init = "assert(is_atomic_type(type));"
253 ("False", "always false", "0"),
254 ("Eq", "equal", "1"),
256 ("Le", "less or equal", "pn_Cmp_Eq|pn_Cmp_Lt"),
257 ("Gt", "greater", "4"),
258 ("Ge", "greater or equal", "pn_Cmp_Eq|pn_Cmp_Gt"),
259 ("Lg", "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
260 ("Leg", "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
261 ("Uo", "unordered", "8"),
262 ("Ue", "unordered or equal", "pn_Cmp_Uo|pn_Cmp_Eq"),
263 ("Ul", "unordered or less", "pn_Cmp_Uo|pn_Cmp_Lt"),
264 ("Ule", "unordered, less or equal", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
265 ("Ug", "unordered or greater", "pn_Cmp_Uo|pn_Cmp_Gt"),
266 ("Uge", "onordered, greater or equal", "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
267 ("Ne", "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
268 ("True", "always true", "15"),
275 ("false", "control flow if operand is \"false\""),
276 ("true", "control flow if operand is \"true\""),
278 flags = [ "cfopcode", "forking" ]
282 name = "default_proj",
288 type = "cond_jmp_predicate",
289 init = "COND_JMP_PRED_NONE"
292 attr_struct = "cond_attr"
295 ins = [ "value", "bound" ]
296 mode = "get_irn_mode(irn_value)"
297 flags = [ "highlevel" ]
305 attr_struct = "confirm_attr"
306 attrs_name = "confirm"
310 flags = [ "constlike", "start_block" ]
320 attr_struct = "const_attr"
335 attr_struct = "conv_attr"
339 ins = [ "mem", "dst", "src" ]
341 ("M", "memory result", "pn_Generic_M"),
342 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
343 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
345 flags = [ "fragile", "highlevel", "uses_memory" ]
352 attr_struct = "copyb_attr"
355 pinned_init = "op_pin_state_pinned"
358 ins = [ "mem", "left", "right" ]
360 ("M", "memory result", "pn_Generic_M"),
361 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
362 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
363 ("res", "result of computation", "pn_Generic_other"),
365 flags = [ "fragile", "uses_memory" ]
366 attrs_name = "divmod"
373 name = "no_remainder",
382 attr_struct = "divmod_attr"
385 arity_override = "oparity_binary"
388 ins = [ "mem", "left", "right" ]
390 ("M", "memory result", "pn_Generic_M"),
391 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
392 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
393 ("res_div", "result of computation a/b", "pn_Generic_other"),
394 ("res_mod", "result of computation a%b"),
396 flags = [ "fragile", "uses_memory" ]
397 attrs_name = "divmod"
404 attr_struct = "divmod_attr"
407 arity_override = "oparity_binary"
411 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
414 block = "get_irg_start_block(irg)"
420 flags = [ "cfopcode" ]
422 block = "get_irg_end_block(irg)"
426 flags = [ "commutative" ]
429 ins = [ "mem", "ptr", "size" ]
431 flags = [ "uses_memory" ]
440 type = "ir_where_alloc"
443 attr_struct = "free_attr"
454 flags = [ "cfopcode", "forking", "keep" ]
457 ins = [ "store", "obj" ]
459 ("M", "memory result", "pn_Generic_M"),
460 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
461 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
462 ("res", "checked object pointer", "pn_Generic_other"),
464 flags = [ "highlevel" ]
471 attr_struct = "io_attr"
473 pinned_init = "op_pin_state_floats"
479 flags = [ "cfopcode" ]
482 ins = [ "mem", "ptr" ]
484 ("M", "memory result", "pn_Generic_M"),
485 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
486 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
487 ("res", "result of load operation", "pn_Generic_other"),
489 flags = [ "fragile", "uses_memory" ]
491 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
496 java_name = "load_mode"
499 attr_struct = "load_attr"
502 type = "ir_cons_flags",
511 ins = [ "mem", "left", "right" ]
513 ("M", "memory result", "pn_Generic_M"),
514 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
515 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
516 ("res", "result of computation", "pn_Generic_other"),
518 flags = [ "fragile", "uses_memory" ]
519 attrs_name = "divmod"
526 attr_struct = "divmod_attr"
529 arity_override = "oparity_binary"
532 flags = [ "commutative" ]
535 flags = [ "commutative" ]
538 ins = [ "sel", "false", "true" ]
544 flags = [ "dump_noblock", "dump_noinput" ]
547 block = "get_irg_start_block(irg)"
554 flags = [ "commutative" ]
560 attr_struct = "phi_attr"
562 /* Memory Phis in endless loops must be kept alive.
563 As we can't distinguish these easily we keep all of them alive. */
564 if (is_Phi(res) && mode == mode_M)
565 add_End_keepalive(get_irg_end(irg), res);
570 mode = "get_irn_mode(irn_op)"
571 flags = [ "highlevel" ]
580 block = "get_nodes_block(irn_pred)"
581 graph = "get_irn_irg(irn_pred)"
593 ins = [ "mem", "left", "right" ]
595 ("M", "memory result", "pn_Generic_M"),
596 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
597 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
598 ("res", "result of computation", "pn_Generic_other"),
600 flags = [ "fragile", "uses_memory" ]
601 attrs_name = "divmod"
608 attr_struct = "divmod_attr"
611 arity_override = "oparity_binary"
614 ins = [ "mem", "exo_ptr" ]
616 ("M", "memory result", "pn_Generic_M"),
617 ("X", "control flow to exception handler", "pn_Generic_X_regular"),
619 flags = [ "highlevel", "cfopcode" ]
626 flags = [ "cfopcode" ]
633 ins = [ "mem", "ptr" ]
636 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
644 attr_struct = "sel_attr"
657 ("X_initial_exec", "control flow"),
658 ("M", "initial memory"),
659 ("P_frame_base", "frame base pointer"),
660 ("P_tls", "pointer to thread local storage segment"),
661 ("T_args", "function arguments")
665 flags = [ "cfopcode" ]
668 block = "get_irg_start_block(irg)"
671 ins = [ "mem", "ptr", "value" ]
673 ("M", "memory result", "pn_Generic_M"),
674 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
675 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
677 flags = [ "fragile", "uses_memory" ]
679 attr_struct = "store_attr"
680 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
683 type = "ir_cons_flags",
693 flags = [ "constlike", "start_block" ]
703 attr_struct = "symconst_attr"
715 flags = [ "labeled" ]
720 block = "get_irg_start_block(irg)"
721 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
725 def getOpList(namespace):
727 for t in namespace.values():
731 if issubclass(t, Op):
736 nodes = getOpList(globals())
737 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))