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 = "bad_attr"
106 res->attr.irg.irg = irg;
123 flags = [ "labeled" ]
124 attr_struct = "block_attr"
128 res->attr.block.is_dead = 0;
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.entity = NULL;
136 set_Block_matured(res, 1);
137 set_Block_block_visited(res, 0);
139 /* Create and initialize array for Phi-node construction. */
140 if (get_irg_phase_state(irg) == phase_building) {
141 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc);
142 memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*));
147 public void addPred(Node node) {
148 binding_ircons.add_immBlock_pred(ptr, node.ptr);
151 public void mature() {
152 binding_ircons.mature_immBlock(ptr);
156 public Block getBlock() {
160 public boolean blockVisited() {
161 return 0 != binding_irnode.Block_block_visited(ptr);
164 public void markBlockVisited() {
165 binding_irnode.mark_Block_block_visited(ptr);
168 public boolean isBad() {
169 return binding_irnode.is_Bad(ptr) != 0;
177 ins = [ "mem", "index", "lower", "upper" ]
179 ("M", "memory result", "pn_Generic_M"),
180 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
181 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
182 ("res", "the checked index", "pn_Generic_other"),
184 flags = [ "fragile", "highlevel" ]
186 pinned_init = "op_pin_state_pinned"
187 attr_struct = "bound_attr"
194 ("M", "memory result", "pn_Generic_M"),
195 ("1_result", "first result", "pn_Generic_other"),
197 flags = [ "uses_memory" ]
200 type = "ir_builtin_kind",
209 pinned_init = "op_pin_state_pinned"
210 attr_struct = "builtin_attr"
212 assert((get_unknown_type() == type) || is_Method_type(type));
216 ins = [ "mem", "ptr" ]
219 ("M", "memory result", "pn_Generic_M"),
220 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
221 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
222 ("T_result", "tuple containing all results", "pn_Generic_other"),
223 ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
225 flags = [ "fragile", "uses_memory" ]
234 # the tail call attribute can only be set by analysis
238 attr_struct = "call_attr"
240 pinned_init = "op_pin_state_pinned"
242 assert((get_unknown_type() == type) || is_Method_type(type));
246 flags = [ "commutative" ]
249 mode = "get_irn_mode(irn_op)"
250 flags = [ "highlevel" ]
257 attr_struct = "cast_attr"
258 init = "assert(is_atomic_type(type));"
262 ("False", "always false", "0"),
263 ("Eq", "equal", "1"),
265 ("Le", "less or equal", "pn_Cmp_Eq|pn_Cmp_Lt"),
266 ("Gt", "greater", "4"),
267 ("Ge", "greater or equal", "pn_Cmp_Eq|pn_Cmp_Gt"),
268 ("Lg", "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
269 ("Leg", "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
270 ("Uo", "unordered", "8"),
271 ("Ue", "unordered or equal", "pn_Cmp_Uo|pn_Cmp_Eq"),
272 ("Ul", "unordered or less", "pn_Cmp_Uo|pn_Cmp_Lt"),
273 ("Ule", "unordered, less or equal", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
274 ("Ug", "unordered or greater", "pn_Cmp_Uo|pn_Cmp_Gt"),
275 ("Uge", "onordered, greater or equal", "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
276 ("Ne", "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
277 ("True", "always true", "15"),
284 ("false", "control flow if operand is \"false\""),
285 ("true", "control flow if operand is \"true\""),
287 flags = [ "cfopcode", "forking" ]
291 name = "default_proj",
297 type = "cond_jmp_predicate",
298 init = "COND_JMP_PRED_NONE"
301 attr_struct = "cond_attr"
304 ins = [ "value", "bound" ]
305 mode = "get_irn_mode(irn_value)"
306 flags = [ "highlevel" ]
314 attr_struct = "confirm_attr"
315 attrs_name = "confirm"
319 flags = [ "constlike", "start_block" ]
329 attr_struct = "const_attr"
344 attr_struct = "conv_attr"
348 ins = [ "mem", "dst", "src" ]
350 ("M", "memory result", "pn_Generic_M"),
351 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
352 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
354 flags = [ "fragile", "highlevel", "uses_memory" ]
361 attr_struct = "copyb_attr"
364 pinned_init = "op_pin_state_pinned"
367 ins = [ "mem", "left", "right" ]
369 ("M", "memory result", "pn_Generic_M"),
370 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
371 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
372 ("res", "result of computation", "pn_Generic_other"),
374 flags = [ "fragile", "uses_memory" ]
375 attrs_name = "divmod"
382 name = "no_remainder",
391 attr_struct = "divmod_attr"
394 arity_override = "oparity_binary"
397 ins = [ "mem", "left", "right" ]
399 ("M", "memory result", "pn_Generic_M"),
400 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
401 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
402 ("res_div", "result of computation a/b", "pn_Generic_other"),
403 ("res_mod", "result of computation a%b"),
405 flags = [ "fragile", "uses_memory" ]
406 attrs_name = "divmod"
413 attr_struct = "divmod_attr"
416 arity_override = "oparity_binary"
420 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
423 block = "get_irg_start_block(irg)"
429 flags = [ "cfopcode" ]
433 flags = [ "commutative" ]
436 ins = [ "mem", "ptr", "size" ]
438 flags = [ "uses_memory" ]
447 type = "ir_where_alloc"
450 attr_struct = "free_attr"
461 flags = [ "cfopcode", "forking", "keep" ]
464 ins = [ "store", "obj" ]
466 ("M", "memory result", "pn_Generic_M"),
467 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
468 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
469 ("res", "checked object pointer", "pn_Generic_other"),
471 flags = [ "highlevel" ]
478 attr_struct = "io_attr"
480 pinned_init = "op_pin_state_floats"
486 flags = [ "cfopcode" ]
489 ins = [ "mem", "ptr" ]
491 ("M", "memory result", "pn_Generic_M"),
492 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
493 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
494 ("res", "result of load operation", "pn_Generic_other"),
496 flags = [ "fragile", "uses_memory" ]
498 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
503 java_name = "load_mode"
506 attr_struct = "load_attr"
509 type = "ir_cons_flags",
518 ins = [ "mem", "left", "right" ]
520 ("M", "memory result", "pn_Generic_M"),
521 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
522 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
523 ("res", "result of computation", "pn_Generic_other"),
525 flags = [ "fragile", "uses_memory" ]
526 attrs_name = "divmod"
533 attr_struct = "divmod_attr"
536 arity_override = "oparity_binary"
539 flags = [ "commutative" ]
542 flags = [ "commutative" ]
545 ins = [ "sel", "false", "true" ]
551 flags = [ "dump_noblock", "dump_noinput" ]
560 flags = [ "commutative" ]
566 attr_struct = "phi_attr"
569 /* Memory Phis in endless loops must be kept alive.
570 As we can't distinguish these easily we keep all of them alive. */
571 if (is_Phi(res) && mode == mode_M)
572 add_End_keepalive(get_irg_end(irg), res);
577 mode = "get_irn_mode(irn_op)"
578 flags = [ "highlevel" ]
587 block = "get_nodes_block(irn_pred)"
588 graph = "get_irn_irg(irn_pred)"
600 ins = [ "mem", "left", "right" ]
602 ("M", "memory result", "pn_Generic_M"),
603 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
604 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
605 ("res", "result of computation", "pn_Generic_other"),
607 flags = [ "fragile", "uses_memory" ]
608 attrs_name = "divmod"
615 attr_struct = "divmod_attr"
618 arity_override = "oparity_binary"
621 ins = [ "mem", "exo_ptr" ]
623 ("M", "memory result", "pn_Generic_M"),
624 ("X", "control flow to exception handler", "pn_Generic_X_regular"),
626 flags = [ "highlevel", "cfopcode" ]
633 flags = [ "cfopcode" ]
640 ins = [ "mem", "ptr" ]
643 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
651 attr_struct = "sel_attr"
664 ("X_initial_exec", "control flow"),
665 ("M", "initial memory"),
666 ("P_frame_base", "frame base pointer"),
667 ("P_tls", "pointer to thread local storage segment"),
668 ("T_args", "function arguments")
672 flags = [ "cfopcode" ]
676 ins = [ "mem", "ptr", "value" ]
678 ("M", "memory result", "pn_Generic_M"),
679 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
680 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
682 flags = [ "fragile", "uses_memory" ]
684 attr_struct = "store_attr"
685 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
688 type = "ir_cons_flags",
698 flags = [ "constlike", "start_block" ]
708 attr_struct = "symconst_attr"
722 flags = [ "labeled" ]
728 block = "get_irg_start_block(irg)"
729 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
733 def getOpList(namespace):
735 for t in namespace.values():
739 if issubclass(t, Op):
744 nodes = getOpList(globals())
745 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))