transform_done = true;
if (flag_loop_block)
- gcc_unreachable (); /* Not yet supported. */
-
- if (flag_loop_strip_mine)
- transform_done |= scop_do_strip_mine (scop);
+ {
+ transform_done |= scop_do_strip_mine (scop);
+ transform_done |= scop_do_interchange (scop);
+ }
+ else
+ {
+ if (flag_loop_strip_mine)
+ transform_done |= scop_do_strip_mine (scop);
- if (flag_loop_interchange)
- transform_done |= scop_do_interchange (scop);
+ if (flag_loop_interchange)
+ transform_done |= scop_do_interchange (scop);
+ }
return transform_done;
}
for (j = 0; VEC_iterate (poly_dr_p, collapsed, j, pdr2); j++)
if (!can_collapse_pdrs (pdr1, pdr2))
VEC_quick_push (poly_dr_p, collapsed, pdr1);
+
+ VEC_free (poly_dr_p, heap, collapsed);
+ PBB_PDR_DUPLICATES_REMOVED (pbb) = true;
}
/* Create a new polyhedral data reference and add it to PBB. It is
PBB_ORIGINAL (pbb) = NULL;
PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3);
PBB_IS_REDUCTION (pbb) = reduction;
+ PBB_PDR_DUPLICATES_REMOVED (pbb) = false;
VEC_safe_push (poly_bb_p, heap, SCOP_BBS (scop), pbb);
}
{
scop_p scop = XNEW (struct scop);
- SCOP_DEP_GRAPH (scop) = NULL;
SCOP_CONTEXT (scop) = NULL;
scop_set_region (scop, region);
SCOP_BBS (scop) = VEC_alloc (poly_bb_p, heap, 3);
SCOP_ORIGINAL_PDDRS (scop) = htab_create (10, hash_poly_ddr_p,
eq_poly_ddr_p, free_poly_ddr);
+ SCOP_ORIGINAL_SCHEDULE (scop) = NULL;
+ SCOP_TRANSFORMED_SCHEDULE (scop) = NULL;
+ SCOP_SAVED_SCHEDULE (scop) = NULL;
return scop;
}
ppl_delete_Pointset_Powerset_C_Polyhedron (SCOP_CONTEXT (scop));
htab_delete (SCOP_ORIGINAL_PDDRS (scop));
+ free_lst (SCOP_ORIGINAL_SCHEDULE (scop));
+ free_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
+ free_lst (SCOP_SAVED_SCHEDULE (scop));
XDELETE (scop);
}
for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
print_pbb (file, pbb);
- fprintf (file, ")\n");
-
fprintf (file, "original_lst (\n");
print_lst (file, SCOP_ORIGINAL_SCHEDULE (scop), 0);
fprintf (file, ")\n");
fprintf (file, "transformed_lst (\n");
print_lst (file, SCOP_TRANSFORMED_SCHEDULE (scop), 0);
fprintf (file, ")\n");
+
+ fprintf (file, ")\n");
}
/* Print to STDERR the domain of PBB. */
ppl_Linear_Expression_t le;
ppl_dimension_type dim;
- value_set_si (niter, -1);
-
/* Takes together domain and scattering polyhedrons, and composes
them into the bigger polyhedron that has the following format:
- t0..t_{n-1} | l0..l_{nlcl-1} | i0..i_{niter-1} | g0..g_{nparm-1}.
- t0..t_{n-1} are time dimensions (scattering dimensions)
- l0..l_{nclc-1} are local variables in scatterin function
- i0..i_{niter-1} are original iteration variables
- g0..g_{nparam-1} are global parameters. */
+ t0..t_{n-1} | l0..l_{nlcl-1} | i0..i_{niter-1} | g0..g_{nparm-1}
+
+ where
+ | t0..t_{n-1} are time dimensions (scattering dimensions)
+ | l0..l_{nclc-1} are local variables in scattering function
+ | i0..i_{niter-1} are original iteration variables
+ | g0..g_{nparam-1} are global parameters. */
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sctr,
+ PBB_TRANSFORMED_SCATTERING (pbb));
+
+ /* Extend the iteration domain with the scattering dimensions:
+ 0..0 | 0..0 | i0..i_{niter-1} | g0..g_{nparm-1}. */
ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
(&ext_domain, PBB_DOMAIN (pbb));
ppl_insert_dimensions_pointset (ext_domain, 0,
pbb_nb_scattering_transform (pbb)
+ pbb_nb_local_vars (pbb));
- ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sctr,
- PBB_TRANSFORMED_SCATTERING (pbb));
+
+ /* Add to sctr the extended domain. */
ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (sctr, ext_domain);
+ /* Extract the number of iterations. */
ppl_Pointset_Powerset_C_Polyhedron_space_dimension (sctr, &dim);
ppl_new_Linear_Expression_with_dimension (&le, dim);
ppl_set_coef (le, time_depth, 1);
+ value_set_si (niter, -1);
ppl_max_for_le_pointset (sctr, le, niter);
ppl_delete_Linear_Expression (le);
if (bb->loop_father == loop)
stmt = new_lst_stmt (pbb);
- else
+ else if (flow_bb_inside_loop_p (loop, bb))
{
- if (flow_bb_inside_loop_p (loop, bb))
- stmt = loop_to_lst (loop->inner, bbs, i);
- else
- {
- loop_p next = loop;
-
- while ((next = next->next)
- && !flow_bb_inside_loop_p (next, bb));
+ loop_p next = loop->inner;
- if (!next)
- return new_lst_loop (seq);
+ while (next && !flow_bb_inside_loop_p (next, bb))
+ next = next->next;
- stmt = loop_to_lst (next, bbs, i);
- }
+ stmt = loop_to_lst (next, bbs, i);
+ }
+ else
+ {
+ (*i)--;
+ return new_lst_loop (seq);
}
VEC_safe_push (lst_p, heap, seq, stmt);
void
scop_to_lst (scop_p scop)
{
- poly_bb_p pbb = VEC_index (poly_bb_p, SCOP_BBS (scop), 0);
- loop_p loop = outermost_loop_in_sese (SCOP_REGION (scop), GBB_BB (PBB_BLACK_BOX (pbb)));
- int i = 0;
+ lst_p res;
+ int i, n = VEC_length (poly_bb_p, SCOP_BBS (scop));
+ VEC (lst_p, heap) *seq = VEC_alloc (lst_p, heap, 5);
+ sese region = SCOP_REGION (scop);
+
+ for (i = 0; i < n; i++)
+ {
+ poly_bb_p pbb = VEC_index (poly_bb_p, SCOP_BBS (scop), i);
+ loop_p loop = outermost_loop_in_sese (region, GBB_BB (PBB_BLACK_BOX (pbb)));
+
+ if (loop_in_sese_p (loop, region))
+ res = loop_to_lst (loop, SCOP_BBS (scop), &i);
+ else
+ res = new_lst_stmt (pbb);
+
+ VEC_safe_push (lst_p, heap, seq, res);
+ }
- SCOP_ORIGINAL_SCHEDULE (scop) = loop_to_lst (loop, SCOP_BBS (scop), &i);
- SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (SCOP_ORIGINAL_SCHEDULE (scop));
+ res = new_lst_loop (seq);
+ SCOP_ORIGINAL_SCHEDULE (scop) = res;
+ SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (res);
}
/* Print LST to FILE with INDENT spaces of indentation. */
int i;
lst_p l;
- fprintf (file, "%d (loop", lst_dewey_number (lst));
+ if (LST_LOOP_FATHER (lst))
+ fprintf (file, "%d (loop", lst_dewey_number (lst));
+ else
+ fprintf (file, "(root");
for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
print_lst (file, l, indent + 2);
print_lst (stderr, lst, 0);
}
+/* Pretty print to FILE the loop statement tree LST in DOT format. */
+
+static void
+dot_lst_1 (FILE *file, lst_p lst)
+{
+ if (!lst)
+ return;
+
+ if (LST_LOOP_P (lst))
+ {
+ int i;
+ lst_p l;
+
+ if (!LST_LOOP_FATHER (lst))
+ fprintf (file, "L -> L_%d_%d\n",
+ lst_depth (lst),
+ lst_dewey_number (lst));
+ else
+ fprintf (file, "L_%d_%d -> L_%d_%d\n",
+ lst_depth (LST_LOOP_FATHER (lst)),
+ lst_dewey_number (LST_LOOP_FATHER (lst)),
+ lst_depth (lst),
+ lst_dewey_number (lst));
+
+ for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ dot_lst_1 (file, l);
+ }
+
+ else
+ fprintf (file, "L_%d_%d -> S_%d\n",
+ lst_depth (LST_LOOP_FATHER (lst)),
+ lst_dewey_number (LST_LOOP_FATHER (lst)),
+ pbb_index (LST_PBB (lst)));
+
+}
+
+/* Display the LST using dotty. */
+
+void
+dot_lst (lst_p lst)
+{
+ /* When debugging, enable the following code. This cannot be used
+ in production compilers because it calls "system". */
+#if 0
+ int x;
+ FILE *stream = fopen ("/tmp/lst.dot", "w");
+ gcc_assert (stream);
+
+ fputs ("digraph all {\n", stream);
+ dot_lst_1 (stream, lst);
+ fputs ("}\n\n", stream);
+ fclose (stream);
+
+ x = system ("dotty /tmp/lst.dot");
+#else
+ fputs ("digraph all {\n", stderr);
+ dot_lst_1 (stderr, lst);
+ fputs ("}\n\n", stderr);
+
+#endif
+}
+
#endif