+static void lower_print_perm_stat(lower_env_t *env) {
+ int i, j, total_len_chain, total_len_cycle, total_size_perm, total_size_real_perm;
+
+ printf("=== IRG: %s ===\n", get_entity_name(get_irg_entity(env->chord_env->irg)));
+ for (i = 0; i < env->pstat_n; i++) {
+ if (env->pstat[i]->num_perms == 0)
+ continue;
+
+ printf("CLASS: %s\n", env->pstat[i]->cls->name);
+ printf("# total perms: %d (size:num -> 1:%d", env->pstat[i]->num_perms, env->pstat[i]->perm_size_ar[0]);
+
+ total_size_perm = env->pstat[i]->perm_size_ar[0];
+ for (j = 1; j < env->pstat[i]->cls->n_regs; j++) {
+ total_size_perm += (j + 1) * env->pstat[i]->perm_size_ar[j];
+ printf(", %d:%d", j + 1, env->pstat[i]->perm_size_ar[j]);
+ }
+ printf(")\n");
+ printf("avg perm size: %.2f\n", env->pstat[i]->num_perms ? (float)total_size_perm / (float)env->pstat[i]->num_perms : 0);
+
+ printf("# real perms: %d (size:num -> 1:%d", env->pstat[i]->num_real_perms, env->pstat[i]->real_perm_size_ar[0]);
+
+ total_size_real_perm = env->pstat[i]->real_perm_size_ar[0];
+ for (j = 1; j < env->pstat[i]->cls->n_regs; j++) {
+ total_size_real_perm += (j + 1) * env->pstat[i]->real_perm_size_ar[j];
+ printf(", %d:%d", j + 1, env->pstat[i]->real_perm_size_ar[j]);
+ }
+ printf(")\n");
+ printf("avg real perm size: %.2f\n", env->pstat[i]->num_real_perms ? (float)total_size_real_perm / (float)env->pstat[i]->num_real_perms : 0);
+
+ printf("# total chains: %d (lenght:num -> 1:%d", env->pstat[i]->num_chains, env->pstat[i]->chain_len_ar[0]);
+
+ total_len_chain = env->pstat[i]->chain_len_ar[0];
+
+ for (j = 1; j < env->pstat[i]->cls->n_regs; j++) {
+ total_len_chain += (j + 1) * env->pstat[i]->chain_len_ar[j];
+ printf(", %d:%d", j + 1, env->pstat[i]->chain_len_ar[j]);
+ }
+ printf(")\n");
+ printf("avg chain length: %.2f\n", env->pstat[i]->num_chains ? (float)total_len_chain / (float)env->pstat[i]->num_chains : 0);
+ printf("avg chains/perm: %.2f\n", env->pstat[i]->num_real_perms ? (float)env->pstat[i]->num_chains / (float)env->pstat[i]->num_real_perms : 0);
+
+ printf("# total cycles: %d (length:num -> 1:%d", env->pstat[i]->num_cycles, env->pstat[i]->cycle_len_ar[0]);
+
+ total_len_cycle = env->pstat[i]->cycle_len_ar[0];
+ for (j = 1; j < env->pstat[i]->cls->n_regs; j++) {
+ total_len_cycle += (j + 1) * env->pstat[i]->cycle_len_ar[j];
+ printf(", %d:%d", j + 1, env->pstat[i]->cycle_len_ar[j]);
+ }
+ printf(")\n");
+ printf("avg cycle length: %.2f\n", env->pstat[i]->num_cycles ? (float)total_len_cycle / (float)env->pstat[i]->num_cycles : 0);
+ printf("avg cycles/perm: %.2f\n", env->pstat[i]->num_real_perms ? (float)env->pstat[i]->num_cycles / (float)env->pstat[i]->num_real_perms : 0);
+ }
+}
+