fixes for gcc 4.0: void * and pointer to function are not compatible anymore
[libfirm] / ir / stat / firmstat.c
index 1b16660..38c7774 100644 (file)
@@ -777,7 +777,7 @@ static void update_graph_stat(graph_entry_t *global, graph_entry_t *graph)
     ir_graph *rem = current_ir_graph;
 
     if (get_irg_outs_state(graph->irg) != outs_consistent)
-      compute_outs(graph->irg);
+      compute_irg_outs(graph->irg);
 
     /* Must be done an the outs graph */
     current_ir_graph = graph->irg;
@@ -1084,7 +1084,7 @@ static void stat_free_graph(void *ctx, ir_graph *irg)
  * @param pre  the pre walker
  * @param post the post walker
  */
-static void stat_irg_walk(void *ctx, ir_graph *irg, void *pre, void *post)
+static void stat_irg_walk(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
 {
   if (! status->stat_options)
     return;
@@ -1106,7 +1106,7 @@ static void stat_irg_walk(void *ctx, ir_graph *irg, void *pre, void *post)
  * @param pre  the pre walker
  * @param post the post walker
  */
-static void stat_irg_walk_blkwise(void *ctx, ir_graph *irg, void *pre, void *post)
+static void stat_irg_walk_blkwise(void *ctx, ir_graph *irg, generic_func *pre, generic_func *post)
 {
   /* for now, do NOT differentiate between blockwise and normal */
   stat_irg_walk(ctx, irg, pre, post);
@@ -1121,7 +1121,7 @@ static void stat_irg_walk_blkwise(void *ctx, ir_graph *irg, void *pre, void *pos
  * @param pre  the pre walker
  * @param post the post walker
  */
-static void stat_irg_block_walk(void *ctx, ir_graph *irg, ir_node *node, void *pre, void *post)
+static void stat_irg_block_walk(void *ctx, ir_graph *irg, ir_node *node, generic_func *pre, generic_func *post)
 {
   if (! status->stat_options)
     return;
@@ -1435,8 +1435,12 @@ static void stat_arch_dep_replace_DivMod_by_const(void *ctx, ir_node *divmod)
 }
 
 /* Dumps a statistics snapshot */
-void stat_dump_snapshot(const char *name)
+void stat_dump_snapshot(const char *name, const char *phase)
 {
+  char fname[2048];
+  const char *p;
+  int l;
+
   if (! status->stat_options)
     return;
 
@@ -1447,13 +1451,45 @@ void stat_dump_snapshot(const char *name)
 
     /*
      * The constant counter is only global, so we clear it here.
-     * Note that it does NOT contain teh constants in DELETED
+     * Note that it does NOT contain the constants in DELETED
      * graphs due to this.
      */
     if (status->stat_options & FIRMSTAT_COUNT_CONSTS)
       stat_const_clear(status);
 
-    stat_dump_init(name);
+    /* build the name */
+    p = strrchr(name, '/');
+#ifdef _WIN32
+    {
+      const char *q;
+
+      q = strrchr(name, '\\');
+
+      /* NULL might be not the smallest pointer */
+      if (q && (!p || q > p))
+        p = q;
+    }
+#endif
+    if (p) {
+      ++p;
+      l = p - name;
+
+      if (l > sizeof(fname) - 1)
+        l = sizeof(fname) - 1;
+
+      memcpy(fname, name, l);
+      fname[l] = '\0';
+    }
+    else {
+      fname[0] = '\0';
+      p = name;
+    }
+    strncat(fname, "firmstat-", sizeof(fname));
+    strncat(fname, phase, sizeof(fname));
+    strncat(fname, "-", sizeof(fname));
+    strncat(fname, p, sizeof(fname));
+
+    stat_dump_init(fname);
 
     /* calculate the graph statistics */
     for (entry = pset_first(status->irg_hash); entry; entry = pset_next(status->irg_hash)) {
@@ -1659,9 +1695,9 @@ void stat_term(void) {
 void init_stat(unsigned enable_options) {}
 
 /* Dumps a statistics snapshot */
-void stat_dump_snapshot(const char *name) {}
+void stat_dump_snapshot(const char *name, const char *phase) {}
 
-/* terminates the statustics module, frees all memory */
+/* terminates the statistics module, frees all memory */
 void stat_term(void);
 
 #endif /* FIRM_STATISTICS */