+ if (stat_is_active()) {
+ stat_be_block_sched_ready(get_irn_irg(block), block, MIN(nodeset_count(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);
+ }
+}
+
+/**
+ * Updates nodes statistics.
+ */
+static void do_nodes_stat(ir_node *irn, void *env) {
+ be_stat_phase_t *phase = env;
+ ir_mode *mode;
+ opcode opc;
+ arch_irn_class_t irn_class;
+
+ if (is_Block(irn))
+ return;
+
+ mode = get_irn_mode(irn);
+ opc = get_irn_opcode(irn);
+
+ phase->num_nodes++;
+
+ /* check for nodes we want to ignore */
+ if (be_is_Keep(irn) ||
+ be_is_CopyKeep(irn) ||
+ opc == iro_Start ||
+ opc == iro_End)
+ return;
+
+ if (is_Proj(irn) && (mode != mode_X)) {
+ phase->num_proj++;
+ return;
+ }
+ else if (is_Phi(irn)) {
+ phase->num_phi++;
+ return;
+ }
+ else if (mode_is_datab(mode) || ((mode == mode_T) && ! is_be_node(irn)) || (is_Proj(irn) && (mode == mode_X)))
+ phase->num_data++;
+
+ if (opc == iro_Load)
+ phase->num_load++;
+ else if (opc == iro_Store)
+ phase->num_store++;
+
+ irn_class = arch_irn_classify(phase->arch_env, irn);
+ if (irn_class & arch_irn_class_spill)
+ phase->num_spill++;
+ else if (irn_class & arch_irn_class_reload)
+ phase->num_reload++;
+ else if (irn_class & arch_irn_class_stackparam)
+ phase->num_load++;
+ else if (irn_class & arch_irn_class_load)
+ phase->num_load++;
+ else if (irn_class & arch_irn_class_store)
+ phase->num_store++;
+}
+
+/**
+ * Collects node statistics.
+ *
+ * @param irg the to do statistics for
+ * @param phase the phase to collect the statistic for
+ */
+void be_do_stat_nodes(ir_graph *irg, const char *phase) {
+ be_stat_irg_t *irg_entry;
+ be_stat_phase_t *phase_entry, phase_key;
+
+ irg_entry = find_stat_irg_entry(irg);
+
+ if (! irg_entry)
+ return;
+
+ phase_key.phase = phase;
+ phase_entry = pset_find_ptr(irg_entry->phases, &phase_key);
+
+ if (! phase_entry) {
+ phase_entry = obstack_alloc(&irg_entry->obst, sizeof(*phase_entry));
+ phase_entry = pset_insert(irg_entry->phases, phase_entry, HASH_PTR(phase));
+ }
+ memset(phase_entry, 0, sizeof(*phase_entry));
+
+ phase_entry->phase = phase;
+ phase_entry->arch_env = irg_entry->arch_env;
+
+ irg_walk_blkwise_graph(irg_entry->irg, NULL, do_nodes_stat, phase_entry);