- /* Check whether we enter or leave a procedure and act according. */
- if ((get_irn_op(cf_pred) == op_EndReg) ||
- (get_irn_op(cf_pred) == op_EndExcept))
- enter_procedure(block, cf_pred, pos);
- if (get_irn_op(cf_pred) == op_CallBegin)
- if (!leave_procedure(block, cf_pred, pos)) return NULL;
+ assert(node);
+ assert(!get_interprocedural_view()); /* interprocedural_view not implemented, because it
+ * interleaves with irg_walk */
+ assert(! inside_irg_walk(current_ir_graph)); /* we must not already be in a block walk */
+ inc_irg_block_visited(current_ir_graph);
+ set_inside_block_walk(current_ir_graph);
+ block = is_Block(node) ? node : get_nodes_block(node);
+ assert(get_irn_op(block) == op_Block);
+ irg_block_walk_2(block, pre, post, env);
+
+ /* keepalive: the endless loops ... */
+ if (get_irn_op(node) == op_End) {
+ int arity = get_irn_arity(node);
+ for (i = 0; i < arity; i++) {
+ pred = get_irn_n(node, i);
+ if (get_irn_op(pred) == op_Block)
+ irg_block_walk_2(pred, pre, post, env);
+ }
+ /* Sometimes the blocks died, but are still reachable through Phis.
+ * Make sure the algorithms that try to remove these reach them. */
+ for (i = 0; i < arity; i++) {
+ pred = get_irn_n(node, i);
+ if (get_irn_op(pred) == op_Phi) {
+ ir_node *block = get_nodes_block(pred);
+
+ if (! is_Bad(block))
+ irg_block_walk_2(block, pre, post, env);
+ }
+ }