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" ]
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);
134 /* Create and initialize array for Phi-node construction. */
135 if (get_irg_phase_state(irg) == phase_building) {
136 res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc);
137 memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*));
142 public void addPred(Node node) {
143 binding_cons.add_immBlock_pred(ptr, node.ptr);
146 public void mature() {
147 binding_cons.mature_immBlock(ptr);
151 public Block getBlock() {
155 public boolean blockVisited() {
156 return 0 != binding.Block_block_visited(ptr);
159 public void markBlockVisited() {
160 binding.mark_Block_block_visited(ptr);
163 public boolean isBad() {
164 return binding.is_Bad(ptr) != 0;
172 ins = [ "mem", "index", "lower", "upper" ]
173 outs = [ "M", "X_regular", "X_except", "res" ]
174 flags = [ "fragile", "highlevel" ]
176 pinned_init = "op_pin_state_pinned"
177 attr_struct = "bound_attr"
179 firm_alloc_frag_arr(res, op_Bound, &res->attr.bound.exc.frag_arr);
184 flags = [ "cfopcode" ]
190 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
191 flags = [ "uses_memory" ]
194 type = "ir_builtin_kind",
203 pinned_init = "op_pin_state_pinned"
204 attr_struct = "builtin_attr"
206 assert((get_unknown_type() == type) || is_Method_type(type));
210 ins = [ "mem", "ptr" ]
212 outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ]
213 flags = [ "fragile", "uses_memory" ]
222 # the tail call attribute can only be set by analysis
226 attr_struct = "call_attr"
228 pinned_init = "op_pin_state_pinned"
230 assert((get_unknown_type() == type) || is_Method_type(type));
233 firm_alloc_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr);
239 flags = [ "cfopcode", "ip_cfopcode" ]
241 # TODO: attribute with call...
242 attr_struct = "callbegin_attr"
252 flags = [ "commutative" ]
255 mode = "get_irn_mode(irn_op)"
256 flags = [ "highlevel" ]
263 attr_struct = "cast_attr"
264 init = "assert(is_atomic_type(type));"
267 outs = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ]
272 outs = [ "false", "true" ]
273 flags = [ "cfopcode", "forking" ]
277 name = "default_proj",
283 type = "cond_jmp_predicate",
284 init = "COND_JMP_PRED_NONE"
287 attr_struct = "cond_attr"
290 ins = [ "value", "bound" ]
291 mode = "get_irn_mode(irn_value)"
292 flags = [ "highlevel" ]
300 attr_struct = "confirm_attr"
304 flags = [ "constlike", "start_block" ]
314 attr_struct = "const_attr"
329 attr_struct = "conv_attr"
332 ins = [ "mem", "dst", "src" ]
333 outs = [ "M", "X_regular", "X_except" ]
334 flags = [ "fragile", "highlevel", "uses_memory" ]
341 attr_struct = "copyb_attr"
343 pinned_init = "op_pin_state_pinned"
345 firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr);
349 ins = [ "mem", "left", "right" ]
350 outs = [ "M", "X_regular", "X_except", "res" ]
351 flags = [ "fragile", "uses_memory" ]
352 attrs_name = "divmod"
359 name = "no_remainder",
368 attr_struct = "divmod_attr"
371 arity_override = "oparity_binary"
373 firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
377 ins = [ "mem", "left", "right" ]
378 outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ]
379 flags = [ "fragile", "uses_memory" ]
380 attrs_name = "divmod"
387 attr_struct = "divmod_attr"
390 arity_override = "oparity_binary"
392 firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
397 flags = [ "cfopcode", "fragile", "start_block", "constlike",
401 block = "get_irg_start_block(irg)"
407 flags = [ "cfopcode" ]
414 flags = [ "cfopcode", "ip_cfopcode" ]
421 flags = [ "cfopcode", "ip_cfopcode" ]
425 flags = [ "commutative" ]
437 attr_struct = "filter_attr"
441 ins = [ "mem", "ptr", "size" ]
443 flags = [ "uses_memory" ]
452 type = "ir_where_alloc"
455 attr_struct = "free_attr"
466 flags = [ "cfopcode", "forking", "keep" ]
469 ins = [ "store", "obj" ]
470 outs = [ "M", "X_regular", "X_except", "res" ]
471 flags = [ "highlevel" ]
478 attr_struct = "io_attr"
480 pinned_init = "op_pin_state_floats"
486 flags = [ "cfopcode" ]
489 ins = [ "mem", "ptr" ]
490 outs = [ "M", "X_regular", "X_except", "res" ]
491 flags = [ "fragile", "uses_memory" ]
493 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
498 java_name = "load_mode"
501 attr_struct = "load_attr"
504 type = "ir_cons_flags",
509 firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);
516 ins = [ "mem", "left", "right" ]
517 outs = [ "M", "X_regular", "X_except", "res" ]
518 flags = [ "fragile", "uses_memory" ]
519 attrs_name = "divmod"
526 attr_struct = "divmod_attr"
529 arity_override = "oparity_binary"
531 firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
535 flags = [ "commutative" ]
538 flags = [ "commutative" ]
541 ins = [ "sel", "false", "true" ]
547 flags = [ "dump_noblock", "dump_noinput" ]
556 flags = [ "commutative" ]
562 attr_struct = "phi_attr"
566 /* Memory Phis in endless loops must be kept alive.
567 As we can't distinguish these easily we keep all of them alive. */
568 if (is_Phi(res) && mode == mode_M)
569 add_End_keepalive(get_irg_end(irg), res);
574 mode = "get_irn_mode(irn_op)"
575 flags = [ "highlevel" ]
584 block = "get_nodes_block(irn_pred)"
585 graph = "get_irn_irg(irn_pred)"
597 ins = [ "mem", "left", "right" ]
598 outs = [ "M", "X_regular", "X_except", "res" ]
599 flags = [ "fragile", "uses_memory" ]
600 attrs_name = "divmod"
607 attr_struct = "divmod_attr"
610 arity_override = "oparity_binary"
612 firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
616 ins = [ "mem", "exo_ptr" ]
618 flags = [ "highlevel", "cfopcode" ]
625 flags = [ "cfopcode" ]
632 ins = [ "mem", "ptr" ]
635 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
643 attr_struct = "sel_attr"
657 flags = [ "cfopcode" ]
661 ins = [ "mem", "ptr", "value" ]
662 outs = [ "M", "X_regular", "X_except" ]
663 flags = [ "fragile", "uses_memory" ]
665 attr_struct = "store_attr"
666 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
669 type = "ir_cons_flags",
674 firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);
682 flags = [ "constlike", "start_block" ]
691 attr_struct = "symconst_attr"
705 flags = [ "labeled" ]
711 block = "get_irg_start_block(irg)"
712 flags = [ "cfopcode", "fragile", "start_block", "constlike",
717 def getOpList(namespace):
719 for t in namespace.values():
723 if issubclass(t, Op):
728 nodes = getOpList(globals())
729 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))