diff options
Diffstat (limited to 'gcc/graphite-poly.c')
-rw-r--r-- | gcc/graphite-poly.c | 92 |
1 files changed, 76 insertions, 16 deletions
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index e8ab3218c39..5305df44d77 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -137,23 +137,11 @@ unify_scattering_dimensions (scop_p scop) /* Prints to FILE the scattering function of PBB. */ -void -print_scattering_function (FILE *file, poly_bb_p pbb) +static void +print_scattering_function_1 (FILE *file, poly_bb_p pbb) { graphite_dim_t i; - 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; - } - fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb)); fprintf (file, "# eq"); @@ -181,6 +169,26 @@ print_scattering_function (FILE *file, poly_bb_p pbb) fprintf (file, "#)\n"); } +/* 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 @@ -680,14 +688,14 @@ print_scop_params (FILE *file, scop_p scop) 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"); } @@ -743,6 +751,50 @@ print_scop (FILE *file, scop_p scop) fprintf (file, "#)\n"); } +/* 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 @@ -775,6 +827,14 @@ debug_scop (scop_p scop) print_scop (stderr, scop); } +/* 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 |