ir_node *get_Block_cfg_out(ir_node *bl, int pos) {
int i, out_pos = 0;
- assert(bl && (get_irn_op(bl) == op_Block));
+ assert(bl && is_Block(bl));
#ifdef DEBUG_libfirm
assert (bl->out_valid);
#endif /* defined DEBUG_libfirm */
irg_walk_func *pre, irg_walk_func *post,
void *env) {
- assert((get_irn_op(node) == op_Block) || (get_irn_mode(node) == mode_X));
+ assert(is_Block(node) || (get_irn_mode(node) == mode_X));
inc_irg_block_visited(current_ir_graph);
/** Returns the amount of out edges for not yet visited successors.
- * This version handles some special nodes like irg_frame etc.
+ * This version handles some special nodes like irg_frame, irg_args etc.
*/
static int count_outs(ir_graph *irg) {
ir_node *n;
++res;
}
+ n = get_irg_args(irg);
+ if (irn_not_visited(n)) {
+ n->out = (ir_node **)1;
+ ++res;
+ }
+
return res;
}
* @return The next free address
*/
static ir_node **set_out_edges(ir_graph *irg, ir_node **free) {
- ir_node *n;
- int n_outs;
+ ir_node *n, *special[2];
+ int i, n_outs;
inc_irg_visited(irg);
free = _set_out_edges(get_irg_end(irg), free);
- n = get_irg_frame(irg);
- if (get_irn_visited(n) < get_irg_visited(current_ir_graph)) {
- n_outs = PTR_TO_INT(n->out);
- n->out = free;
+ /* handle special nodes */
+ special[0] = get_irg_frame(irg);
+ special[1] = get_irg_args(irg);
+
+ for (i = 1; i >= 0; --i) {
+ n = special[i];
+
+ if (get_irn_visited(n) < get_irg_visited(current_ir_graph)) {
+ n_outs = PTR_TO_INT(n->out);
+ n->out = free;
#ifdef DEBUG_libfirm
- n->out_valid = 1;
+ n->out_valid = 1;
#endif /* defined DEBUG_libfirm */
- free += n_outs;
+ free += n_outs;
+ }
}
return free;
int i;
if (get_Block_n_cfg_outs(startbl)) {
- for (i = 0; i < get_irn_n_outs(startbl); i++)
+ for (i = get_irn_n_outs(startbl) - 1; i >= 0; --i)
if (get_irn_mode(get_irn_out(startbl, i)) == mode_X) {
proj = get_irn_out(startbl, i);
break;