- fixed r22803
[libfirm] / ir / be / bestat.c
index 1c3d9dd..4e5a9c5 100644 (file)
@@ -23,9 +23,7 @@
  * @author      Christian Wuerdig, Matthias Braun
  * @version     $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <time.h>
 
@@ -62,15 +60,14 @@ static void check_reg_pressure_class(pressure_walker_env_t *env,
                                      ir_node *block,
                                      const arch_register_class_t *cls)
 {
-       be_irg_t         *birg = env->birg;
-       ir_graph         *irg  = be_get_birg_irg(birg);
-       const arch_env_t *aenv = be_get_birg_arch_env(birg);
-       ir_node          *irn;
-       ir_nodeset_t      live_nodes;
-       int               max_live;
+       be_irg_t     *birg = env->birg;
+       ir_graph     *irg  = be_get_birg_irg(birg);
+       ir_node      *irn;
+       ir_nodeset_t  live_nodes;
+       int           max_live;
 
        ir_nodeset_init(&live_nodes);
-       be_liveness_end_of_block(env->lv, aenv, cls, block, &live_nodes);
+       be_liveness_end_of_block(env->lv, cls, block, &live_nodes);
        max_live = ir_nodeset_size(&live_nodes);
        env->regpressure += max_live;
 
@@ -80,7 +77,7 @@ static void check_reg_pressure_class(pressure_walker_env_t *env,
                if(is_Phi(irn))
                        break;
 
-               be_liveness_transfer(aenv, cls, irn, &live_nodes);
+               be_liveness_transfer(cls, irn, &live_nodes);
                cnt      = ir_nodeset_size(&live_nodes);
                max_live = cnt < max_live ? max_live : cnt;
                env->regpressure += cnt;
@@ -125,7 +122,6 @@ void be_do_stat_reg_pressure(be_irg_t *birg, const arch_register_class_t *cls) {
 
 
 typedef struct _estimate_irg_costs_env_t {
-       const arch_env_t *arch_env;
        ir_exec_freq     *execfreqs;
        double           costs;
 } estimate_irg_costs_env_t;
@@ -137,17 +133,16 @@ static void estimate_block_costs(ir_node *block, void *data)
        double  costs = 0.0;
 
        sched_foreach(block, node) {
-               costs += arch_get_op_estimated_cost(env->arch_env, node);
+               costs += arch_get_op_estimated_cost(node);
        }
 
        env->costs += costs * get_block_execfreq(env->execfreqs, block);
 }
 
-double be_estimate_irg_costs(ir_graph *irg, const arch_env_t *arch_env, ir_exec_freq *execfreqs)
+double be_estimate_irg_costs(ir_graph *irg, ir_exec_freq *execfreqs)
 {
        estimate_irg_costs_env_t env;
 
-       env.arch_env  = arch_env;
        env.execfreqs = execfreqs;
        env.costs     = 0.0;
 
@@ -158,8 +153,7 @@ double be_estimate_irg_costs(ir_graph *irg, const arch_env_t *arch_env, ir_exec_
 
 
 
-static const arch_env_t *arch_env;
-static be_node_stats_t  *stats;
+static be_node_stats_t *stats;
 
 static void node_stat_walker(ir_node *irn, void *data)
 {
@@ -173,7 +167,7 @@ static void node_stat_walker(ir_node *irn, void *data)
                        (*stats)[BE_STAT_PHIS]++;
                }
        } else {
-               arch_irn_class_t classify = arch_irn_classify(arch_env, irn);
+               arch_irn_class_t classify = arch_irn_classify(irn);
 
                if(classify & arch_irn_class_spill)
                        (*stats)[BE_STAT_SPILLS]++;
@@ -190,8 +184,7 @@ static void node_stat_walker(ir_node *irn, void *data)
 
 void be_collect_node_stats(be_node_stats_t *new_stats, be_irg_t *birg)
 {
-       arch_env = birg->main_env->arch_env;
-       stats    = new_stats;
+       stats = new_stats;
 
        memset(stats, 0, sizeof(*stats));
        irg_walk_graph(birg->irg, NULL, node_stat_walker, NULL);