-/**
- * Collect reg pressure statistics per block and per class.
- */
-static void stat_reg_pressure_block(ir_node *block, void *data) {
- struct a_pressure_walker *env = data;
- be_irg_t *birg = env->birg;
- ir_graph *irg = be_get_birg_irg(birg);
- const arch_env_t *aenv = be_get_birg_arch_env(birg);
- int i, n = arch_isa_get_n_reg_class(aenv->isa);
-
- for (i = 0; i < n; i++) {
- const arch_register_class_t *cls = arch_isa_get_reg_class(aenv->isa, i);
- ir_node *irn;
- pset *live_nodes = pset_new_ptr(64);
- int max_live;
-
- live_nodes = be_liveness_end_of_block(env->lv, aenv, cls, block, live_nodes);
- max_live = pset_count(live_nodes);
-
- sched_foreach_reverse(block, irn) {
- int cnt;
-
- if(is_Phi(irn))
- break;
-
- live_nodes = be_liveness_transfer(aenv, cls, irn, live_nodes);
- cnt = pset_count(live_nodes);
- max_live = cnt < max_live ? max_live : cnt;
- }
-
- stat_be_block_regpressure(irg, block, max_live, cls->name);
- }
-}
-
-void be_do_stat_reg_pressure(be_irg_t *birg) {
- ir_graph *irg = be_get_birg_irg(birg);
-
- if (stat_is_active()) {
- struct a_pressure_walker w;
-
- w.birg = birg;
- w.lv = be_liveness(irg);
- /* Collect register pressure information for each block */
- irg_block_walk_graph(irg, stat_reg_pressure_block, NULL, &w);
- be_liveness_free(w.lv);
- }
-}
-
-/**
- * Notify statistic module about amount of ready nodes.
- */
-void be_do_stat_sched_ready(ir_node *block, const ir_nodeset_t *ready_set) {
- if (stat_is_active()) {
- stat_be_block_sched_ready(get_irn_irg(block), block, MIN(ir_nodeset_size(ready_set), 5));
- }
-}
-
-/**
- * Pass information about a perm to the statistic module.
- */
-void be_do_stat_perm(const char *class_name, int n_regs, ir_node *perm, ir_node *block, int n, int real_size) {
- if (stat_is_active()) {
- stat_be_block_stat_perm(class_name, n_regs, perm, block, n, real_size);
- }
-}
-
-/**
- * Pass information about a cycle or chain in a perm to the statistic module.
- */
-void be_do_stat_permcycle(const char *class_name, ir_node *perm, ir_node *block, int is_chain, int n_elems, int n_ops) {
- if (stat_is_active()) {
- stat_be_block_stat_permcycle(class_name, perm, block, is_chain, n_elems, n_ops);
+static void check_reg_pressure_class(pressure_walker_env_t *env,
+ ir_node *block,
+ const arch_register_class_t *cls)
+{
+ ir_graph *irg = env->irg;
+ ir_node *irn;
+ ir_nodeset_t live_nodes;
+ size_t max_live;
+
+ ir_nodeset_init(&live_nodes);
+ be_liveness_end_of_block(env->lv, cls, block, &live_nodes);
+ max_live = ir_nodeset_size(&live_nodes);
+ env->regpressure += max_live;
+
+ sched_foreach_reverse(block, irn) {
+ size_t cnt;
+
+ if (is_Phi(irn))
+ break;
+
+ be_liveness_transfer(cls, irn, &live_nodes);
+ cnt = ir_nodeset_size(&live_nodes);
+ max_live = cnt < max_live ? max_live : cnt;
+ env->regpressure += cnt;
+ env->insn_count++;