Remove the unused parameter const arch_env_t *env from arch_irn_get_flags(), arch_irn...
[libfirm] / ir / be / bespillbelady3.c
index 3c6711e..1b4d40c 100644 (file)
@@ -53,7 +53,9 @@
 #include "besched_t.h"
 #include "be_t.h"
 
+#ifndef NDEBUG
 #define EXPENSIVE_CHECKS
+#endif
 
 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
@@ -84,7 +86,7 @@ typedef struct worklist_t worklist_t;
 struct worklist_t {
        struct list_head  live_values;
        size_t            n_live_values;
-       unsigned long     visited;
+       ir_visited_t      visited;
 };
 
 typedef struct block_info_t block_info_t;
@@ -93,7 +95,6 @@ struct block_info_t {
        worklist_t *end_worklist;
 };
 
-static const arch_env_t            *arch_env;
 static const arch_register_class_t *cls;
 static struct obstack               obst;
 static spill_env_t                 *senv;
@@ -103,7 +104,7 @@ static bool                         tentative_mode;
 static bool                         should_have_reached_fixpoint;
 static bool                         do_push_unused_livethroughs;
 static ir_exec_freq                *exec_freq;
-static unsigned long                worklist_visited;
+static ir_visited_t                 worklist_visited;
 
 static worklist_t *new_worklist(void)
 {
@@ -193,11 +194,11 @@ static void fill_and_activate_worklist(worklist_t *new_worklist,
                        value = get_Phi_pred(value, succ_pos);
 
                        /* can happen for unknown phi preds */
-                       if (!arch_irn_consider_in_reg_alloc(arch_env, cls, value))
+                       if (!arch_irn_consider_in_reg_alloc(cls, value))
                                continue;
                }
 
-               if (irn_visited(value))
+               if (irn_visited_else_mark(value))
                        continue;
 
                new_entry = obstack_alloc(&obst, sizeof(new_entry[0]));
@@ -213,7 +214,6 @@ static void fill_and_activate_worklist(worklist_t *new_worklist,
                list_add_tail(&new_entry->head, &new_worklist->live_values);
                ++n_live_values;
 
-               mark_irn_visited(value);
                set_irn_link(value, new_entry);
                new_worklist->n_live_values++;
        }
@@ -398,7 +398,7 @@ static void val_used(worklist_t *worklist, ir_node *value, ir_node *sched_point)
        /* already in the worklist? move around, otherwise add at back */
        worklist_entry_t *entry = get_irn_link(value);
 
-       assert(arch_irn_consider_in_reg_alloc(arch_env, cls, value));
+       assert(arch_irn_consider_in_reg_alloc(cls, value));
 
        if (worklist_contains(value)) {
                assert(entry != NULL);
@@ -463,7 +463,7 @@ static void do_spilling(ir_node *block, worklist_t *worklist)
 
                                if (worklist_contains(node2))
                                        continue;
-                               if (!arch_irn_consider_in_reg_alloc(arch_env, cls, node2))
+                               if (!arch_irn_consider_in_reg_alloc(cls, node2))
                                        continue;
 
                                if (!tentative_mode)
@@ -480,7 +480,7 @@ static void do_spilling(ir_node *block, worklist_t *worklist)
 
                        foreach_out_edge(node, edge) {
                                ir_node *proj = get_edge_src_irn(edge);
-                               if (!arch_irn_consider_in_reg_alloc(arch_env, cls, proj))
+                               if (!arch_irn_consider_in_reg_alloc(cls, proj))
                                        continue;
                                if (worklist_contains(proj)) {
                                        worklist_remove(worklist, proj);
@@ -488,7 +488,7 @@ static void do_spilling(ir_node *block, worklist_t *worklist)
                                        ++n_defs;
                                }
                        }
-               } else if (arch_irn_consider_in_reg_alloc(arch_env, cls, node)) {
+               } else if (arch_irn_consider_in_reg_alloc(cls, node)) {
                        if (worklist_contains(node)) {
                                worklist_remove(worklist, node);
                        } else {
@@ -504,7 +504,7 @@ static void do_spilling(ir_node *block, worklist_t *worklist)
                for(i = 0; i < arity; ++i) {
                        ir_node *use = get_irn_n(node, i);
 
-                       if (!arch_irn_consider_in_reg_alloc(arch_env, cls, use))
+                       if (!arch_irn_consider_in_reg_alloc(cls, use))
                                continue;
 
                        val_used(worklist, use, node);
@@ -681,7 +681,10 @@ static void find_in_loop(ir_loop *loop, ir_node *entry)
                }
                assert(found);
        }
+#else
+       (void) entry;
 #endif
+
        /* check all loop successors */
        for (edge = loop_info->exit_edges; edge != NULL; edge = edge->next) {
                ir_node *succ      = edge->block;
@@ -998,7 +1001,7 @@ static void fix_block_borders(ir_node *block, void *data)
                                value = get_irn_n(value, i);
 
                                /* we might have unknowns as argument for the phi */
-                               if (!arch_irn_consider_in_reg_alloc(arch_env, cls, value))
+                               if (!arch_irn_consider_in_reg_alloc(cls, value))
                                        continue;
                        }
 
@@ -1026,7 +1029,6 @@ static void be_spill_belady3(be_irg_t *birg, const arch_register_class_t *ncls)
                return;
 
        worklist_visited = 0;
-       arch_env         = be_get_birg_arch_env(birg);
        exec_freq        = be_get_birg_exec_freq(birg);
 
        be_clear_links(irg);