graphite-scop-detection.c contained a copy of graphite.c
print_graphite_statistics() and print_graphite_scop_statistics().

The latter gained a parameter to distinguish
\nBefore limit_scops SCoP statistics (
from
\nSCoP statistics (

Note that previously the version in gimple.c was never called (AFAICT)
probably due to ICF or the like. Note that previously the 2 functions
where different due to using different strings so i'd have expected some
clever trick iff it really was ICF who substituted them. But that'd be
another bug or feature-request, maybe.

With the patch below a sample dump thus has the following diff:

@@ -541,35 +541,35 @@ fix_loop_structure: fixing up loops for

 Before limit_scops SCoP statistics (BBS:1, LOOPS:0, CONDITIONS:0, STMTS:0)

-Before limit_scops SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, 
STMTS:0)
+SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0)

 Before limit_scops SCoP statistics (BBS:1, LOOPS:0, CONDITIONS:0, STMTS:0)

-Before limit_scops SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, 
STMTS:0)
+SCoP profiling statistics (BBS:0, LOOPS:0, CONDITIONS:0, STMTS:0)

which looks plausible to me since the stats are dumped once before
limit_scops() and once afterwards and now this is reflected in the dumps.

Ok for trunk if bootstrap+regtest pass?

Thanks,

gcc/ChangeLog

2015-07-09  Bernhard Reutner-Fischer  <al...@gcc.gnu.org>

        * graphite.h: New file.
        (print_graphite_statistics): Extern declaration.
        * graphite-scop-detection.c (print_graphite_scop_statistics,
        print_graphite_statistics): Remove.
        * graphite.c (print_graphite_statistics): Make public and add
        PREFIX parameter. Adjust callers.
        (print_graphite_scop_statistics): Add PREFIX parameter.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot....@gmail.com>
---
 gcc/graphite-scop-detection.c | 74 ++-----------------------------------------
 gcc/graphite.c                | 18 +++++++----
 gcc/graphite.h                | 27 ++++++++++++++++
 3 files changed, 40 insertions(+), 79 deletions(-)
 create mode 100644 gcc/graphite.h

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index dac8eeb..2c1cc36 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #ifdef HAVE_isl
 #include "graphite-poly.h"
+#include "graphite.h"
 #include "graphite-scop-detection.h"
 
 /* Forward declarations.  */
@@ -1124,77 +1125,6 @@ contains_only_close_phi_nodes (basic_block bb)
   return true;
 }
 
-/* Print statistics for SCOP to FILE.  */
-
-static void
-print_graphite_scop_statistics (FILE* file, scop_p scop)
-{
-  long n_bbs = 0;
-  long n_loops = 0;
-  long n_stmts = 0;
-  long n_conditions = 0;
-  long n_p_bbs = 0;
-  long n_p_loops = 0;
-  long n_p_stmts = 0;
-  long n_p_conditions = 0;
-
-  basic_block bb;
-
-  FOR_ALL_BB_FN (bb, cfun)
-    {
-      gimple_stmt_iterator psi;
-      loop_p loop = bb->loop_father;
-
-      if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
-       continue;
-
-      n_bbs++;
-      n_p_bbs += bb->count;
-
-      if (EDGE_COUNT (bb->succs) > 1)
-       {
-         n_conditions++;
-         n_p_conditions += bb->count;
-       }
-
-      for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
-       {
-         n_stmts++;
-         n_p_stmts += bb->count;
-       }
-
-      if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop)))
-       {
-         n_loops++;
-         n_p_loops += bb->count;
-       }
-
-    }
-
-  fprintf (file, "\nBefore limit_scops SCoP statistics (");
-  fprintf (file, "BBS:%ld, ", n_bbs);
-  fprintf (file, "LOOPS:%ld, ", n_loops);
-  fprintf (file, "CONDITIONS:%ld, ", n_conditions);
-  fprintf (file, "STMTS:%ld)\n", n_stmts);
-  fprintf (file, "\nBefore limit_scops SCoP profiling statistics (");
-  fprintf (file, "BBS:%ld, ", n_p_bbs);
-  fprintf (file, "LOOPS:%ld, ", n_p_loops);
-  fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
-  fprintf (file, "STMTS:%ld)\n", n_p_stmts);
-}
-
-/* Print statistics for SCOPS to FILE.  */
-
-static void
-print_graphite_statistics (FILE* file, vec<scop_p> scops)
-{
-  int i;
-  scop_p scop;
-
-  FOR_EACH_VEC_ELT (scops, i, scop)
-    print_graphite_scop_statistics (file, scop);
-}
-
 /* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
 
    Example:
@@ -1440,7 +1370,7 @@ build_scops (vec<scop_p> *scops)
   build_graphite_scops (regions, scops);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
-    print_graphite_statistics (dump_file, *scops);
+    print_graphite_statistics (dump_file, "Before limit_scops ", *scops);
 
   limit_scops (scops);
   regions.release ();
diff --git a/gcc/graphite.c b/gcc/graphite.c
index ba8029a..820491a 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -77,6 +77,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifdef HAVE_isl
 
 #include "graphite-poly.h"
+#include "graphite.h"
 #include "graphite-scop-detection.h"
 #include "graphite-isl-ast-to-gimple.h"
 #include "graphite-sese-to-poly.h"
@@ -140,7 +141,7 @@ print_global_statistics (FILE* file)
 /* Print statistics for SCOP to FILE.  */
 
 static void
-print_graphite_scop_statistics (FILE* file, scop_p scop)
+print_graphite_scop_statistics (FILE* file, const char *prefix, scop_p scop)
 {
   long n_bbs = 0;
   long n_loops = 0;
@@ -153,6 +154,9 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
 
   basic_block bb;
 
+  if (prefix == NULL)
+    prefix = "";
+
   FOR_ALL_BB_FN (bb, cfun)
     {
       gimple_stmt_iterator psi;
@@ -183,7 +187,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
        }
     }
 
-  fprintf (file, "\nSCoP statistics (");
+  fprintf (file, "\n%sSCoP statistics (", prefix);
   fprintf (file, "BBS:%ld, ", n_bbs);
   fprintf (file, "LOOPS:%ld, ", n_loops);
   fprintf (file, "CONDITIONS:%ld, ", n_conditions);
@@ -195,17 +199,17 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)
   fprintf (file, "STMTS:%ld)\n", n_p_stmts);
 }
 
-/* Print statistics for SCOPS to FILE.  */
+/* Print statistics for SCOPS to FILE. Prefix statistic headers with PREFIX.  
*/
 
-static void
-print_graphite_statistics (FILE* file, vec<scop_p> scops)
+void
+print_graphite_statistics (FILE* file, const char *prefix, vec<scop_p> scops)
 {
   int i;
 
   scop_p scop;
 
   FOR_EACH_VEC_ELT (scops, i, scop)
-    print_graphite_scop_statistics (file, scop);
+    print_graphite_scop_statistics (file, prefix, scop);
 }
 
 /* Initialize graphite: when there are no loops returns false.  */
@@ -286,7 +290,7 @@ graphite_transform_loops (void)
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      print_graphite_statistics (dump_file, scops);
+      print_graphite_statistics (dump_file, NULL, scops);
       print_global_statistics (dump_file);
     }
 
diff --git a/gcc/graphite.h b/gcc/graphite.h
new file mode 100644
index 0000000..08330b3
--- /dev/null
+++ b/gcc/graphite.h
@@ -0,0 +1,27 @@
+/* Gimple Represented as Polyhedra.
+   Copyright (C) 2006-2015 Free Software Foundation, Inc.
+   Contributed by Sebastian Pop <sebastian....@amd.com> and
+   Tobias Grosser <gros...@fim.uni-passau.de>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#ifndef GCC_GRAPHITE_H
+#define GCC_GRAPHITE_H
+
+extern void print_graphite_statistics (FILE*, const char*, vec<scop_p>);
+
+#endif /* GCC_GRAPHITE_H */
-- 
2.1.4

Reply via email to