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 if (stat_is_active()) {
56 be_liveness(birg->irg);
57 /* Collect register pressure information for each block */
58 irg_block_walk_graph(birg->irg, stat_reg_pressure_block, NULL, birg);
63 * Notify statistic module about amount of ready nodes.
65 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set) {
66 if (stat_is_active()) {
67 stat_be_block_sched_ready(get_irn_irg(block), block, nodeset_count(ready_set));
72 * Pass information about a perm to the statistic module.
74 void be_do_stat_perm(const char *class_name, int n_regs, ir_node *perm, ir_node *block, int n, int real_size) {
75 if (stat_is_active()) {
76 stat_be_block_stat_perm(class_name, n_regs, perm, block, n, real_size);
81 * Pass information about a cycle or chain in a perm to the statistic module.
83 void be_do_stat_permcycle(const char *class_name, ir_node *perm, ir_node *block, int is_chain, int n_elems, int n_ops) {
84 if (stat_is_active()) {
85 stat_be_block_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops);
91 void (be_do_stat_reg_pressure)(be_irg_t *birg) {}
92 void (be_do_stat_sched_ready)(ir_node *block, nodeset *ready_set) {}
93 void (be_do_stat_perm)(const char *class_name, int n_regs, ir_node *perm, ir_node *block, int n, int real_size) {}
95 #endif /* FIRM_STATISTICS */