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" ]
31 outs = [ "M", "X_regular", "X_except", "res" ]
32 flags = [ "fragile", "uses_memory" ]
40 type = "ir_where_alloc"
44 attr_struct = "alloc_attr"
46 firm_alloc_frag_arr(res, op_Alloc, &res->attr.alloc.exc.frag_arr);
52 flags = [ "dump_noblock" ]
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", "fragile", "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" ]
176 outs = [ "M", "X_regular", "X_except", "res" ]
177 flags = [ "fragile", "highlevel" ]
179 pinned_init = "op_pin_state_pinned"
180 attr_struct = "bound_attr"
183 firm_alloc_frag_arr(res, op_Bound, &res->attr.bound.exc.frag_arr);
189 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
190 flags = [ "uses_memory" ]
193 type = "ir_builtin_kind",
202 pinned_init = "op_pin_state_pinned"
203 attr_struct = "builtin_attr"
205 assert((get_unknown_type() == type) || is_Method_type(type));
209 ins = [ "mem", "ptr" ]
211 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
212 flags = [ "fragile", "uses_memory" ]
221 # the tail call attribute can only be set by analysis
225 attr_struct = "call_attr"
227 pinned_init = "op_pin_state_pinned"
229 assert((get_unknown_type() == type) || is_Method_type(type));
232 firm_alloc_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr);
236 flags = [ "commutative" ]
239 mode = "get_irn_mode(irn_op)"
240 flags = [ "highlevel" ]
247 attr_struct = "cast_attr"
248 init = "assert(is_atomic_type(type));"
252 ("False", "always false"),
255 ("Le", "less or equal"),
257 ("Ge", "greater or equal"),
258 ("Lg", "less or greater"),
259 ("Leg", "less, equal or greater ('not equal' for integer numbers)"),
261 ("Ue", "unordered or equal"),
262 ("Ul", "unordered or less"),
263 ("Ule", "unordered, less or equal"),
264 ("Ug", "unordered or greater"),
265 ("Uge", "onordered, greater or equal"),
266 ("Ne", "unordered, less, greater or equal ('not equal' for floatingpoint numbers)"),
267 ("True", "always true"),
273 outs = [ "false", "true" ]
274 flags = [ "cfopcode", "forking" ]
278 name = "default_proj",
284 type = "cond_jmp_predicate",
285 init = "COND_JMP_PRED_NONE"
288 attr_struct = "cond_attr"
291 ins = [ "value", "bound" ]
292 mode = "get_irn_mode(irn_value)"
293 flags = [ "highlevel" ]
301 attr_struct = "confirm_attr"
302 attrs_name = "confirm"
306 flags = [ "constlike", "start_block" ]
316 attr_struct = "const_attr"
331 attr_struct = "conv_attr"
335 ins = [ "mem", "dst", "src" ]
336 outs = [ "M", "X_regular", "X_except" ]
337 flags = [ "fragile", "highlevel", "uses_memory" ]
344 attr_struct = "copyb_attr"
347 pinned_init = "op_pin_state_pinned"
349 firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr);
353 ins = [ "mem", "left", "right" ]
354 outs = [ "M", "X_regular", "X_except", "res" ]
355 flags = [ "fragile", "uses_memory" ]
356 attrs_name = "divmod"
363 name = "no_remainder",
372 attr_struct = "divmod_attr"
375 arity_override = "oparity_binary"
377 firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
381 ins = [ "mem", "left", "right" ]
382 outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ]
383 flags = [ "fragile", "uses_memory" ]
384 attrs_name = "divmod"
391 attr_struct = "divmod_attr"
394 arity_override = "oparity_binary"
396 firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
401 flags = [ "cfopcode", "fragile", "start_block", "constlike",
405 block = "get_irg_start_block(irg)"
411 flags = [ "cfopcode" ]
415 flags = [ "commutative" ]
418 ins = [ "mem", "ptr", "size" ]
420 flags = [ "uses_memory" ]
429 type = "ir_where_alloc"
432 attr_struct = "free_attr"
443 flags = [ "cfopcode", "forking", "keep" ]
446 ins = [ "store", "obj" ]
447 outs = [ "M", "X_regular", "X_except", "res" ]
448 flags = [ "highlevel" ]
455 attr_struct = "io_attr"
457 pinned_init = "op_pin_state_floats"
463 flags = [ "cfopcode" ]
466 ins = [ "mem", "ptr" ]
467 outs = [ "M", "X_regular", "X_except", "res" ]
468 flags = [ "fragile", "uses_memory" ]
470 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
475 java_name = "load_mode"
478 attr_struct = "load_attr"
481 type = "ir_cons_flags",
486 firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);
493 ins = [ "mem", "left", "right" ]
494 outs = [ "M", "X_regular", "X_except", "res" ]
495 flags = [ "fragile", "uses_memory" ]
496 attrs_name = "divmod"
503 attr_struct = "divmod_attr"
506 arity_override = "oparity_binary"
508 firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
512 flags = [ "commutative" ]
515 flags = [ "commutative" ]
518 ins = [ "sel", "false", "true" ]
524 flags = [ "dump_noblock", "dump_noinput" ]
533 flags = [ "commutative" ]
539 attr_struct = "phi_attr"
542 /* Memory Phis in endless loops must be kept alive.
543 As we can't distinguish these easily we keep all of them alive. */
544 if (is_Phi(res) && mode == mode_M)
545 add_End_keepalive(get_irg_end(irg), res);
550 mode = "get_irn_mode(irn_op)"
551 flags = [ "highlevel" ]
560 block = "get_nodes_block(irn_pred)"
561 graph = "get_irn_irg(irn_pred)"
573 ins = [ "mem", "left", "right" ]
574 outs = [ "M", "X_regular", "X_except", "res" ]
575 flags = [ "fragile", "uses_memory" ]
576 attrs_name = "divmod"
583 attr_struct = "divmod_attr"
586 arity_override = "oparity_binary"
588 firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
592 ins = [ "mem", "exo_ptr" ]
594 flags = [ "highlevel", "cfopcode" ]
601 flags = [ "cfopcode" ]
608 ins = [ "mem", "ptr" ]
611 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
619 attr_struct = "sel_attr"
633 flags = [ "cfopcode" ]
637 ins = [ "mem", "ptr", "value" ]
638 outs = [ "M", "X_regular", "X_except" ]
639 flags = [ "fragile", "uses_memory" ]
641 attr_struct = "store_attr"
642 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
645 type = "ir_cons_flags",
650 firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);
658 flags = [ "constlike", "start_block" ]
668 attr_struct = "symconst_attr"
682 flags = [ "labeled" ]
688 block = "get_irg_start_block(irg)"
689 flags = [ "cfopcode", "fragile", "start_block", "constlike",
694 def getOpList(namespace):
696 for t in namespace.values():
700 if issubclass(t, Op):
705 nodes = getOpList(globals())
706 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))