2 * This file calls the corresponding statistic functions for
3 * some backend statistics.
10 #ifdef FIRM_STATISTICS
16 #include "dbginfo_t.h"
17 #include "firmstat_t.h"
25 * Collect reg pressure statistics per block and per class.
27 static void stat_reg_pressure_block(ir_node *block, void *env) {
29 const arch_env_t *aenv = birg->main_env->arch_env;
30 int i, n = arch_isa_get_n_reg_class(aenv->isa);
32 for (i = 0; i < n; i++) {
33 const arch_register_class_t *cls = arch_isa_get_reg_class(aenv->isa, i);
35 pset *live_nodes = pset_new_ptr(64);
38 live_nodes = be_liveness_end_of_block(aenv, cls, block, live_nodes);
39 max_live = pset_count(live_nodes);
41 sched_foreach_reverse(block, irn) {
44 live_nodes = be_liveness_transfer(aenv, cls, irn, live_nodes);
45 cnt = pset_count(live_nodes);
47 max_live = cnt < max_live ? max_live : cnt;
50 stat_be_block_regpressure(birg->irg, block, MIN(max_live, 5), cls->name);
54 void be_do_stat_reg_pressure(be_irg_t *birg) {
55 /* Collect register pressure information for each block */
56 irg_block_walk_graph(birg->irg, stat_reg_pressure_block, NULL, birg);
60 * Notify statistic module about amount of ready nodes.
62 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set) {
63 stat_be_block_sched_ready(get_irn_irg(block), block, nodeset_count(ready_set));
68 void (be_do_stat_reg_pressure)(be_irg_t *birg) {}
69 void (be_do_stat_sched_ready)(ir_node *block, nodeset *ready_set) {}
71 #endif /* FIRM_STATISTICS */