summaryrefslogtreecommitdiff
path: root/gcc/graphite-clast-to-gimple.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:21:21 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-30 21:21:21 +0000
commitacad129fdc95e22732236647333e9c80bda98872 (patch)
tree8065513565232de8d934bd7c491af04eb5593793 /gcc/graphite-clast-to-gimple.c
parentc0baaa7abb8c4898dd80a7000d60b6c2f974eb0c (diff)
downloadgcc-acad129fdc95e22732236647333e9c80bda98872.tar.gz
New flag: -fgraphite-dump-cloog.
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-clast-to-gimple.c')
-rw-r--r--gcc/graphite-clast-to-gimple.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 0e2ec80b235..faefbb6ad50 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -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);