14 #define MIN(a, b) (a < b ? a : b)
17 * Collect reg pressure statistics per block and per class.
19 static void stat_reg_pressure_block(ir_node *block, void *env) {
21 const arch_env_t *aenv = birg->main_env->arch_env;
22 int i, n = arch_isa_get_n_reg_class(aenv->isa);
24 for (i = 0; i < n; i++) {
25 const arch_register_class_t *cls = arch_isa_get_reg_class(aenv->isa, i);
27 pset *live_nodes = pset_new_ptr(64);
30 live_nodes = be_liveness_end_of_block(aenv, cls, block, live_nodes);
31 max_live = pset_count(live_nodes);
33 sched_foreach_reverse(block, irn) {
36 live_nodes = be_liveness_transfer(aenv, cls, irn, live_nodes);
37 cnt = pset_count(live_nodes);
39 max_live = cnt < max_live ? max_live : cnt;
42 hook_be_block_regpressure(block, birg->irg, max_live, new_id_from_str(cls->name));
46 void be_do_stat_reg_pressure(be_irg_t *birg) {
47 /* Collect register pressure information for each block */
48 irg_block_walk_graph(birg->irg, stat_reg_pressure_block, NULL, birg);
52 * Notify statistic module about amount of ready nodes.
54 void be_do_stat_sched_ready(ir_node *block, nodeset *ready_set) {
55 hook_be_block_sched_ready(block, get_irn_irg(block), MIN(nodeset_count(ready_set), 5));