11 #include "dbginfo_t.h"
20 #define MIN(a, b) (a < b ? a : b)
23 * Collect reg pressure statistics per block and per class.
25 static void stat_reg_pressure_block(ir_node *block, void *env) {
27 const arch_env_t *aenv = birg->main_env->arch_env;
28 int i, n = arch_isa_get_n_reg_class(aenv->isa);
30 for (i = 0; i < n; i++) {
31 const arch_register_class_t *cls = arch_isa_get_reg_class(aenv->isa, i);
33 pset *live_nodes = pset_new_ptr(64);
36 live_nodes = be_liveness_end_of_block(aenv, cls, block, live_nodes);
37 max_live = pset_count(live_nodes);
39 sched_foreach_reverse(block, irn) {
42 live_nodes = be_liveness_transfer(aenv, cls, irn, live_nodes);
43 cnt = pset_count(live_nodes);
45 max_live = cnt < max_live ? max_live : cnt;
48 hook_be_block_regpressure(block, birg->irg, max_live, new_id_from_str(cls->name));
52 void be_do_stat_reg_pressure(be_irg_t *birg) {
53 /* Collect register pressure information for each block */
54 irg_block_walk_graph(birg->irg, stat_reg_pressure_block, NULL, birg);
58 * Notify statistic module about amount of ready nodes.
60 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set) {
61 hook_be_block_sched_ready(block, get_irn_irg(block), MIN(nodeset_count(ready_set), 5));
66 void (be_do_stat_reg_pressure)(be_irg_t *birg) {}
67 void (be_do_stat_sched_ready)(ir_node *block, nodeset *ready_set) {}
69 #endif /* FIRM_STATISTICS */