X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fbe%2Fbestat.c;h=fbc8b6429b74d8d44cd2208589fb741a41464a95;hb=63e8a062a48c91aa36429576c648624f88dcfe35;hp=762658d7a1314c6adc1642a207beba3c6c8a23d4;hpb=342c533f49c734dd63afb07a92a8915156369c7d;p=libfirm diff --git a/ir/be/bestat.c b/ir/be/bestat.c index 762658d7a..fbc8b6429 100644 --- a/ir/be/bestat.c +++ b/ir/be/bestat.c @@ -21,7 +21,6 @@ * @file * @brief Provides several statistic functions for the backend. * @author Christian Wuerdig, Matthias Braun - * @version $Id$ */ #include "config.h" @@ -34,8 +33,8 @@ #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" @@ -60,10 +59,9 @@ static void check_reg_pressure_class(pressure_walker_env_t *env, 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); @@ -106,7 +104,7 @@ void be_do_stat_reg_pressure(ir_graph *irg, const arch_register_class_t *cls) 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; @@ -114,37 +112,33 @@ void be_do_stat_reg_pressure(ir_graph *irg, const arch_register_class_t *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); @@ -164,19 +158,10 @@ static void node_stat_walker(ir_node *irn, void *data) } else { (*stats)[BE_STAT_PHIS]++; } - } else if (!is_Proj(irn)) { - arch_irn_class_t classify = arch_irn_classify(irn); - - if (classify & arch_irn_class_spill) - (*stats)[BE_STAT_SPILLS]++; - if (classify & arch_irn_class_reload) - (*stats)[BE_STAT_RELOADS]++; - if (classify & arch_irn_class_remat) - (*stats)[BE_STAT_REMATS]++; - if (classify & arch_irn_class_copy) - (*stats)[BE_STAT_COPIES]++; - if (classify & arch_irn_class_perm) - (*stats)[BE_STAT_PERMS]++; + } else if (be_is_Perm(irn)) { + (*stats)[BE_STAT_PERMS]++; + } else if (be_is_Copy(irn)) { + (*stats)[BE_STAT_COPIES]++; } } @@ -206,9 +191,6 @@ static const char *get_stat_name(enum be_stat_tag_t tag) case BE_STAT_MEM_PHIS: return "mem_phis"; case BE_STAT_COPIES: return "copies"; case BE_STAT_PERMS: return "perms"; - case BE_STAT_SPILLS: return "spills"; - case BE_STAT_RELOADS: return "reloads"; - case BE_STAT_REMATS: return "remats"; default: panic("unknown stat tag found"); } } @@ -251,7 +233,7 @@ unsigned long be_count_insns(ir_graph *irg) 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)++; }