moved reg pressure statistics into sepearete be_block_hash
[libfirm] / ir / stat / stat_dmp.c
index ea14eb5..a2ded6d 100644 (file)
@@ -82,6 +82,11 @@ static const struct {
   { FS_BE_IA32_AM_S,       "ia32 Backend transformation: Source address mode node created" },
   { FS_BE_IA32_AM_D,       "ia32 Backend transformation: Destination address mode node created" },
   { FS_BE_IA32_CJMP,       "ia32 Backend transformation: CJmp created to save a cmp/test" },
+  { FS_BE_IA32_2ADDRCPY,   "ia32 Backend transformation: Copy created due to 2-Addresscode constraints" },
+  { FS_BE_IA32_SPILL2ST,   "ia32 Backend transformation: Created Store for a Spill" },
+  { FS_BE_IA32_RELOAD2LD,  "ia32 Backend transformation: Created Load for a Reload" },
+  { FS_BE_IA32_SUB2NEGADD, "ia32 Backend transformation: Created Neg-Add for a Sub due to 2-Addresscode constraints" },
+  { FS_BE_IA32_LEA2ADD,    "ia32 Backend transformation: Transformed Lea back into Add" },
 };
 
 static const char *if_conv_names[IF_RESULT_LAST] = {
@@ -143,6 +148,44 @@ static void simple_dump_opt_hash(dumper_t *dmp, pset *set, int index)
   }
 }
 
+/**
+ * dumps the register pressure for each block and for each register class
+ */
+static void simple_dump_be_block_reg_pressure(dumper_t *dmp, graph_entry_t *entry) {
+  be_block_entry_t *b_entry = pset_first(entry->be_block_hash);
+  reg_pressure_entry_t *rp_entry;
+
+  /* return if no reg pressure information available */
+  if (! b_entry)
+         return;
+
+  /* print table head (register classes) */
+  fprintf(dmp->f, "\nREG PRESSURE:\n");
+  fprintf(dmp->f, "%12s", "Block Nr");
+  for (rp_entry = pset_first(b_entry->reg_pressure);
+       rp_entry;
+          rp_entry = pset_next(b_entry->reg_pressure))
+  {
+    fprintf(dmp->f, "%15s", get_id_str(rp_entry->id_name));
+  }
+  fprintf(dmp->f, "\n");
+
+  /* print the reg pressure for all blocks and register classes */
+  for (/* b_entry is already initialized */ ;
+       b_entry;
+          b_entry = pset_next(entry->be_block_hash))
+  {
+       fprintf(dmp->f, "BLK   %6ld", b_entry->block_nr);
+       for (rp_entry = pset_first(b_entry->reg_pressure);
+            rp_entry;
+                rp_entry = pset_next(b_entry->reg_pressure))
+       {
+      fprintf(dmp->f, "%15d", rp_entry->pressure);
+       }
+    fprintf(dmp->f, "\n");
+  }
+}
+
 /**
  * dumps the number of real_function_call optimization
  */
@@ -209,27 +252,27 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry)
     }
 
     fprintf(dmp->f, " %swalked %u over blocks %u:\n"
-                    " was inlined               : %u\n"
-                   " got inlined               : %u\n"
-                   " strength red              : %u\n"
-                   " leaf function             : %s\n"
-                   " calls only leaf functions : %s\n"
-                   " recursive                 : %s\n"
-                   " chain call                : %s\n"
+               " was inlined               : %u\n"
+               " got inlined               : %u\n"
+               " strength red              : %u\n"
+               " leaf function             : %s\n"
+               " calls only leaf functions : %s\n"
+               " recursive                 : %s\n"
+               " chain call                : %s\n"
         " calls                     : %u\n"
         " indirect calls            : %u\n",
         entry->is_deleted ? "DELETED " : "",
         entry->cnt_walked.cnt[0], entry->cnt_walked_blocks.cnt[0],
         entry->cnt_was_inlined.cnt[0],
         entry->cnt_got_inlined.cnt[0],
-             entry->cnt_strength_red.cnt[0],
-             entry->is_leaf ? "YES" : "NO",
-             entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"),
-             entry->is_recursive ? "YES" : "NO",
-             entry->is_chain_call ? "YES" : "NO",
+               entry->cnt_strength_red.cnt[0],
+               entry->is_leaf ? "YES" : "NO",
+               entry->is_leaf_call == LCS_NON_LEAF_CALL ? "NO" : (entry->is_leaf_call == LCS_LEAF_CALL ? "Yes" : "Maybe"),
+               entry->is_recursive ? "YES" : "NO",
+               entry->is_chain_call ? "YES" : "NO",
         entry->cnt_all_calls.cnt[0],
         entry->cnt_indirect_calls.cnt[0]
-    );
+       );
 
     for (i = 0; i < sizeof(entry->cnt_if_conv)/sizeof(entry->cnt_if_conv[0]); ++i) {
       fprintf(dmp->f, " %s : %u\n", if_conv_names[i], entry->cnt_if_conv[i].cnt[0]);
@@ -272,6 +315,9 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry)
       );
     }
 
+    /* dump block reg pressure */
+       simple_dump_be_block_reg_pressure(dmp, entry);
+
     if (dmp->status->stat_options & FIRMSTAT_COUNT_EXTBB) {
       /* dump extended block info */
       fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Extbb Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot");