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" ]
60 flags = [ "commutative" ]
65 flags = [ "keep", "uses_memory" ]
67 pinned_init = "op_pin_state_pinned"
68 attr_struct = "asm_attr"
72 name = "input_constraints",
73 type = "ir_asm_constraint*",
76 name = "n_output_constraints",
81 name = "output_constraints",
82 type = "ir_asm_constraint*",
102 flags = [ "cfopcode", "start_block", "dump_noblock" ]
106 attr_struct = "irg_attr"
108 res->attr.irg.irg = irg;
118 flags = [ "labeled" ]
119 attr_struct = "block_attr"
123 /* macroblock header */
126 res->attr.block.is_dead = 0;
127 res->attr.block.is_mb_head = 1;
128 res->attr.block.irg.irg = irg;
129 res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
130 res->attr.block.in_cg = NULL;
131 res->attr.block.cg_backedge = NULL;
132 res->attr.block.extblk = NULL;
133 res->attr.block.mb_depth = 0;
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_cons.add_immBlock_pred(ptr, node.ptr);
151 public void mature() {
152 binding_cons.mature_immBlock(ptr);
156 public Block getBlock() {
160 public boolean blockVisited() {
161 return 0 != binding.Block_block_visited(ptr);
164 public void markBlockVisited() {
165 binding.mark_Block_block_visited(ptr);
168 public boolean isBad() {
169 return binding.is_Bad(ptr) != 0;
174 ins = [ "mem", "index", "lower", "upper" ]
176 ("M", "memory result", "pn_Generic_M"),
177 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
178 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
179 ("res", "the checked index", "pn_Generic_other"),
181 flags = [ "fragile", "highlevel" ]
183 pinned_init = "op_pin_state_pinned"
184 attr_struct = "bound_attr"
191 ("M", "memory result", "pn_Generic_M"),
192 ("1_result", "first result", "pn_Generic_other"),
194 flags = [ "uses_memory" ]
197 type = "ir_builtin_kind",
206 pinned_init = "op_pin_state_pinned"
207 attr_struct = "builtin_attr"
209 assert((get_unknown_type() == type) || is_Method_type(type));
213 ins = [ "mem", "ptr" ]
216 ("M", "memory result", "pn_Generic_M"),
217 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
218 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
219 ("T_result", "tuple containing all results", "pn_Generic_other"),
220 ("P_value_res_base", "pointer to memory register containing copied results passed by value"),
222 flags = [ "fragile", "uses_memory" ]
231 # the tail call attribute can only be set by analysis
235 attr_struct = "call_attr"
237 pinned_init = "op_pin_state_pinned"
239 assert((get_unknown_type() == type) || is_Method_type(type));
243 mode = "get_irn_mode(irn_op)"
244 flags = [ "highlevel" ]
251 attr_struct = "cast_attr"
252 init = "assert(is_atomic_type(type));"
256 ("False", "always false", "0"),
257 ("Eq", "equal", "1"),
259 ("Le", "less or equal", "pn_Cmp_Eq|pn_Cmp_Lt"),
260 ("Gt", "greater", "4"),
261 ("Ge", "greater or equal", "pn_Cmp_Eq|pn_Cmp_Gt"),
262 ("Lg", "less or greater ('not equal' for integer numbers)", "pn_Cmp_Lt|pn_Cmp_Gt"),
263 ("Leg", "less, equal or greater ('not unordered')", "pn_Cmp_Lt|pn_Cmp_Eq|pn_Cmp_Gt"),
264 ("Uo", "unordered", "8"),
265 ("Ue", "unordered or equal", "pn_Cmp_Uo|pn_Cmp_Eq"),
266 ("Ul", "unordered or less", "pn_Cmp_Uo|pn_Cmp_Lt"),
267 ("Ule", "unordered, less or equal", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Eq"),
268 ("Ug", "unordered or greater", "pn_Cmp_Uo|pn_Cmp_Gt"),
269 ("Uge", "onordered, greater or equal", "pn_Cmp_Uo|pn_Cmp_Gt|pn_Cmp_Eq"),
270 ("Ne", "unordered, less or greater ('not equal' for floatingpoint numbers)", "pn_Cmp_Uo|pn_Cmp_Lt|pn_Cmp_Gt"),
271 ("True", "always true", "15"),
278 ("false", "control flow if operand is \"false\""),
279 ("true", "control flow if operand is \"true\""),
281 flags = [ "cfopcode", "forking" ]
285 name = "default_proj",
291 type = "cond_jmp_predicate",
292 init = "COND_JMP_PRED_NONE"
295 attr_struct = "cond_attr"
298 ins = [ "value", "bound" ]
299 mode = "get_irn_mode(irn_value)"
300 flags = [ "highlevel" ]
308 attr_struct = "confirm_attr"
309 attrs_name = "confirm"
313 flags = [ "constlike", "start_block" ]
323 attr_struct = "const_attr"
338 attr_struct = "conv_attr"
342 ins = [ "mem", "dst", "src" ]
344 ("M", "memory result", "pn_Generic_M"),
345 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
346 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
348 flags = [ "fragile", "highlevel", "uses_memory" ]
355 attr_struct = "copyb_attr"
358 pinned_init = "op_pin_state_pinned"
361 ins = [ "mem", "left", "right" ]
363 ("M", "memory result", "pn_Generic_M"),
364 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
365 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
366 ("res", "result of computation", "pn_Generic_other"),
368 flags = [ "fragile", "uses_memory" ]
369 attrs_name = "divmod"
376 name = "no_remainder",
385 attr_struct = "divmod_attr"
388 arity_override = "oparity_binary"
391 ins = [ "mem", "left", "right" ]
393 ("M", "memory result", "pn_Generic_M"),
394 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
395 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
396 ("res_div", "result of computation a/b", "pn_Generic_other"),
397 ("res_mod", "result of computation a%b"),
399 flags = [ "fragile", "uses_memory" ]
400 attrs_name = "divmod"
407 attr_struct = "divmod_attr"
410 arity_override = "oparity_binary"
414 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
417 block = "get_irg_start_block(irg)"
423 flags = [ "cfopcode" ]
427 flags = [ "commutative" ]
430 ins = [ "mem", "ptr", "size" ]
432 flags = [ "uses_memory" ]
441 type = "ir_where_alloc"
444 attr_struct = "free_attr"
455 flags = [ "cfopcode", "forking", "keep" ]
458 ins = [ "store", "obj" ]
460 ("M", "memory result", "pn_Generic_M"),
461 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
462 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
463 ("res", "checked object pointer", "pn_Generic_other"),
465 flags = [ "highlevel" ]
472 attr_struct = "io_attr"
474 pinned_init = "op_pin_state_floats"
480 flags = [ "cfopcode" ]
483 ins = [ "mem", "ptr" ]
485 ("M", "memory result", "pn_Generic_M"),
486 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
487 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
488 ("res", "result of load operation", "pn_Generic_other"),
490 flags = [ "fragile", "uses_memory" ]
492 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
497 java_name = "load_mode"
500 attr_struct = "load_attr"
503 type = "ir_cons_flags",
512 ins = [ "mem", "left", "right" ]
514 ("M", "memory result", "pn_Generic_M"),
515 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
516 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
517 ("res", "result of computation", "pn_Generic_other"),
519 flags = [ "fragile", "uses_memory" ]
520 attrs_name = "divmod"
527 attr_struct = "divmod_attr"
530 arity_override = "oparity_binary"
533 flags = [ "commutative" ]
536 flags = [ "commutative" ]
539 ins = [ "sel", "false", "true" ]
545 flags = [ "dump_noblock", "dump_noinput" ]
554 flags = [ "commutative" ]
560 attr_struct = "phi_attr"
563 /* Memory Phis in endless loops must be kept alive.
564 As we can't distinguish these easily we keep all of them alive. */
565 if (is_Phi(res) && mode == mode_M)
566 add_End_keepalive(get_irg_end(irg), res);
571 mode = "get_irn_mode(irn_op)"
572 flags = [ "highlevel" ]
581 block = "get_nodes_block(irn_pred)"
582 graph = "get_irn_irg(irn_pred)"
594 ins = [ "mem", "left", "right" ]
596 ("M", "memory result", "pn_Generic_M"),
597 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
598 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
599 ("res", "result of computation", "pn_Generic_other"),
601 flags = [ "fragile", "uses_memory" ]
602 attrs_name = "divmod"
609 attr_struct = "divmod_attr"
612 arity_override = "oparity_binary"
615 ins = [ "mem", "exo_ptr" ]
617 ("M", "memory result", "pn_Generic_M"),
618 ("X", "control flow to exception handler", "pn_Generic_X_regular"),
620 flags = [ "highlevel", "cfopcode" ]
627 flags = [ "cfopcode" ]
634 ins = [ "mem", "ptr" ]
637 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
645 attr_struct = "sel_attr"
658 ("X_initial_exec", "control flow"),
659 ("M", "initial memory"),
660 ("P_frame_base", "frame base pointer"),
661 ("P_tls", "pointer to thread local storage segment"),
662 ("T_args", "function arguments")
666 flags = [ "cfopcode" ]
670 ins = [ "mem", "ptr", "value" ]
672 ("M", "memory result", "pn_Generic_M"),
673 ("X_regular", "control flow when no exception occurs", "pn_Generic_X_regular"),
674 ("X_except", "control flow when exception occured", "pn_Generic_X_except"),
676 flags = [ "fragile", "uses_memory" ]
678 attr_struct = "store_attr"
679 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
682 type = "ir_cons_flags",
692 flags = [ "constlike", "start_block" ]
702 attr_struct = "symconst_attr"
716 flags = [ "labeled" ]
722 block = "get_irg_start_block(irg)"
723 flags = [ "cfopcode", "start_block", "constlike", "dump_noblock" ]
727 def getOpList(namespace):
729 for t in namespace.values():
733 if issubclass(t, Op):
738 nodes = getOpList(globals())
739 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))