X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbestat.c;h=b65552a5d0396415678d7c0fc0368e61c5f727b4;hb=5474a1c188c9d59eea2c915515980cd9cbab58d8;hp=df0ac3cecaa1509ad2474a9b05e67aed3a533553;hpb=ab182d4b9ed44239ab3ff1d08b2f8e14a3699ccf;p=libfirm diff --git a/ir/be/bestat.c b/ir/be/bestat.c index df0ac3cec..b65552a5d 100644 --- a/ir/be/bestat.c +++ b/ir/be/bestat.c @@ -1,5 +1,5 @@ /* - * 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. * @@ -21,7 +21,6 @@ * @file * @brief Provides several statistic functions for the backend. * @author Christian Wuerdig, Matthias Braun - * @version $Id$ */ #include "config.h" @@ -52,7 +51,7 @@ struct pressure_walker_env_t { be_lv_t *lv; double insn_count; double regpressure; - int max_pressure; + size_t max_pressure; const arch_register_class_t *cls; }; @@ -63,7 +62,7 @@ static void check_reg_pressure_class(pressure_walker_env_t *env, 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); @@ -71,7 +70,7 @@ static void check_reg_pressure_class(pressure_walker_env_t *env, env->regpressure += max_live; sched_foreach_reverse(block, irn) { - int cnt; + size_t cnt; if (is_Phi(irn)) break; @@ -86,15 +85,13 @@ static void check_reg_pressure_class(pressure_walker_env_t *env, 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); } @@ -108,7 +105,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; @@ -130,7 +127,7 @@ typedef struct 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; @@ -157,7 +154,7 @@ double be_estimate_irg_costs(ir_graph *irg, ir_exec_freq *execfreqs) 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)) { @@ -166,19 +163,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]++; } } @@ -208,19 +196,16 @@ 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"); } } 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]); } @@ -230,7 +215,7 @@ void be_emit_node_stats(be_node_stats_t *stats, const char *prefix) 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: @@ -252,8 +237,8 @@ unsigned long be_count_insns(ir_graph *irg) static void block_count_walker(ir_node *node, void *data) { - unsigned long *cnt = data; - if (node == get_irg_end_block(current_ir_graph)) + unsigned long *cnt = (unsigned long*)data; + if (node == get_irg_end_block(get_irn_irg(node))) return; (*cnt)++; }