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"
24 #define MIN(a, b) (a < b ? a : b)
27 * Collect reg pressure statistics per block and per class.
29 static void stat_reg_pressure_block(ir_node *block, void *env) {
31 const arch_env_t *aenv = birg->main_env->arch_env;
32 int i, n = arch_isa_get_n_reg_class(aenv->isa);
34 for (i = 0; i < n; i++) {
35 const arch_register_class_t *cls = arch_isa_get_reg_class(aenv->isa, i);
37 pset *live_nodes = pset_new_ptr(64);
40 live_nodes = be_liveness_end_of_block(aenv, cls, block, live_nodes);
41 max_live = pset_count(live_nodes);
43 sched_foreach_reverse(block, irn) {
46 live_nodes = be_liveness_transfer(aenv, cls, irn, live_nodes);
47 cnt = pset_count(live_nodes);
49 max_live = cnt < max_live ? max_live : cnt;
52 stat_be_block_regpressure(birg->irg, block, max_live, cls->name);
56 void be_do_stat_reg_pressure(be_irg_t *birg) {
57 /* Collect register pressure information for each block */
58 irg_block_walk_graph(birg->irg, stat_reg_pressure_block, NULL, birg);
62 * Notify statistic module about amount of ready nodes.
64 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set) {
65 stat_be_block_sched_ready(get_irn_irg(block), block, nodeset_count(ready_set));
70 void (be_do_stat_reg_pressure)(be_irg_t *birg) {}
71 void (be_do_stat_sched_ready)(ir_node *block, nodeset *ready_set) {}
73 #endif /* FIRM_STATISTICS */