Remove the unused parameter const arch_env_t *env from arch_irn_get_flags(), arch_irn...
[libfirm] / ir / be / beschedregpress.c
index c418968..0ad96d3 100644 (file)
@@ -1,9 +1,28 @@
+/*
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
 /**
- * Regpressure node selector.
- * Originally implemented by Sebastian Hack.
- * @author Christian Wuerdig
- * @date   29.08.2006
- * @cvs-id $Id$
+ * @file
+ * @brief       Register pressure node selector.
+ * @author      Sebastian Hack
+ * @date        29.08.2006
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -13,6 +32,7 @@
 
 #include "iredges_t.h"
 #include "irgwalk.h"
+#include "irtools.h"
 
 #include "besched_t.h"
 #include "belistsched.h"
@@ -154,13 +174,13 @@ static int compute_max_hops(reg_pressure_selector_env_t *env, ir_node *irn)
        return res;
 }
 
-static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg)
+static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const be_irg_t *birg)
 {
-       reg_pressure_main_env_t *main_env = xmalloc(sizeof(main_env[0]));
+       reg_pressure_main_env_t *main_env = XMALLOC(reg_pressure_main_env_t);
 
-       main_env->arch_env = arch_env;
+       main_env->arch_env = be_get_birg_arch_env(birg);
        main_env->vtab     = vtab;
-       irg_walk_graph(irg, firm_clear_link, NULL, NULL);
+       irg_walk_graph(be_get_birg_irg(birg), firm_clear_link, NULL, NULL);
 
        return main_env;
 }
@@ -178,7 +198,7 @@ static INLINE int must_appear_in_schedule(const list_sched_selector_t *sel, void
 static void *reg_pressure_block_init(void *graph_env, ir_node *bl)
 {
        ir_node *irn;
-       reg_pressure_selector_env_t *env  = xmalloc(sizeof(env[0]));
+       reg_pressure_selector_env_t *env = XMALLOC(reg_pressure_selector_env_t);
 
        obstack_init(&env->obst);
        ir_nodeset_init(&env->already_scheduled);
@@ -264,6 +284,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
        reg_pressure_selector_env_t *env = block_env;
        ir_node *irn, *res     = NULL;
        int curr_cost          = INT_MAX;
+       (void) live_set;
 
        assert(ir_nodeset_size(ready_set) > 0);
 
@@ -273,7 +294,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
                Ignore branch instructions for the time being.
                They should only be scheduled if there is nothing else.
                */
-               if (! arch_irn_class_is(env->main_env->arch_env, irn, branch)) {
+               if (!arch_irn_class_is(irn, branch)) {
                        int costs = reg_pr_costs(env, irn);
                        if (costs <= curr_cost) {
                                res       = irn;
@@ -298,7 +319,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
        return res;
 }
 
-static const list_sched_selector_t reg_pressure_selector_struct = {
+const list_sched_selector_t reg_pressure_selector = {
        reg_pressure_graph_init,
        reg_pressure_block_init,
        reg_pressure_select,
@@ -310,5 +331,3 @@ static const list_sched_selector_t reg_pressure_selector_struct = {
        reg_pressure_block_free,
        free
 };
-
-const list_sched_selector_t *reg_pressure_selector = &reg_pressure_selector_struct;