Commit 5c24066b by Aditya Kumar Committed by Sebastian Pop

clean up debug functions

2015-10-07  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

        * graphite-poly.c (print_iteration_domain): Remove verbosity.
        Remove OpenScop formatting.
        (print_iteration_domains): Same.
        (debug_iteration_domain): Same.
        (debug_iteration_domains): Same.
        (print_pdr): Same.
        (debug_pdr): Same.
        (dump_gbb_cases): Same.
        (dump_gbb_conditions): Same.
        (print_pdrs): Same.
        (debug_pdrs): Same.
        (print_pbb_body): Same.
        (print_pbb): Same.
        (print_scop_params): Same.
        (print_scop_context): Same.
        (print_scop): Same.
        (debug_pbb_domain): Same.
        (debug_pbb): Same.
        (debug_scop_context): Same.
        (debug_scop): Same.
        (debug_scop_params): Same.
        * graphite-poly.h: Same.
        * graphite.c (graphite_transform_loops): Same.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>

From-SVN: r228676
parent 9a24a3cc
2015-10-10 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-poly.c (print_iteration_domain): Remove verbosity.
Remove OpenScop formatting.
(print_iteration_domains): Same.
(debug_iteration_domain): Same.
(debug_iteration_domains): Same.
(print_pdr): Same.
(debug_pdr): Same.
(dump_gbb_cases): Same.
(dump_gbb_conditions): Same.
(print_pdrs): Same.
(debug_pdrs): Same.
(print_pbb_body): Same.
(print_pbb): Same.
(print_scop_params): Same.
(print_scop_context): Same.
(print_scop): Same.
(debug_pbb_domain): Same.
(debug_pbb): Same.
(debug_scop_context): Same.
(debug_scop): Same.
(debug_scop_params): Same.
* graphite-poly.h: Same.
* graphite.c (graphite_transform_loops): Same.
2015-10-10 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> 2015-10-10 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* function.c (stack_protect_epilogue): Remove as_a<rtx_insn *> () * function.c (stack_protect_epilogue): Remove as_a<rtx_insn *> ()
...@@ -69,44 +69,40 @@ debug_gmp_value (mpz_t val) ...@@ -69,44 +69,40 @@ debug_gmp_value (mpz_t val)
gmp_fprintf (stderr, "%Zd", val); gmp_fprintf (stderr, "%Zd", val);
} }
/* Prints to FILE the iteration domain of PBB, at some VERBOSITY /* Prints to FILE the iteration domain of PBB. */
level. */
void void
print_iteration_domain (FILE *file, poly_bb_p pbb, int verbosity) print_iteration_domain (FILE *file, poly_bb_p pbb)
{ {
print_pbb_domain (file, pbb, verbosity); print_pbb_domain (file, pbb);
} }
/* Prints to FILE the iteration domains of every PBB of SCOP, at some /* Prints to FILE the iteration domains of every PBB of SCOP. */
VERBOSITY level. */
void void
print_iteration_domains (FILE *file, scop_p scop, int verbosity) print_iteration_domains (FILE *file, scop_p scop)
{ {
int i; int i;
poly_bb_p pbb; poly_bb_p pbb;
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
print_iteration_domain (file, pbb, verbosity); print_iteration_domain (file, pbb);
} }
/* Prints to STDERR the iteration domain of PBB, at some VERBOSITY /* Prints to STDERR the iteration domain of PBB. */
level. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_iteration_domain (poly_bb_p pbb, int verbosity) debug_iteration_domain (poly_bb_p pbb)
{ {
print_iteration_domain (stderr, pbb, verbosity); print_iteration_domain (stderr, pbb);
} }
/* Prints to STDERR the iteration domains of every PBB of SCOP, at /* Prints to STDERR the iteration domains of every PBB of SCOP. */
some VERBOSITY level. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_iteration_domains (scop_p scop, int verbosity) debug_iteration_domains (scop_p scop)
{ {
print_iteration_domains (stderr, scop, verbosity); print_iteration_domains (stderr, scop);
} }
/* Apply graphite transformations to all the basic blocks of SCOP. */ /* Apply graphite transformations to all the basic blocks of SCOP. */
...@@ -205,15 +201,12 @@ free_poly_bb (poly_bb_p pbb) ...@@ -205,15 +201,12 @@ free_poly_bb (poly_bb_p pbb)
XDELETE (pbb); XDELETE (pbb);
} }
/* Prints to FILE the polyhedral data reference PDR, at some VERBOSITY /* Prints to FILE the polyhedral data reference PDR. */
level. */
void void
print_pdr (FILE *file, poly_dr_p pdr, int verbosity) print_pdr (FILE *file, poly_dr_p pdr)
{ {
if (verbosity > 1) fprintf (file, "pdr_%d (", PDR_ID (pdr));
{
fprintf (file, "# pdr_%d (", PDR_ID (pdr));
switch (PDR_TYPE (pdr)) switch (PDR_TYPE (pdr))
{ {
...@@ -233,27 +226,19 @@ print_pdr (FILE *file, poly_dr_p pdr, int verbosity) ...@@ -233,27 +226,19 @@ print_pdr (FILE *file, poly_dr_p pdr, int verbosity)
gcc_unreachable (); gcc_unreachable ();
} }
dump_data_reference (file, (data_reference_p) PDR_CDR (pdr)); fprintf (file, "data accesses: ");
}
if (verbosity > 0)
{
fprintf (file, "# data accesses (\n");
print_isl_map (file, pdr->accesses); print_isl_map (file, pdr->accesses);
fprintf (file, "subscript sizes: ");
print_isl_set (file, pdr->subscript_sizes); print_isl_set (file, pdr->subscript_sizes);
fprintf (file, "#)\n"); fprintf (file, ")\n");
}
if (verbosity > 1)
fprintf (file, "#)\n");
} }
/* Prints to STDERR the polyhedral data reference PDR, at some /* Prints to STDERR the polyhedral data reference PDR. */
VERBOSITY level. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_pdr (poly_dr_p pdr, int verbosity) debug_pdr (poly_dr_p pdr)
{ {
print_pdr (stderr, pdr, verbosity); print_pdr (stderr, pdr);
} }
/* Store the GRAPHITE representation of BB. */ /* Store the GRAPHITE representation of BB. */
...@@ -359,10 +344,10 @@ free_scop (scop_p scop) ...@@ -359,10 +344,10 @@ free_scop (scop_p scop)
XDELETE (scop); XDELETE (scop);
} }
/* Print to FILE the domain of PBB, at some VERBOSITY level. */ /* Print to FILE the domain of PBB. */
void void
print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity ATTRIBUTE_UNUSED) print_pbb_domain (FILE *file, poly_bb_p pbb)
{ {
print_isl_set (file, pbb->domain); print_isl_set (file, pbb->domain);
} }
...@@ -383,15 +368,12 @@ dump_gbb_cases (FILE *file, gimple_poly_bb_p gbb) ...@@ -383,15 +368,12 @@ dump_gbb_cases (FILE *file, gimple_poly_bb_p gbb)
if (cases.is_empty ()) if (cases.is_empty ())
return; return;
fprintf (file, "# cases bb_%d (\n", GBB_BB (gbb)->index); fprintf (file, "cases bb_%d (\n", GBB_BB (gbb)->index);
FOR_EACH_VEC_ELT (cases, i, stmt) FOR_EACH_VEC_ELT (cases, i, stmt)
{
fprintf (file, "# ");
print_gimple_stmt (file, stmt, 0, 0); print_gimple_stmt (file, stmt, 0, 0);
}
fprintf (file, "#)\n"); fprintf (file, ")\n");
} }
/* Dump conditions of a graphite basic block GBB on FILE. */ /* Dump conditions of a graphite basic block GBB on FILE. */
...@@ -410,42 +392,28 @@ dump_gbb_conditions (FILE *file, gimple_poly_bb_p gbb) ...@@ -410,42 +392,28 @@ dump_gbb_conditions (FILE *file, gimple_poly_bb_p gbb)
if (conditions.is_empty ()) if (conditions.is_empty ())
return; return;
fprintf (file, "# conditions bb_%d (\n", GBB_BB (gbb)->index); fprintf (file, "conditions bb_%d (\n", GBB_BB (gbb)->index);
FOR_EACH_VEC_ELT (conditions, i, stmt) FOR_EACH_VEC_ELT (conditions, i, stmt)
{
fprintf (file, "# ");
print_gimple_stmt (file, stmt, 0, 0); print_gimple_stmt (file, stmt, 0, 0);
}
fprintf (file, "#)\n"); fprintf (file, ")\n");
} }
/* Print to FILE all the data references of PBB, at some VERBOSITY /* Print to FILE all the data references of PBB. */
level. */
void void
print_pdrs (FILE *file, poly_bb_p pbb, int verbosity) print_pdrs (FILE *file, poly_bb_p pbb)
{ {
int i; int i;
poly_dr_p pdr; poly_dr_p pdr;
int nb_reads = 0; int nb_reads = 0;
int nb_writes = 0; int nb_writes = 0;
if (PBB_DRS (pbb).length () == 0) if (PBB_DRS (pbb).is_empty ())
{
if (verbosity > 0)
fprintf (file, "# Access informations are not provided\n");\
fprintf (file, "0\n");
return; return;
}
if (verbosity > 1)
fprintf (file, "# Data references (\n");
if (verbosity > 0) fprintf (file, "Data references (\n");
fprintf (file, "# Access informations are provided\n");
fprintf (file, "1\n");
FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) == PDR_READ) if (PDR_TYPE (pdr) == PDR_READ)
...@@ -453,226 +421,146 @@ print_pdrs (FILE *file, poly_bb_p pbb, int verbosity) ...@@ -453,226 +421,146 @@ print_pdrs (FILE *file, poly_bb_p pbb, int verbosity)
else else
nb_writes++; nb_writes++;
if (verbosity > 1) fprintf (file, "Read data references (\n");
fprintf (file, "# Read data references (\n");
if (verbosity > 0)
fprintf (file, "# Read access informations\n");
fprintf (file, "%d\n", nb_reads);
FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) == PDR_READ) if (PDR_TYPE (pdr) == PDR_READ)
print_pdr (file, pdr, verbosity); print_pdr (file, pdr);
if (verbosity > 1)
fprintf (file, "#)\n");
if (verbosity > 1)
fprintf (file, "# Write data references (\n");
if (verbosity > 0)
fprintf (file, "# Write access informations\n");
fprintf (file, "%d\n", nb_writes);
fprintf (file, ")\n");
fprintf (file, "Write data references (\n");
FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr) FOR_EACH_VEC_ELT (PBB_DRS (pbb), i, pdr)
if (PDR_TYPE (pdr) != PDR_READ) if (PDR_TYPE (pdr) != PDR_READ)
print_pdr (file, pdr, verbosity); print_pdr (file, pdr);
fprintf (file, ")\n");
if (verbosity > 1) fprintf (file, ")\n");
fprintf (file, "#)\n");
if (verbosity > 1)
fprintf (file, "#)\n");
} }
/* Print to STDERR all the data references of PBB. */ /* Print to STDERR all the data references of PBB. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_pdrs (poly_bb_p pbb, int verbosity) debug_pdrs (poly_bb_p pbb)
{ {
print_pdrs (stderr, pbb, verbosity); print_pdrs (stderr, pbb);
} }
/* Print to FILE the body of PBB, at some VERBOSITY level. /* Print to FILE the body of PBB. */
If statement_body_provided is false statement body is not printed. */
static void static void
print_pbb_body (FILE *file, poly_bb_p pbb, int verbosity, print_pbb_body (FILE *file, poly_bb_p pbb)
bool statement_body_provided)
{ {
if (verbosity > 1) fprintf (file, "Body (\n");
fprintf (file, "# Body (\n");
if (!statement_body_provided)
{
if (verbosity > 0)
fprintf (file, "# Statement body is not provided\n");
fprintf (file, "0\n");
if (verbosity > 1)
fprintf (file, "#)\n");
return;
}
if (verbosity > 0)
fprintf (file, "# Statement body is provided\n");
fprintf (file, "1\n");
if (verbosity > 0)
fprintf (file, "# Original iterator names\n# Iterator names are not provided yet.\n");
if (verbosity > 0)
fprintf (file, "# Statement body\n");
fprintf (file, "{\n");
dump_bb (file, pbb_bb (pbb), 0, 0); dump_bb (file, pbb_bb (pbb), 0, 0);
fprintf (file, "}\n"); fprintf (file, ")\n");
if (verbosity > 1)
fprintf (file, "#)\n");
} }
/* Print to FILE the domain and scattering function of PBB, at some /* Print to FILE the domain and scattering function of PBB. */
VERBOSITY level. */
void void
print_pbb (FILE *file, poly_bb_p pbb, int verbosity) print_pbb (FILE *file, poly_bb_p pbb)
{ {
if (verbosity > 1) fprintf (file, "pbb_%d (\n", pbb_index (pbb));
{
fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
dump_gbb_conditions (file, PBB_BLACK_BOX (pbb)); dump_gbb_conditions (file, PBB_BLACK_BOX (pbb));
dump_gbb_cases (file, PBB_BLACK_BOX (pbb)); dump_gbb_cases (file, PBB_BLACK_BOX (pbb));
}
print_pbb_domain (file, pbb, verbosity); print_pbb_domain (file, pbb);
print_pdrs (file, pbb, verbosity); print_pdrs (file, pbb);
print_pbb_body (file, pbb, verbosity, false); print_pbb_body (file, pbb);
if (verbosity > 1) fprintf (file, ")\n");
fprintf (file, "#)\n");
} }
/* Print to FILE the parameters of SCOP, at some VERBOSITY level. */ /* Print to FILE the parameters of SCOP. */
void void
print_scop_params (FILE *file, scop_p scop, int verbosity) print_scop_params (FILE *file, scop_p scop)
{ {
if (SESE_PARAMS (SCOP_REGION (scop)).is_empty ())
return;
int i; int i;
tree t; tree t;
fprintf (file, "parameters (");
if (verbosity > 1)
fprintf (file, "# parameters (\n");
if (SESE_PARAMS (SCOP_REGION (scop)).length ())
{
if (verbosity > 0)
fprintf (file, "# Parameter names are provided\n");
fprintf (file, "1\n");
if (verbosity > 0)
fprintf (file, "# Parameter names\n");
}
else
{
if (verbosity > 0)
fprintf (file, "# Parameter names are not provided\n");
fprintf (file, "0\n");
}
FOR_EACH_VEC_ELT (SESE_PARAMS (SCOP_REGION (scop)), i, t) FOR_EACH_VEC_ELT (SESE_PARAMS (SCOP_REGION (scop)), i, t)
{ {
print_generic_expr (file, t, 0); print_generic_expr (file, t, 0);
fprintf (file, " "); fprintf (file, ", ");
} }
fprintf (file, ")\n");
fprintf (file, "\n");
if (verbosity > 1)
fprintf (file, "#)\n");
} }
/* Print to FILE the context of SCoP, at some VERBOSITY level. */ /* Print to FILE the context of SCoP. */
void void
print_scop_context (FILE *file, scop_p scop, int verbosity) print_scop_context (FILE *file, scop_p scop)
{ {
if (verbosity > 0) if (!scop->param_context)
fprintf (file, "# Context (\n"); return;
if (scop->param_context) fprintf (file, "Context (\n");
print_isl_set (file, scop->param_context); print_isl_set (file, scop->param_context);
fprintf (file, ")\n");
if (verbosity > 0)
fprintf (file, "# )\n");
} }
/* Print to FILE the SCOP, at some VERBOSITY level. */ /* Print to FILE the SCOP. */
void void
print_scop (FILE *file, scop_p scop, int verbosity) print_scop (FILE *file, scop_p scop)
{ {
int i; int i;
poly_bb_p pbb; poly_bb_p pbb;
fprintf (file, "SCoP 1\n#(\n"); fprintf (file, "SCoP (\n");
fprintf (file, "# Language\nGimple\n"); print_scop_context (file, scop);
print_scop_context (file, scop, verbosity); print_scop_params (file, scop);
print_scop_params (file, scop, verbosity);
if (verbosity > 0)
fprintf (file, "# Number of statements\n");
fprintf (file, "Number of statements: ");
fprintf (file, "%d\n", scop->pbbs.length ()); fprintf (file, "%d\n", scop->pbbs.length ());
FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
print_pbb (file, pbb, verbosity); print_pbb (file, pbb);
fprintf (file, "#)\n"); fprintf (file, ")\n");
} }
/* Print to STDERR the domain of PBB, at some VERBOSITY level. */ /* Print to STDERR the domain of PBB. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_pbb_domain (poly_bb_p pbb, int verbosity) debug_pbb_domain (poly_bb_p pbb)
{ {
print_pbb_domain (stderr, pbb, verbosity); print_pbb_domain (stderr, pbb);
} }
/* Print to FILE the domain and scattering function of PBB, at some /* Print to FILE the domain and scattering function of PBB. */
VERBOSITY level. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_pbb (poly_bb_p pbb, int verbosity) debug_pbb (poly_bb_p pbb)
{ {
print_pbb (stderr, pbb, verbosity); print_pbb (stderr, pbb);
} }
/* Print to STDERR the context of SCOP, at some VERBOSITY level. */ /* Print to STDERR the context of SCOP. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_scop_context (scop_p scop, int verbosity) debug_scop_context (scop_p scop)
{ {
print_scop_context (stderr, scop, verbosity); print_scop_context (stderr, scop);
} }
/* Print to STDERR the SCOP, at some VERBOSITY level. */ /* Print to STDERR the SCOP. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_scop (scop_p scop, int verbosity) debug_scop (scop_p scop)
{ {
print_scop (stderr, scop, verbosity); print_scop (stderr, scop);
} }
/* Print to STDERR the parameters of SCOP, at some VERBOSITY /* Print to STDERR the parameters of SCOP. */
level. */
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_scop_params (scop_p scop, int verbosity) debug_scop_params (scop_p scop)
{ {
print_scop_params (stderr, scop, verbosity); print_scop_params (stderr, scop);
} }
extern isl_ctx *the_isl_ctx; extern isl_ctx *the_isl_ctx;
......
...@@ -197,8 +197,8 @@ struct poly_dr ...@@ -197,8 +197,8 @@ struct poly_dr
void new_poly_dr (poly_bb_p, enum poly_dr_type, data_reference_p, void new_poly_dr (poly_bb_p, enum poly_dr_type, data_reference_p,
graphite_dim_t, isl_map *, isl_set *); graphite_dim_t, isl_map *, isl_set *);
void free_poly_dr (poly_dr_p); void free_poly_dr (poly_dr_p);
void debug_pdr (poly_dr_p, int); void debug_pdr (poly_dr_p);
void print_pdr (FILE *, poly_dr_p, int); void print_pdr (FILE *, poly_dr_p);
static inline bool static inline bool
pdr_read_p (poly_dr_p pdr) pdr_read_p (poly_dr_p pdr)
...@@ -280,22 +280,22 @@ struct poly_bb ...@@ -280,22 +280,22 @@ struct poly_bb
extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p); extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p);
extern void free_poly_bb (poly_bb_p); extern void free_poly_bb (poly_bb_p);
extern void debug_loop_vec (poly_bb_p); extern void debug_loop_vec (poly_bb_p);
extern void print_pbb_domain (FILE *, poly_bb_p, int); extern void print_pbb_domain (FILE *, poly_bb_p);
extern void print_pbb (FILE *, poly_bb_p, int); extern void print_pbb (FILE *, poly_bb_p);
extern void print_scop_context (FILE *, scop_p, int); extern void print_scop_context (FILE *, scop_p);
extern void print_scop (FILE *, scop_p, int); extern void print_scop (FILE *, scop_p);
extern void debug_pbb_domain (poly_bb_p, int); extern void debug_pbb_domain (poly_bb_p);
extern void debug_pbb (poly_bb_p, int); extern void debug_pbb (poly_bb_p);
extern void print_pdrs (FILE *, poly_bb_p, int); extern void print_pdrs (FILE *, poly_bb_p);
extern void debug_pdrs (poly_bb_p, int); extern void debug_pdrs (poly_bb_p);
extern void debug_scop_context (scop_p, int); extern void debug_scop_context (scop_p);
extern void debug_scop (scop_p, int); extern void debug_scop (scop_p);
extern void print_scop_params (FILE *, scop_p, int); extern void print_scop_params (FILE *, scop_p);
extern void debug_scop_params (scop_p, int); extern void debug_scop_params (scop_p);
extern void print_iteration_domain (FILE *, poly_bb_p, int); extern void print_iteration_domain (FILE *, poly_bb_p);
extern void print_iteration_domains (FILE *, scop_p, int); extern void print_iteration_domains (FILE *, scop_p);
extern void debug_iteration_domain (poly_bb_p, int); extern void debug_iteration_domain (poly_bb_p);
extern void debug_iteration_domains (scop_p, int); extern void debug_iteration_domains (scop_p);
extern void print_isl_set (FILE *, isl_set *); extern void print_isl_set (FILE *, isl_set *);
extern void print_isl_map (FILE *, isl_map *); extern void print_isl_map (FILE *, isl_map *);
extern void print_isl_aff (FILE *, isl_aff *); extern void print_isl_aff (FILE *, isl_aff *);
......
...@@ -332,7 +332,7 @@ graphite_transform_loops (void) ...@@ -332,7 +332,7 @@ graphite_transform_loops (void)
build_poly_scop (scop); build_poly_scop (scop);
if (dump_file && dump_flags) if (dump_file && dump_flags)
print_scop (dump_file, scop, 3); print_scop (dump_file, scop);
if (POLY_SCOP_P (scop) if (POLY_SCOP_P (scop)
&& apply_poly_transforms (scop) && apply_poly_transforms (scop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment