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", "size" ]
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" ]
64 attr_struct = "asm_attr"
66 pinned_init = "op_pin_state_pinned"
69 name = "input_constraints",
70 type = "ir_asm_constraint*",
73 name = "n_output_constraints",
77 name = "output_constraints",
78 type = "ir_asm_constraint*",
97 flags = [ "cfopcode", "fragile", "start_block", "dump_noblock" ]
101 attr_struct = "irg_attr"
103 res->attr.irg.irg = irg;
113 flags = [ "labeled" ]
114 attr_struct = "block_attr"
118 /* macroblock header */
121 res->attr.block.is_dead = 0;
122 res->attr.block.is_mb_head = 1;
123 res->attr.block.irg.irg = irg;
124 res->attr.block.backedge = new_backedge_arr(irg->obst, arity);
125 res->attr.block.in_cg = NULL;
126 res->attr.block.cg_backedge = NULL;
127 res->attr.block.extblk = NULL;
128 res->attr.block.mb_depth = 0;
129 res->attr.block.entity = NULL;
131 set_Block_matured(res, 1);
132 set_Block_block_visited(res, 0);
141 /* Create and initialize array for Phi-node construction. */
142 if (get_irg_phase_state(current_ir_graph) == phase_building) {
143 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,
144 current_ir_graph->n_loc);
145 memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
148 for (i = arity - 1; i >= 0; i--)
149 if (is_Unknown(in[i])) {
154 if (!has_unknown) res = optimize_node(res);
156 current_ir_graph->current_block = res;
158 IRN_VRFY_IRG(res, current_ir_graph);
162 public void addPred(Node node) {
163 binding_cons.add_immBlock_pred(ptr, node.ptr);
166 public void mature() {
167 binding_cons.mature_immBlock(ptr);
171 public Block getBlock() {
175 public boolean blockVisited() {
176 return 0 != binding.Block_block_visited(ptr);
179 public void markBlockVisited() {
180 binding.mark_Block_block_visited(ptr);
183 public boolean isBad() {
184 return binding.is_Bad(ptr) != 0;
192 ins = [ "mem", "index", "lower", "upper" ]
193 outs = [ "M", "X_regular", "X_except", "res" ]
194 flags = [ "fragile", "highlevel" ]
196 pinned_init = "op_pin_state_pinned"
197 attr_struct = "bound_attr"
199 firm_alloc_frag_arr(res, op_Bound, &res->attr.bound.exc.frag_arr);
204 flags = [ "cfopcode" ]
210 outs = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ]
211 flags = [ "uses_memory" ]
214 type = "ir_builtin_kind",
223 pinned_init = "op_pin_state_pinned"
224 attr_struct = "builtin_attr"
226 assert((get_unknown_type() == type) || is_Method_type(type));
230 ins = [ "mem", "ptr" ]
232 outs = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ]
233 flags = [ "fragile", "uses_memory" ]
240 attr_struct = "call_attr"
242 pinned_init = "op_pin_state_pinned"
244 assert((get_unknown_type() == type) || is_Method_type(type));
247 firm_alloc_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr);
253 flags = [ "cfopcode", "ip_cfopcode" ]
255 # TODO: attribute with call...
256 attr_struct = "callbegin_attr"
266 flags = [ "commutative" ]
270 mode = "get_irn_mode(irn_op)"
271 flags = [ "highlevel" ]
279 attr_struct = "cast_attr"
280 init = "assert(is_atomic_type(type));"
283 outs = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ]
288 outs = [ "false", "true" ]
289 flags = [ "cfopcode", "forking" ]
298 name = "default_proj",
304 type = "cond_jmp_predicate",
305 init = "COND_JMP_PRED_NONE"
308 attr_struct = "cond_attr"
311 ins = [ "value", "bound" ]
312 mode = "get_irn_mode(irn_value)"
313 flags = [ "highlevel" ]
321 attr_struct = "confirm_attr"
325 flags = [ "constlike", "start_block" ]
335 attr_struct = "const_attr"
350 attr_struct = "conv_attr"
353 ins = [ "mem", "dst", "src" ]
354 outs = [ "M", "X_regular", "X_except" ]
355 flags = [ "fragile", "highlevel", "uses_memory" ]
362 attr_struct = "copyb_attr"
364 pinned_init = "op_pin_state_pinned"
366 firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr);
370 ins = [ "mem", "left", "right" ]
371 outs = [ "M", "X_regular", "X_except", "res" ]
372 flags = [ "fragile", "uses_memory" ]
373 attrs_name = "divmod"
380 name = "no_remainder",
389 attr_struct = "divmod_attr"
392 arity_override = "oparity_binary"
394 firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
398 ins = [ "mem", "left", "right" ]
399 outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ]
400 flags = [ "fragile", "uses_memory" ]
401 attrs_name = "divmod"
408 attr_struct = "divmod_attr"
411 arity_override = "oparity_binary"
413 firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
418 flags = [ "cfopcode", "fragile", "start_block", "constlike",
422 block = "get_irg_start_block(irg)"
428 flags = [ "cfopcode" ]
435 flags = [ "cfopcode", "ip_cfopcode" ]
442 flags = [ "cfopcode", "ip_cfopcode" ]
446 flags = [ "commutative" ]
458 attr_struct = "filter_attr"
462 ins = [ "mem", "ptr", "size" ]
464 flags = [ "uses_memory" ]
473 type = "ir_where_alloc"
476 attr_struct = "free_attr"
487 flags = [ "cfopcode", "forking", "keep" ]
490 ins = [ "store", "obj" ]
491 outs = [ "M", "X_regular", "X_except", "res", "M_except" ]
492 flags = [ "highlevel" ]
499 attr_struct = "io_attr"
501 pinned_init = "op_pin_state_floats"
507 flags = [ "cfopcode" ]
510 ins = [ "mem", "ptr" ]
511 outs = [ "M", "X_regular", "X_except", "res" ]
512 flags = [ "fragile", "uses_memory" ]
514 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
519 java_name = "load_mode"
522 attr_struct = "load_attr"
525 type = "ir_cons_flags",
530 firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);
537 ins = [ "mem", "left", "right" ]
538 outs = [ "M", "X_regular", "X_except", "res" ]
539 flags = [ "fragile", "uses_memory" ]
540 attrs_name = "divmod"
547 attr_struct = "divmod_attr"
550 arity_override = "oparity_binary"
552 firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
556 flags = [ "commutative" ]
559 flags = [ "commutative" ]
562 ins = [ "sel", "false", "true" ]
568 flags = [ "dump_noblock", "dump_noinput" ]
577 flags = [ "commutative" ]
583 attr_struct = "phi_attr"
587 /* Memory Phis in endless loops must be kept alive.
588 As we can't distinguish these easily we keep all of them alive. */
589 if (is_Phi(res) && mode == mode_M)
590 add_End_keepalive(get_irg_end(irg), res);
595 mode = "get_irn_mode(irn_op)"
596 flags = [ "highlevel" ]
614 ins = [ "mem", "left", "right" ]
615 outs = [ "M", "X_regular", "X_except", "res" ]
616 flags = [ "fragile", "uses_memory" ]
617 attrs_name = "divmod"
624 attr_struct = "divmod_attr"
627 arity_override = "oparity_binary"
629 firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
633 ins = [ "mem", "exo_ptr" ]
635 flags = [ "highlevel", "cfopcode" ]
642 flags = [ "cfopcode" ]
649 ins = [ "mem", "ptr" ]
652 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
660 attr_struct = "sel_attr"
674 flags = [ "cfopcode" ]
678 ins = [ "mem", "ptr", "value" ]
679 outs = [ "M", "X_regular", "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",
691 firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);
699 flags = [ "constlike", "start_block" ]
708 attr_struct = "symconst_attr"
722 flags = [ "labeled" ]
728 block = "get_irg_start_block(irg)"
729 flags = [ "cfopcode", "fragile", "start_block", "constlike",
734 def getOpList(namespace):
736 for t in namespace.values():
740 if issubclass(t, Op):
745 nodes = getOpList(globals())
746 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))