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);
188 flags = [ "cfopcode" ]
194 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
195 flags = [ "uses_memory" ]
198 type = "ir_builtin_kind",
207 pinned_init = "op_pin_state_pinned"
208 attr_struct = "builtin_attr"
210 assert((get_unknown_type() == type) || is_Method_type(type));
214 ins = [ "mem", "ptr" ]
216 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
217 flags = [ "fragile", "uses_memory" ]
226 # the tail call attribute can only be set by analysis
230 attr_struct = "call_attr"
232 pinned_init = "op_pin_state_pinned"
234 assert((get_unknown_type() == type) || is_Method_type(type));
237 firm_alloc_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr);
243 flags = [ "cfopcode", "ip_cfopcode" ]
245 # TODO: attribute with call...
246 attr_struct = "callbegin_attr"
256 flags = [ "commutative" ]
259 mode = "get_irn_mode(irn_op)"
260 flags = [ "highlevel" ]
267 attr_struct = "cast_attr"
268 init = "assert(is_atomic_type(type));"
271 outs = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ]
276 outs = [ "false", "true" ]
277 flags = [ "cfopcode", "forking" ]
281 name = "default_proj",
287 type = "cond_jmp_predicate",
288 init = "COND_JMP_PRED_NONE"
291 attr_struct = "cond_attr"
294 ins = [ "value", "bound" ]
295 mode = "get_irn_mode(irn_value)"
296 flags = [ "highlevel" ]
304 attr_struct = "confirm_attr"
305 attrs_name = "confirm"
309 flags = [ "constlike", "start_block" ]
319 attr_struct = "const_attr"
334 attr_struct = "conv_attr"
338 ins = [ "mem", "dst", "src" ]
339 outs = [ "M", "X_regular", "X_except" ]
340 flags = [ "fragile", "highlevel", "uses_memory" ]
347 attr_struct = "copyb_attr"
350 pinned_init = "op_pin_state_pinned"
352 firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr);
356 ins = [ "mem", "left", "right" ]
357 outs = [ "M", "X_regular", "X_except", "res" ]
358 flags = [ "fragile", "uses_memory" ]
359 attrs_name = "divmod"
366 name = "no_remainder",
375 attr_struct = "divmod_attr"
378 arity_override = "oparity_binary"
380 firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
384 ins = [ "mem", "left", "right" ]
385 outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ]
386 flags = [ "fragile", "uses_memory" ]
387 attrs_name = "divmod"
394 attr_struct = "divmod_attr"
397 arity_override = "oparity_binary"
399 firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
404 flags = [ "cfopcode", "fragile", "start_block", "constlike",
408 block = "get_irg_start_block(irg)"
414 flags = [ "cfopcode" ]
421 flags = [ "cfopcode", "ip_cfopcode" ]
428 flags = [ "cfopcode", "ip_cfopcode" ]
432 flags = [ "commutative" ]
444 attr_struct = "filter_attr"
445 attrs_name = "filter"
449 ins = [ "mem", "ptr", "size" ]
451 flags = [ "uses_memory" ]
460 type = "ir_where_alloc"
463 attr_struct = "free_attr"
474 flags = [ "cfopcode", "forking", "keep" ]
477 ins = [ "store", "obj" ]
478 outs = [ "M", "X_regular", "X_except", "res" ]
479 flags = [ "highlevel" ]
486 attr_struct = "io_attr"
488 pinned_init = "op_pin_state_floats"
494 flags = [ "cfopcode" ]
497 ins = [ "mem", "ptr" ]
498 outs = [ "M", "X_regular", "X_except", "res" ]
499 flags = [ "fragile", "uses_memory" ]
501 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
506 java_name = "load_mode"
509 attr_struct = "load_attr"
512 type = "ir_cons_flags",
517 firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);
524 ins = [ "mem", "left", "right" ]
525 outs = [ "M", "X_regular", "X_except", "res" ]
526 flags = [ "fragile", "uses_memory" ]
527 attrs_name = "divmod"
534 attr_struct = "divmod_attr"
537 arity_override = "oparity_binary"
539 firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
543 flags = [ "commutative" ]
546 flags = [ "commutative" ]
549 ins = [ "sel", "false", "true" ]
555 flags = [ "dump_noblock", "dump_noinput" ]
564 flags = [ "commutative" ]
570 attr_struct = "phi_attr"
574 /* Memory Phis in endless loops must be kept alive.
575 As we can't distinguish these easily we keep all of them alive. */
576 if (is_Phi(res) && mode == mode_M)
577 add_End_keepalive(get_irg_end(irg), res);
582 mode = "get_irn_mode(irn_op)"
583 flags = [ "highlevel" ]
592 block = "get_nodes_block(irn_pred)"
593 graph = "get_irn_irg(irn_pred)"
606 ins = [ "mem", "left", "right" ]
607 outs = [ "M", "X_regular", "X_except", "res" ]
608 flags = [ "fragile", "uses_memory" ]
609 attrs_name = "divmod"
616 attr_struct = "divmod_attr"
619 arity_override = "oparity_binary"
621 firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
625 ins = [ "mem", "exo_ptr" ]
627 flags = [ "highlevel", "cfopcode" ]
634 flags = [ "cfopcode" ]
641 ins = [ "mem", "ptr" ]
644 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
652 attr_struct = "sel_attr"
666 flags = [ "cfopcode" ]
670 ins = [ "mem", "ptr", "value" ]
671 outs = [ "M", "X_regular", "X_except" ]
672 flags = [ "fragile", "uses_memory" ]
674 attr_struct = "store_attr"
675 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
678 type = "ir_cons_flags",
683 firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);
691 flags = [ "constlike", "start_block" ]
701 attr_struct = "symconst_attr"
715 flags = [ "labeled" ]
721 block = "get_irg_start_block(irg)"
722 flags = [ "cfopcode", "fragile", "start_block", "constlike",
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))