fixed some warnings
[libfirm] / ir / ir / iredges.c
index 0195480..2b6e19d 100644 (file)
@@ -498,8 +498,6 @@ void edges_activate_kind(ir_graph *irg, ir_edge_kind_t kind)
 
        info->activated = 1;
        edges_init_graph_kind(irg, kind);
-       //irg_walk_graph(irg, init_lh_walker, build_edges_walker, &w);
-       inc_irg_visited(irg);
        irg_walk_anchors(irg, init_lh_walker, build_edges_walker, &w);
        visit_all_identities(irg, visitor, &w);
 }
@@ -758,9 +756,7 @@ int edges_verify(ir_graph *irg) {
        w.problem_found = 0;
 
        /* verify counter */
-       inc_irg_visited(irg);
        irg_walk_anchors(irg, clear_links, count_user, &w);
-       inc_irg_visited(irg);
        irg_walk_anchors(irg, NULL, verify_edge_counter, &w);
 
        return problem_found ? 1 : w.problem_found;
@@ -842,3 +838,38 @@ void dump_all_out_edges(ir_node *irn)
                }
        }
 }
+
+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);
+}