}
if (edges_activated_kind(irg, EDGE_KIND_BLOCK) && is_Block(src)) {
- ir_node *bl_old = old_tgt ? get_nodes_block(skip_Proj(old_tgt)) : NULL;
+ /* do not use get_nodes_block() here, it fails when running unpinned */
+ ir_node *bl_old = old_tgt ? get_irn_n(skip_Proj(old_tgt), -1) : NULL;
ir_node *bl_tgt = NULL;
if (tgt)
- bl_tgt = is_Bad(tgt) ? tgt : get_nodes_block(skip_Proj(tgt));
+ bl_tgt = is_Bad(tgt) ? tgt : get_irn_n(skip_Proj(tgt), -1);
edges_notify_edge_kind(src, pos, bl_tgt, bl_old, EDGE_KIND_BLOCK, irg);
}
}
}
}
+
+static void irg_block_edges_walk2(ir_node *bl,
+ irg_walk_func *pre, irg_walk_func *post,
+ void *env) {
+ const ir_edge_t *edge, *next;
+
+ if (Block_not_block_visited(bl)) {
+ mark_Block_block_visited(bl);
+
+ if (pre)
+ pre(bl, env);
+
+ foreach_out_edge_kind_safe(bl, edge, next, EDGE_KIND_BLOCK) {
+ /* find the corresponding successor block. */
+ ir_node *pred = get_edge_src_irn(edge);
+ irg_block_edges_walk2(pred, pre, post, env);
+ }
+
+ if (post)
+ post(bl, env);
+ }
+}
+
+/* Walks only over Block nodes in the graph. Has it's own visited
+ flag, so that it can be interleaved with the other walker. */
+void irg_block_edges_walk(ir_node *node,
+ irg_walk_func *pre, irg_walk_func *post,
+ void *env) {
+
+ assert(edges_activated(current_ir_graph));
+ assert(is_Block(node));
+
+ inc_irg_block_visited(current_ir_graph);
+ irg_block_edges_walk2(node, pre, post, env);
+}