more verbose dumper,
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 15 Apr 2005 12:21:33 +0000 (12:21 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 15 Apr 2005 12:21:33 +0000 (12:21 +0000)
made stuff used in cacheopt visible.

[r5699]

ir/ir/irdump.c
ir/ir/irdump.h
ir/ir/irdump_t.h
ir/ir/irdumptxt.c

index c1ee24c..741ee3a 100644 (file)
@@ -671,9 +671,23 @@ dump_node_nodeattr(FILE *F, ir_node *n)
   return bad;
 }
 
+#include <math.h>
+#include "execution_frequency.h"
+#include "callgraph.h"
+
+void dump_node_ana_vals(FILE *F, ir_node *n) {
+  return;
+  fprintf(F, " %lf*(%2.0lf + %2.0lf) = %2.0lf ",
+         get_irn_exec_freq(n),
+         get_irg_method_execution_frequency(get_irn_irg(n)),
+         pow(5, get_irg_recursion_depth(get_irn_irg(n))),
+         get_irn_exec_freq(n) * (get_irg_method_execution_frequency(get_irn_irg(n)) + pow(5, get_irg_recursion_depth(get_irn_irg(n))))
+         );
+}
+
 
-/** Dumps a node label without the enclosing ". */
-static int dump_node_label(FILE *F, ir_node *n) {
+/* Dumps a node label without the enclosing ". */
+int dump_node_label(FILE *F, ir_node *n) {
   int bad = 0;
 
   bad |= dump_node_opcode(F, n);
@@ -847,6 +861,7 @@ static void dump_node(FILE *F, ir_node *n)
 
   bad = ! irn_vrfy_irg_dump(n, current_ir_graph, &p);
   bad |= dump_node_label(F, n);
+  dump_node_ana_vals(F, n);
   //dump_node_ana_info(F, n);
   fprintf(F, "\" ");
   bad |= dump_node_info(F, n);
@@ -1225,7 +1240,7 @@ static void dump_node2type_edges(ir_node *n, void *env)
   }
 }
 
-
+#if 0
 static int print_type_info(FILE *F, type *tp) {
   int bad = 0;
 
@@ -1274,7 +1289,7 @@ static void print_typespecific_info(FILE *F, type *tp) {
   default: break;
   } /* switch type */
 }
-
+#endif
 
 static void print_typespecific_vcgattr(FILE *F, type *tp) {
   switch (get_type_tpop_code(tp)) {
@@ -1311,6 +1326,8 @@ static void print_typespecific_vcgattr(FILE *F, type *tp) {
   } /* switch type */
 }
 
+
+/* Why not dump_type_node as the others? */
 static int print_type_node(FILE *F, type *tp)
 {
   int bad = 0;
@@ -1319,8 +1336,12 @@ static int print_type_node(FILE *F, type *tp)
   PRINT_TYPEID(tp);
   fprintf (F, " label: \"%s %s\"", get_type_tpop_name(tp), get_type_name_ex(tp, &bad));
   fprintf (F, " info1: \"");
+#if 0
   bad |= print_type_info(F, tp);
   print_typespecific_info(F, tp);
+#else
+  dump_type_to_file(F, tp, dump_verbosity_max);
+#endif
   fprintf (F, "\"");
   print_typespecific_vcgattr(F, tp);
   fprintf (F, "}\n");
@@ -1328,6 +1349,11 @@ static int print_type_node(FILE *F, type *tp)
   return bad;
 }
 
+int dump_type_node(FILE *F, type *tp) {
+  return print_type_node(F, tp);
+}
+
+
 #define X(a)    case a: fprintf(F, #a); break
 void dump_entity_node(FILE *F, entity *ent, int color)
 {
@@ -1983,25 +2009,36 @@ dump_block_to_cfg(ir_node *block, void *env) {
     PRINT_NODEID(block);
     fprintf (F, "\" ");
     fprintf(F, "info1:\"");
+
+#if 0
     if (dump_dominator_information_flag) {
       fprintf(F, "dom depth %d\n", get_Block_dom_depth(block));
       fprintf(F, "tree pre num %d\n", get_Block_dom_tree_pre_num(block));
       fprintf(F, "max subtree pre num %d\n", get_Block_dom_max_subtree_pre_num(block));
-               }
+    }
 
     /* show arity and possible Bad predecessors of the block */
     fprintf(F, "arity: %d\n", get_Block_n_cfgpreds(block));
     for (fl = i = 0; i < get_Block_n_cfgpreds(block); ++i) {
       ir_node *pred = get_Block_cfgpred(block, i);
       if (is_Bad(pred)) {
-    if (! fl)
-      fprintf(F, "Bad pred at pos: ");
-    fprintf(F, "%d ", i);
-    fl = 1;
+       if (! fl)
+         fprintf(F, "Bad pred at pos: ");
+       fprintf(F, "%d ", i);
+       fl = 1;
       }
     }
     if (fl)
       fprintf(F, "\n");
+#else
+    /* the generic version. */
+    dump_irnode_to_file(F, block);
+
+    /* Check whether we have bad predecessors to color the block. */
+    for (i = 0; i < get_Block_n_cfgpreds(block); ++i)
+      if ((fl = is_Bad(get_Block_cfgpred(block, i))))
+       break;
+#endif
 
     fprintf (F, "\"");  /* closing quote of info */
 
index 9d0dab0..969e21e 100644 (file)
@@ -191,6 +191,8 @@ void dump_subgraph (ir_node *root, int depth, const char *suffix);
 /** Dump the call graph.
  *
  * Dumps the callgraph to a file "Callgraph"<suffix>".vcg".
+ *
+ * @see dump_callgraph_loop_tree(const char *suffix)
  */
 void dump_callgraph(const char *suffix);
 
index 54de9cc..0b96e40 100644 (file)
@@ -58,6 +58,7 @@
 
 extern int dump_dominator_information_flag;
 extern bool opt_dump_pointer_values_to_info;
+extern bool opt_dump_analysed_type_info;
 
 FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2);
 FILE *vcg_open_name (const char *name, const char *suffix);
@@ -75,4 +76,10 @@ const char *get_mode_name_ex(ir_mode *mode, int *bad);
 int
 dump_node_opcode(FILE *F, ir_node *n);
 
+int dump_node_label(FILE *F, ir_node *n);
+
+
+/** Writes vcg representation with titel "PRINT_TYPEID(tp)" to file F. */
+int dump_type_node(FILE *F, type *tp);
+
 #endif /* __IRDUMPT_T_H__ */
index 836ea1b..7cdaa19 100644 (file)
 #include "irgwalk.h"
 #include "tv.h"
 
+#include "irdom.h"
 #include "field_temperature.h"
 
 #define MY_SIZE 1024     /* Size of an array that actually should be computed. */
 
-int dump_node_opcode(FILE *F, ir_node *n); /* from irdump.c */
-
-
 /* Just opens a file, mangling a file name.
  *
  * The name consists of the following parts:
@@ -164,7 +162,25 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
   switch (get_irn_opcode(n)) {
   case iro_Block: {
     fprintf(F, "  block visited: %ld\n", get_Block_block_visited(n));
-    fprintf(F, "  dominator info: output not implemented\n");
+    if (get_irg_dom_state(get_irn_irg(n)) != dom_none) {
+      fprintf(F, "  dom depth %d\n", get_Block_dom_depth(n));
+      fprintf(F, "  tree pre num %d\n", get_Block_dom_tree_pre_num(n));
+      fprintf(F, "  max subtree pre num %d\n", get_Block_dom_max_subtree_pre_num(n));
+    }
+
+    fprintf(F, "  Execution freqency statistics:\n");
+    if (get_irg_exec_freq_state(get_irn_irg(n)) != exec_freq_none)
+      fprintf(F, "    procedure local evaluation:   %8.2lf\n", get_irn_exec_freq(n));
+    if (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none)
+      fprintf(F, "    call freqency of procedure:   %8.2lf\n",
+             get_irg_method_execution_frequency(get_irn_irg(n)));
+    if (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent)
+      fprintf(F, "    recursion depth of procedure: %8.2lf\n", (double)get_irn_recursion_depth(n));
+    if ((get_irg_exec_freq_state(get_irn_irg(n)) != exec_freq_none) &&
+       (get_irp_loop_nesting_depth_state() != loop_nesting_depth_none) &&
+       (get_irp_callgraph_state() == irp_callgraph_and_calltree_consistent))
+      fprintf(F, "    final evaluation:           **%8.2lf**\n", get_irn_final_cost(n));
+
     /* not dumped: graph_arr */
     /* not dumped: mature    */
   }  break;
@@ -380,6 +396,62 @@ int addr_is_alloc(ir_node *acc) {
   return 1;
 }
 
+/** dumps something like:
+ *
+ *  "prefix"  "Name" (x): node1, ... node7,\n
+ *  "prefix"    node8, ... node15,\n
+ *  "prefix"    node16, node17\n
+ */
+static void dump_node_list(FILE *F, firm_kind *k, char *prefix,
+                          int (*get_entity_n_nodes)(firm_kind *ent),
+                          ir_node *(*get_entity_node)(firm_kind *ent, int pos),
+                          char *name) {
+  int i, n_nodes = get_entity_n_nodes(k);
+  char *comma = "";
+
+  fprintf(F, "%s  %s (%d):", prefix, name, n_nodes);
+  for (i = 0; i < n_nodes; ++i) {
+    int rem;
+    if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+      fprintf(F, ",\n%s   ", prefix);
+      comma = "";
+    }
+    fprintf(F, "%s ", comma);
+    rem = opt_dump_analysed_type_info;
+    opt_dump_analysed_type_info = 0;
+    dump_node_label(F, get_entity_node(k, i));
+    opt_dump_analysed_type_info = rem;
+    comma = ",";
+  }
+  fprintf(F, "\n");
+}
+
+/** dumps something like:
+ *
+ *  "prefix"  "Name" (x): node1, ... node7,\n
+ *  "prefix"    node8, ... node15,\n
+ *  "prefix"    node16, node17\n
+ */
+static void dump_type_list(FILE *F, type *tp, char *prefix,
+                          int (*get_n_types)(type *tp),
+                          type *(*get_type)(type *tp, int pos),
+                          char *name) {
+  int i, n_nodes = get_n_types(tp);
+  char *comma = "";
+
+  fprintf(F, "%s  %s (%d):", prefix, name, n_nodes);
+  for (i = 0; i < n_nodes; ++i) {
+    if (i > 7 && !(i & 7)) { /* line break every eigth node. */
+      fprintf(F, ",\n%s   ", prefix);
+      comma = "";
+    }
+    fprintf(F, "%s %s(%ld)", comma, get_type_name(get_type(tp, i)), get_type_nr(tp));
+    //dump_type_to_file(F, get_type(tp, i), dump_verbosity_onlynames);
+    comma = ",";
+  }
+  fprintf(F, "\n");
+}
+
 #define X(a)    case a: fprintf(F, #a); break
 void    dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned verbosity) {
   int i, j;
@@ -510,6 +582,14 @@ void    dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned
     fprintf(F, "\n");
   }
 
+  if (get_trouts_state()) {
+    fprintf(F, "%sEntity outs:\n", prefix);
+    dump_node_list(F, (firm_kind *)ent, prefix, (int(*)(firm_kind *))get_entity_n_accesses,
+                  (ir_node *(*)(firm_kind *, int))get_entity_access, "Accesses");
+    dump_node_list(F, (firm_kind *)ent, prefix, (int(*)(firm_kind *))get_entity_n_references,
+                  (ir_node *(*)(firm_kind *, int))get_entity_reference, "References");
+  }
+
   if (verbosity & dump_verbosity_accessStats) {
 #if 0
     int n_acc = get_entity_n_accesses(ent);
@@ -969,7 +1049,17 @@ void dump_type_to_file (FILE *F, type *tp, dump_verbosity verbosity) {
   fprintf(F, "  alignment: %2d Bits,\n",  get_type_alignment_bits(tp));
   if (is_atomic_type(tp))
     fprintf(F, "  mode:      %s,\n",  get_mode_name(get_type_mode(tp)));
-  fprintf(F, "  dbg info:  %p,",  (void *)get_type_dbg_info(tp));
+  fprintf(F, "  dbg info:  %p,\n",  (void *)get_type_dbg_info(tp));
+
+  if (get_trouts_state()) {
+    fprintf(F, "\n  Type outs:\n");
+    dump_node_list(F, (firm_kind *)tp, "  ", (int(*)(firm_kind *))get_type_n_allocs,
+                  (ir_node *(*)(firm_kind *, int))get_type_alloc, "Allocations");
+    dump_node_list(F, (firm_kind *)tp, "  ", (int(*)(firm_kind *))get_type_n_casts,
+                  (ir_node *(*)(firm_kind *, int))get_type_cast, "Casts");
+    dump_type_list(F, tp, "  ", get_type_n_pointertypes_to, get_type_pointertype_to, "PointerTpsTo");
+  }
+
 
   if (verbosity & dump_verbosity_accessStats) {
 #if 0