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));"
272 ("False", "always false"),
275 ("Le", "less or equal"),
277 ("Ge", "greater or equal"),
278 ("Lg", "less or greater"),
279 ("Leg", "less, equal or greater ('not equal' for integer numbers)"),
281 ("Ue", "unordered or equal"),
282 ("Ul", "unordered or less"),
283 ("Ule", "unordered, less or equal"),
284 ("Ug", "unordered or greater"),
285 ("Uge", "onordered, greater or equal"),
286 ("Ne", "unordered, less, greater or equal ('not equal' for floatingpoint numbers)"),
287 ("True", "always true"),
293 outs = [ "false", "true" ]
294 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"
322 attrs_name = "confirm"
326 flags = [ "constlike", "start_block" ]
336 attr_struct = "const_attr"
351 attr_struct = "conv_attr"
355 ins = [ "mem", "dst", "src" ]
356 outs = [ "M", "X_regular", "X_except" ]
357 flags = [ "fragile", "highlevel", "uses_memory" ]
364 attr_struct = "copyb_attr"
367 pinned_init = "op_pin_state_pinned"
369 firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr);
373 ins = [ "mem", "left", "right" ]
374 outs = [ "M", "X_regular", "X_except", "res" ]
375 flags = [ "fragile", "uses_memory" ]
376 attrs_name = "divmod"
383 name = "no_remainder",
392 attr_struct = "divmod_attr"
395 arity_override = "oparity_binary"
397 firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);
401 ins = [ "mem", "left", "right" ]
402 outs = [ "M", "X_regular", "X_except", "res_div", "res_mod" ]
403 flags = [ "fragile", "uses_memory" ]
404 attrs_name = "divmod"
411 attr_struct = "divmod_attr"
414 arity_override = "oparity_binary"
416 firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);
421 flags = [ "cfopcode", "fragile", "start_block", "constlike",
425 block = "get_irg_start_block(irg)"
431 flags = [ "cfopcode" ]
438 flags = [ "cfopcode", "ip_cfopcode" ]
445 flags = [ "cfopcode", "ip_cfopcode" ]
449 flags = [ "commutative" ]
461 attr_struct = "filter_attr"
462 attrs_name = "filter"
466 ins = [ "mem", "ptr", "size" ]
468 flags = [ "uses_memory" ]
477 type = "ir_where_alloc"
480 attr_struct = "free_attr"
491 flags = [ "cfopcode", "forking", "keep" ]
494 ins = [ "store", "obj" ]
495 outs = [ "M", "X_regular", "X_except", "res" ]
496 flags = [ "highlevel" ]
503 attr_struct = "io_attr"
505 pinned_init = "op_pin_state_floats"
511 flags = [ "cfopcode" ]
514 ins = [ "mem", "ptr" ]
515 outs = [ "M", "X_regular", "X_except", "res" ]
516 flags = [ "fragile", "uses_memory" ]
518 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
523 java_name = "load_mode"
526 attr_struct = "load_attr"
529 type = "ir_cons_flags",
534 firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);
541 ins = [ "mem", "left", "right" ]
542 outs = [ "M", "X_regular", "X_except", "res" ]
543 flags = [ "fragile", "uses_memory" ]
544 attrs_name = "divmod"
551 attr_struct = "divmod_attr"
554 arity_override = "oparity_binary"
556 firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr);
560 flags = [ "commutative" ]
563 flags = [ "commutative" ]
566 ins = [ "sel", "false", "true" ]
572 flags = [ "dump_noblock", "dump_noinput" ]
581 flags = [ "commutative" ]
587 attr_struct = "phi_attr"
591 /* Memory Phis in endless loops must be kept alive.
592 As we can't distinguish these easily we keep all of them alive. */
593 if (is_Phi(res) && mode == mode_M)
594 add_End_keepalive(get_irg_end(irg), res);
599 mode = "get_irn_mode(irn_op)"
600 flags = [ "highlevel" ]
609 block = "get_nodes_block(irn_pred)"
610 graph = "get_irn_irg(irn_pred)"
623 ins = [ "mem", "left", "right" ]
624 outs = [ "M", "X_regular", "X_except", "res" ]
625 flags = [ "fragile", "uses_memory" ]
626 attrs_name = "divmod"
633 attr_struct = "divmod_attr"
636 arity_override = "oparity_binary"
638 firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr);
642 ins = [ "mem", "exo_ptr" ]
644 flags = [ "highlevel", "cfopcode" ]
651 flags = [ "cfopcode" ]
658 ins = [ "mem", "ptr" ]
661 mode = "is_Method_type(get_entity_type(entity)) ? mode_P_code : mode_P_data"
669 attr_struct = "sel_attr"
683 flags = [ "cfopcode" ]
687 ins = [ "mem", "ptr", "value" ]
688 outs = [ "M", "X_regular", "X_except" ]
689 flags = [ "fragile", "uses_memory" ]
691 attr_struct = "store_attr"
692 pinned_init = "flags & cons_floats ? op_pin_state_floats : op_pin_state_pinned"
695 type = "ir_cons_flags",
700 firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);
708 flags = [ "constlike", "start_block" ]
718 attr_struct = "symconst_attr"
732 flags = [ "labeled" ]
738 block = "get_irg_start_block(irg)"
739 flags = [ "cfopcode", "fragile", "start_block", "constlike",
744 def getOpList(namespace):
746 for t in namespace.values():
750 if issubclass(t, Op):
755 nodes = getOpList(globals())
756 nodes = sorted(nodes, lambda x,y: cmp(x.name, y.name))