fix warning
[libfirm] / ir / be / beschednormal.c
index 74cffb9..c134987 100644 (file)
@@ -132,8 +132,10 @@ static int normal_tree_cost(ir_node* irn)
                        } else if (get_nodes_block(pred) != block) {
                                cost = 1;
                        } else {
+                               flag_and_cost* pred_fc;
+
                                cost = normal_tree_cost(pred);
-                               flag_and_cost* pred_fc = get_irn_link(pred);
+                               pred_fc = get_irn_link(pred);
                                pred_fc->no_root = 1;
 #if defined NORMAL_DBG
                                ir_fprintf(stderr, "%+F says that %+F is no root\n", irn, pred);
@@ -258,6 +260,8 @@ static ir_node** sched_node(ir_node** sched, ir_node* irn)
        int arity = get_irn_arity(irn);
        int i;
 
+       if (irn_visited(irn)) return sched;
+
        if (!is_Phi(irn)) {
                for (i = 0; i < arity; ++i) {
                        ir_node* pred = get_irn_n(irn, i);
@@ -266,6 +270,7 @@ static ir_node** sched_node(ir_node** sched, ir_node* irn)
                }
        }
 
+       mark_irn_visited(irn);
        ARR_APP1(ir_node*, sched, irn);
        return sched;
 }
@@ -341,6 +346,7 @@ static void *normal_init_graph(const list_sched_selector_t *vtab,
 
        irg_walk_graph(irg, normal_cost_walker,  NULL, NULL);
        irg_walk_graph(irg, collect_roots, NULL, NULL);
+       inc_irg_visited(irg);
        irg_block_walk_graph(irg, normal_sched_block, NULL, NULL);
 
        return NULL;
@@ -356,7 +362,7 @@ static void *normal_init_block(void *graph_env, ir_node *block)
 }
 
 
-static const list_sched_selector_t normal_selector_struct = {
+const list_sched_selector_t normal_selector = {
        normal_init_graph,
        normal_init_block,
        normal_select,
@@ -368,5 +374,3 @@ static const list_sched_selector_t normal_selector_struct = {
        NULL,              /* finish_block */
        NULL               /* finish_graph */
 };
-
-const list_sched_selector_t *normal_selector = &normal_selector_struct;