New flag: -fgraphite-dump-cloog.
authorSebastian Pop <spop@gcc.gnu.org>
Thu, 30 Sep 2010 21:21:21 +0000 (21:21 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Thu, 30 Sep 2010 21:21:21 +0000 (21:21 +0000)
Introduce a new flag: -fgraphite-dump-cloog. If enabled, graphite
dumps each SCoP into a CLooG input file for further debugging.
The naming follows the naming scheme of -fgraphite-write:
 <basename>.<scopnumber>.cloog

The file is dumped into the current working directory.

2010-09-16  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>

* common.opt (fgraphite-dump-cloog): New flag.
* doc/invoke.texi (-fgraphite-dump-cloog): Documented.
* graphite-clast-to-gimple.c (init_cloog_input_file): New.
(build_cloog_prog): Dump CLooG input file when
flag_graphite_dump_cloog is set.
* graphite-cloog-compat.h (cloog_program_dump_cloog): New.

From-SVN: r164808

gcc/ChangeLog
gcc/ChangeLog.graphite
gcc/graphite-clast-to-gimple.c
gcc/graphite-cloog-compat.h

index 1df0cb0..281ab29 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-30  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+       * graphite-clast-to-gimple.c (init_cloog_input_file): New.
+       (build_cloog_prog): Dump CLooG input file when
+       flag_graphite_dump_cloog is set.  This is disabled on trunk.
+       * graphite-cloog-compat.h (cloog_program_dump_cloog): New.
+
 2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
 
        * graphite-clast-to-gimple.c (graphite_verify): Remove call to
index 997df9b..ba7d99e 100644 (file)
@@ -1,3 +1,24 @@
+2010-09-21  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+       * common.opt (fgraphite-dump-cloog): New flag.
+       * doc/invoke.texi (-fgraphite-dump-cloog): Documented.
+       * graphite-clast-to-gimple.c (init_cloog_input_file): New.
+       (build_cloog_prog): Dump CLooG input file when
+       flag_graphite_dump_cloog is set.
+       * graphite-cloog-compat.h (cloog_program_dump_cloog): New.
+
+2010-09-20  Sebastian Pop  <sebastian.pop@amd.com>
+
+       Revert previous patch "New flag: -fgraphite-dump-cloog."
+
+2010-09-20  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
+
+       * common.opt (fgraphite-dump-cloog): New flag.
+       * doc/invoke.texi (-fgraphite-dump-cloog): Documented.
+       * graphite-clast-to-gimple.c (init_cloog_input_file): New.
+       (build_cloog_prog): Dump CLooG input file when
+       flag_graphite_dump_cloog is set.
+
 2010-09-20  Sebastian Pop  <sebastian.pop@amd.com>
 
        * graphite-clast-to-gimple.c (graphite_verify): Remove call to
index 0e2ec80..faefbb6 100644 (file)
@@ -1216,6 +1216,31 @@ initialize_cloog_names (scop_p scop, CloogProgram *prog)
                              scattering);
 }
 
+/* Initialize a CLooG input file.  */
+
+static FILE *
+init_cloog_input_file (int scop_number)
+{
+  FILE *graphite_out_file;
+  int len = strlen (dump_base_name);
+  char *dumpname = XNEWVEC (char, len + 25);
+  char *s_scop_number = XNEWVEC (char, 15);
+
+  memcpy (dumpname, dump_base_name, len + 1);
+  strip_off_ending (dumpname, len);
+  sprintf (s_scop_number, ".%d", scop_number);
+  strcat (dumpname, s_scop_number);
+  strcat (dumpname, ".cloog");
+  graphite_out_file = fopen (dumpname, "w+b");
+
+  if (graphite_out_file == 0)
+    fatal_error ("can%'t open %s for writing: %m", dumpname);
+
+  free (dumpname);
+
+  return graphite_out_file;
+}
+
 /* Build cloog program for SCoP.  */
 
 static void
@@ -1306,6 +1331,17 @@ build_cloog_prog (scop_p scop, CloogProgram *prog,
   /* Extract scalar dimensions to simplify the code generation problem.  */
   cloog_program_extract_scalars (prog, scattering, options);
 
+  /* Dump a .cloog input file, if requested.  This feature is only
+     enabled in the Graphite branch.  */
+  if (0)
+    {
+      static size_t file_scop_number = 0;
+      FILE *cloog_file = init_cloog_input_file (file_scop_number);
+
+      cloog_program_dump_cloog (cloog_file, prog, scattering);
+      ++file_scop_number;
+    }
+
   /* Apply scattering.  */
   cloog_program_scatter (prog, scattering, options);
   free_scattering (scattering);
index 061aa47..b7a3b23 100644 (file)
@@ -72,6 +72,8 @@ typedef const char *clast_name_p;
 #define cloog_scattering cloog_domain
 #define cloog_next_scattering cloog_next_domain
 #define cloog_scattering_free cloog_domain_free
+#define cloog_program_dump_cloog(DUMPFILE, PROGRAM, SCATTERINGLIST)\
+  cloog_program_dump_cloog (DUMPFILE, PROGRAM)
 
 #endif