OSDN Git Service

Print SCoPs under CLooG format.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Mar 2010 18:37:28 +0000 (18:37 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:15:52 +0000 (14:15 +0900)
2010-03-23  Sebastian Pop  <sebastian.pop@amd.com>

* graphite-poly.c (print_scattering_function_1): New.
(print_scattering_function): Call it.
(print_scop_params): Remove spaces at the end of lines.
(print_cloog): New.
(debug_cloog): New.
* graphite-poly.h (print_cloog): Declared.
(debug_cloog): Declared.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157887 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.graphite
gcc/graphite-poly.c
gcc/graphite-poly.h

index 9b55225..ba0fe44 100644 (file)
@@ -1,5 +1,15 @@
 2010-03-23  Sebastian Pop  <sebastian.pop@amd.com>
 
+       * graphite-poly.c (print_scattering_function_1): New.
+       (print_scattering_function): Call it.
+       (print_scop_params): Remove spaces at the end of lines.
+       (print_cloog): New.
+       (debug_cloog): New.
+       * graphite-poly.h (print_cloog): Declared.
+       (debug_cloog): Declared.
+
+2010-03-23  Sebastian Pop  <sebastian.pop@amd.com>
+
        * tree-ssa-copy.c: Revert this previous change:
        (init_copy_prop): Loop closed phi nodes cancontain more than one
        argument.
index 3dfdb81..0cdbd55 100644 (file)
@@ -139,24 +139,10 @@ unify_scattering_dimensions (scop_p scop)
    level.  */
 
 static void
-print_scattering_function_1 (FILE *file, poly_bb_p pbb, int verbosity)
+print_scattering_function_1 (FILE *file, poly_bb_p pbb)
 {
   graphite_dim_t i;
 
-  if (verbosity > 0)
-    {
-      fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb));
-      fprintf (file, "#  eq");
-
-  if (PBB_TRANSFORMED_SCATTERING (pbb)
-      || PBB_ORIGINAL_SCATTERING (pbb))
-    fprintf (file, "# Scattering function is provided\n1\n");
-  else
-    {
-      fprintf (file, "# Scattering function is not provided\n0\n");
-      return;
-    }
-
   fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb));
   fprintf (file, "#  eq");
 
@@ -202,8 +188,27 @@ print_scattering_function (FILE *file, poly_bb_p pbb, int verbosity)
   fprintf (file, "#)\n");
 }
 
-/* Prints to FILE the iteration domain of PBB, at some VERBOSITY
-   level.  */
+/* Prints to FILE the scattering function of PBB.  */
+
+void
+print_scattering_function (FILE *file, poly_bb_p pbb)
+{
+  if (!PBB_TRANSFORMED (pbb))
+    return;
+
+  if (PBB_TRANSFORMED_SCATTERING (pbb)
+      || PBB_ORIGINAL_SCATTERING (pbb))
+    fprintf (file, "# Scattering function is provided\n1\n");
+  else
+    {
+      fprintf (file, "# Scattering function is not provided\n0\n");
+      return;
+    }
+
+  print_scattering_function_1 (file, pbb);
+}
+
+/* Prints to FILE the iteration domain of PBB.  */
 
 void
 print_iteration_domain (FILE *file, poly_bb_p pbb, int verbosity)
@@ -749,14 +754,14 @@ print_scop_params (FILE *file, scop_p scop, int verbosity)
   fprintf (file, "# parameters (\n");
 
   if (VEC_length (tree, SESE_PARAMS (SCOP_REGION (scop))))
-    fprintf (file, "# Parameter names are provided\n1\n# Parameter names \n");
+    fprintf (file, "# Parameter names are provided\n1\n# Parameter names\n");
   else
     fprintf (file, "# Parameter names are not provided\n0\n");
 
   for (i = 0; VEC_iterate (tree, SESE_PARAMS (SCOP_REGION (scop)), i, t); i++)
     {
       print_generic_expr (file, t, 0);
-      fprintf (file, " # p_%d \n", i);
+      fprintf (file, " ");
     }
   fprintf (file, "#)\n");
 }
@@ -822,8 +827,51 @@ print_cloog (FILE *file, scop_p scop, int verbosity)
   fprintf (file, "#)\n");
 }
 
-/* Print to FILE the domain and scattering function of PBB, at some
-   VERBOSITY level.  */
+/* Print to FILE the input file that CLooG would expect as input.  */
+
+void
+print_cloog (FILE *file, scop_p scop)
+{
+  int i;
+  poly_bb_p pbb;
+
+  fprintf (file, "# SCoP (generated by GCC/Graphite\n");
+  fprintf (file, "# CLooG output language\nc\n");
+  print_scop_context (file, scop);
+  print_scop_params (file, scop);
+  fprintf (file, "# Number of statements\n%d\n",
+          VEC_length (poly_bb_p, SCOP_BBS (scop)));
+
+  for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+    {
+      fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
+      print_pbb_domain (file, pbb);
+      fprintf (file, "0 0 0 # For future CLooG options.\n#)\n");
+    }
+
+  fprintf (file, "0 # Don't set the iterator names.\n");
+
+  fprintf (file, "# Number of scattering functions\n%d\n",
+          VEC_length (poly_bb_p, SCOP_BBS (scop)));
+  unify_scattering_dimensions (scop);
+
+  for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+    {
+      if (!PBB_TRANSFORMED (pbb)
+         || !(PBB_TRANSFORMED_SCATTERING (pbb)
+              || PBB_ORIGINAL_SCATTERING (pbb)))
+       continue;
+
+      fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
+      print_scattering_function_1 (file, pbb);
+      fprintf (file, "#)\n");
+    }
+
+  fprintf (file, "0 # Don't set the scattering dimension names.\n");
+  fprintf (file, "#)\n");
+}
+
+/* Print to STDERR the domain of PBB.  */
 
 void
 debug_pbb (poly_bb_p pbb, int verbosity)
@@ -856,8 +904,15 @@ debug_cloog (scop_p scop, int verbosity)
   print_cloog (stderr, scop, verbosity);
 }
 
-/* Print to STDERR the parameters of SCOP, at some VERBOSITY
-   level.  */
+/* Print to STDERR the SCOP under CLooG format.  */
+
+void
+debug_cloog (scop_p scop)
+{
+  print_cloog (stderr, scop);
+}
+
+/* Print to STDERR the parameters of SCOP.  */
 
 void
 debug_scop_params (scop_p scop, int verbosity)
index 8ab24f9..4b6c774 100644 (file)
@@ -346,24 +346,24 @@ extern void new_poly_bb (scop_p, void *, bool);
 extern void free_poly_bb (poly_bb_p);
 extern void debug_loop_vec (poly_bb_p);
 extern void schedule_to_scattering (poly_bb_p, int);
-extern void print_pbb_domain (FILE *, poly_bb_p, int);
-extern void print_pbb (FILE *, poly_bb_p, int);
-extern void print_scop_context (FILE *, scop_p, int);
-extern void print_scop (FILE *, scop_p, int);
-extern void print_cloog (FILE *, scop_p, int);
-extern void debug_pbb_domain (poly_bb_p, int);
-extern void debug_pbb (poly_bb_p, int);
-extern void print_pdrs (FILE *, poly_bb_p, int);
-extern void debug_pdrs (poly_bb_p, int);
-extern void debug_scop_context (scop_p, int);
-extern void debug_scop (scop_p, int);
-extern void debug_cloog (scop_p, int);
-extern void print_scop_params (FILE *, scop_p, int);
-extern void debug_scop_params (scop_p, int);
-extern void print_iteration_domain (FILE *, poly_bb_p, int);
-extern void print_iteration_domains (FILE *, scop_p, int);
-extern void debug_iteration_domain (poly_bb_p, int);
-extern void debug_iteration_domains (scop_p, int);
+extern void print_pbb_domain (FILE *, poly_bb_p);
+extern void print_pbb (FILE *, poly_bb_p);
+extern void print_scop_context (FILE *, scop_p);
+extern void print_scop (FILE *, scop_p);
+extern void print_cloog (FILE *, scop_p);
+extern void debug_pbb_domain (poly_bb_p);
+extern void debug_pbb (poly_bb_p);
+extern void print_pdrs (FILE *, poly_bb_p);
+extern void debug_pdrs (poly_bb_p);
+extern void debug_scop_context (scop_p);
+extern void debug_scop (scop_p);
+extern void debug_cloog (scop_p);
+extern void print_scop_params (FILE *, scop_p);
+extern void debug_scop_params (scop_p);
+extern void print_iteration_domain (FILE *, poly_bb_p);
+extern void print_iteration_domains (FILE *, scop_p);
+extern void debug_iteration_domain (poly_bb_p);
+extern void debug_iteration_domains (scop_p);
 extern bool scop_do_interchange (scop_p);
 extern bool scop_do_strip_mine (scop_p);
 extern bool scop_do_block (scop_p);