Commit 1f3408aa authored by Matthias Braun's avatar Matthias Braun
Browse files

output register pressure in register class context

[r22336]
parent 69571e6a
...@@ -501,6 +501,10 @@ static void be_ra_chordal_main(be_irg_t *birg) ...@@ -501,6 +501,10 @@ static void be_ra_chordal_main(be_irg_t *birg)
stat_ev_ctx_push_str("bechordal_cls", cls->name); stat_ev_ctx_push_str("bechordal_cls", cls->name);
stat_ev_if {
be_do_stat_reg_pressure(birg, cls);
}
memcpy(&pse.cenv, &chordal_env, sizeof(chordal_env)); memcpy(&pse.cenv, &chordal_env, sizeof(chordal_env));
pse.birg = birg; pse.birg = birg;
pre_spill(&pse, cls); pre_spill(&pse, cls);
......
...@@ -757,11 +757,6 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) ...@@ -757,11 +757,6 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
be_sched_vrfy(birg, be_options.vrfy_option); be_sched_vrfy(birg, be_options.vrfy_option);
BE_TIMER_POP(t_verify); BE_TIMER_POP(t_verify);
/* do some statistics */
stat_ev_if {
be_do_stat_reg_pressure(birg);
}
#ifdef FIRM_STATISTICS #ifdef FIRM_STATISTICS
stat_ev_dbl("bemain_costs_before_ra", be_estimate_irg_costs(irg, arch_env, birg->exec_freq)); stat_ev_dbl("bemain_costs_before_ra", be_estimate_irg_costs(irg, arch_env, birg->exec_freq));
#endif #endif
......
...@@ -165,23 +165,10 @@ static void check_reg_pressure_class(pressure_walker_env_t *env, ...@@ -165,23 +165,10 @@ static void check_reg_pressure_class(pressure_walker_env_t *env,
static void stat_reg_pressure_block(ir_node *block, void *data) { static void stat_reg_pressure_block(ir_node *block, void *data) {
pressure_walker_env_t *env = data; pressure_walker_env_t *env = data;
if(env->cls != NULL) { check_reg_pressure_class(env, block, env->cls);
check_reg_pressure_class(env, block, env->cls);
} else {
const arch_env_t *arch_env = be_get_birg_arch_env(env->birg);
int i, n;
n = arch_env_get_n_reg_class(arch_env);
for (i = 0; i < n; i++) {
const arch_register_class_t *cls
= arch_env_get_reg_class(arch_env, i);
check_reg_pressure_class(env, block, cls);
}
}
} }
void be_do_stat_reg_pressure(be_irg_t *birg) { void be_do_stat_reg_pressure(be_irg_t *birg, const arch_register_class_t *cls) {
pressure_walker_env_t env; pressure_walker_env_t env;
ir_graph *irg = be_get_birg_irg(birg); ir_graph *irg = be_get_birg_irg(birg);
double average_pressure; double average_pressure;
...@@ -192,20 +179,14 @@ void be_do_stat_reg_pressure(be_irg_t *birg) { ...@@ -192,20 +179,14 @@ void be_do_stat_reg_pressure(be_irg_t *birg) {
env.regpressure = 0; env.regpressure = 0;
be_liveness_assure_sets(be_assure_liveness(birg)); be_liveness_assure_sets(be_assure_liveness(birg));
env.lv = be_get_birg_liveness(birg); env.lv = be_get_birg_liveness(birg);
env.cls = cls;
// hack for now, TODO: remove me later
#if 0
env.cls = NULL;
#else
env.cls = arch_env_get_reg_class(be_get_birg_arch_env(birg), 2);
#endif
/* Collect register pressure information for each block */ /* Collect register pressure information for each block */
irg_block_walk_graph(irg, stat_reg_pressure_block, NULL, &env); irg_block_walk_graph(irg, stat_reg_pressure_block, NULL, &env);
average_pressure = env.regpressure / env.insn_count; average_pressure = env.regpressure / env.insn_count;
stat_ev_emit("bemain_average_register_pressure", average_pressure); stat_ev_emit("bechordal_average_register_pressure", average_pressure);
stat_ev_emit("bemain_maximum_register_pressure", env.max_pressure); stat_ev_emit("bechordal_maximum_register_pressure", env.max_pressure);
} }
/** /**
......
...@@ -53,7 +53,7 @@ extern const char *be_stat_tags[STAT_TAG_LAST]; ...@@ -53,7 +53,7 @@ extern const char *be_stat_tags[STAT_TAG_LAST];
* Collects statistics information about register pressure. * Collects statistics information about register pressure.
* @param birg The be irg object containing the irg * @param birg The be irg object containing the irg
*/ */
void be_do_stat_reg_pressure(be_irg_t *birg); void be_do_stat_reg_pressure(be_irg_t *birg, const arch_register_class_t *cls);
/** /**
* Collect statistics about amount of ready nodes per block * Collect statistics about amount of ready nodes per block
...@@ -106,7 +106,7 @@ void be_close_stat_file(void); ...@@ -106,7 +106,7 @@ void be_close_stat_file(void);
#define be_stat_init_irg(arch_env, irg) #define be_stat_init_irg(arch_env, irg)
#define be_do_stat_nodes(irg, phase) #define be_do_stat_nodes(irg, phase)
#define be_do_stat_reg_pressure(birg) #define be_do_stat_reg_pressure(birg,cls)
#define be_do_stat_sched_ready(block, ready_set) #define be_do_stat_sched_ready(block, ready_set)
#define be_do_stat_perm(class_name, n_regs, perm, block, n, real_size) #define be_do_stat_perm(class_name, n_regs, perm, block, n, real_size)
#define be_do_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops) #define be_do_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment