/*
- * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
typedef struct pressure_walker_env_t pressure_walker_env_t;
struct pressure_walker_env_t {
- be_irg_t *birg;
+ ir_graph *irg;
be_lv_t *lv;
double insn_count;
double regpressure;
- int max_pressure;
+ size_t max_pressure;
const arch_register_class_t *cls;
};
ir_node *block,
const arch_register_class_t *cls)
{
- be_irg_t *birg = env->birg;
- ir_graph *irg = be_get_birg_irg(birg);
+ ir_graph *irg = env->irg;
ir_node *irn;
ir_nodeset_t live_nodes;
- int max_live;
+ size_t max_live;
ir_nodeset_init(&live_nodes);
be_liveness_end_of_block(env->lv, cls, block, &live_nodes);
env->regpressure += max_live;
sched_foreach_reverse(block, irn) {
- int cnt;
+ size_t cnt;
if (is_Phi(irn))
break;
if (max_live > env->max_pressure)
env->max_pressure = max_live;
-#ifdef FIRM_STATISTICS
stat_be_block_regpressure(irg, block, max_live, cls->name);
-#endif
ir_nodeset_destroy(&live_nodes);
}
static void stat_reg_pressure_block(ir_node *block, void *data)
{
- pressure_walker_env_t *env = data;
+ pressure_walker_env_t *env = (pressure_walker_env_t*)data;
check_reg_pressure_class(env, block, env->cls);
}
-void be_do_stat_reg_pressure(be_irg_t *birg, const arch_register_class_t *cls)
+void be_do_stat_reg_pressure(ir_graph *irg, const arch_register_class_t *cls)
{
pressure_walker_env_t env;
- ir_graph *irg = be_get_birg_irg(birg);
double average_pressure;
- env.birg = birg;
+ env.irg = irg;
env.insn_count = 0;
env.max_pressure = 0;
env.regpressure = 0;
-typedef struct _estimate_irg_costs_env_t {
+typedef struct estimate_irg_costs_env_t {
ir_exec_freq *execfreqs;
double costs;
} estimate_irg_costs_env_t;
static void estimate_block_costs(ir_node *block, void *data)
{
- estimate_irg_costs_env_t *env = data;
+ estimate_irg_costs_env_t *env = (estimate_irg_costs_env_t*)data;
ir_node *node;
double costs = 0.0;
static void node_stat_walker(ir_node *irn, void *data)
{
- be_node_stats_t *const stats = data;
+ be_node_stats_t *const stats = (be_node_stats_t*)data;
/* if the node is a normal phi */
if (is_Phi(irn)) {
}
}
-void be_collect_node_stats(be_node_stats_t *new_stats, be_irg_t *birg)
+void be_collect_node_stats(be_node_stats_t *new_stats, ir_graph *irg)
{
memset(new_stats, 0, sizeof(*new_stats));
- irg_walk_graph(birg->irg, NULL, node_stat_walker, new_stats);
+ irg_walk_graph(irg, NULL, node_stat_walker, new_stats);
}
void be_subtract_node_stats(be_node_stats_t *stats, be_node_stats_t *sub)
void be_emit_node_stats(be_node_stats_t *stats, const char *prefix)
{
- static char buf[256];
- int i;
+ static char buf[256];
+ be_stat_tag_t i;
- for (i = 0; i < BE_STAT_COUNT; ++i) {
+ for (i = BE_STAT_FIRST; i < BE_STAT_COUNT; ++i) {
snprintf(buf, sizeof(buf), "%s%s", prefix, get_stat_name(i));
stat_ev_dbl(buf, (*stats)[i]);
}
static void insn_count_walker(ir_node *irn, void *data)
{
- unsigned long *cnt = data;
+ unsigned long *cnt = (unsigned long*)data;
switch (get_irn_opcode(irn)) {
case iro_Proj:
static void block_count_walker(ir_node *node, void *data)
{
- unsigned long *cnt = data;
+ unsigned long *cnt = (unsigned long*)data;
if (node == get_irg_end_block(current_ir_graph))
return;
(*cnt)++;