/*
- * Copyright (C) 1995-2011 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.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
#include "execfreq.h"
#include "firmstat_t.h"
#include "irtools.h"
-#include "statev.h"
#include "error.h"
+#include "statev_t.h"
#include "bearch.h"
#include "beirg.h"
ir_node *block,
const arch_register_class_t *cls)
{
- ir_graph *irg = env->irg;
- ir_node *irn;
- ir_nodeset_t live_nodes;
- size_t max_live;
+ ir_graph *irg = env->irg;
+ ir_nodeset_t live_nodes;
+ size_t max_live;
ir_nodeset_init(&live_nodes);
be_liveness_end_of_block(env->lv, cls, block, &live_nodes);
env.insn_count = 0;
env.max_pressure = 0;
env.regpressure = 0;
- be_liveness_assure_sets(be_assure_liveness(irg));
+ be_assure_live_sets(irg);
env.lv = be_get_irg_liveness(irg);
env.cls = cls;
irg_block_walk_graph(irg, stat_reg_pressure_block, NULL, &env);
average_pressure = env.regpressure / env.insn_count;
- stat_ev_emit("bechordal_average_register_pressure", average_pressure);
- stat_ev_emit("bechordal_maximum_register_pressure", env.max_pressure);
+ stat_ev_dbl("bechordal_average_register_pressure", average_pressure);
+ stat_ev_dbl("bechordal_maximum_register_pressure", env.max_pressure);
}
typedef struct estimate_irg_costs_env_t {
- ir_exec_freq *execfreqs;
- double costs;
+ double costs;
} estimate_irg_costs_env_t;
static void estimate_block_costs(ir_node *block, void *data)
{
estimate_irg_costs_env_t *env = (estimate_irg_costs_env_t*)data;
- ir_node *node;
- double costs = 0.0;
+ double costs = 0.0;
sched_foreach(block, node) {
costs += arch_get_op_estimated_cost(node);
}
- env->costs += costs * get_block_execfreq(env->execfreqs, block);
+ env->costs += costs * get_block_execfreq(block);
}
-double be_estimate_irg_costs(ir_graph *irg, ir_exec_freq *execfreqs)
+double be_estimate_irg_costs(ir_graph *irg)
{
estimate_irg_costs_env_t env;
-
- env.execfreqs = execfreqs;
- env.costs = 0.0;
+ env.costs = 0.0;
irg_block_walk_graph(irg, estimate_block_costs, NULL, &env);
static void block_count_walker(ir_node *node, void *data)
{
unsigned long *cnt = (unsigned long*)data;
- if (node == get_irg_end_block(current_ir_graph))
+ if (node == get_irg_end_block(get_irn_irg(node)))
return;
(*cnt)++;
}