[PATCH 16/20] interchange with isl

Sebastian Pop sebpop@gmail.com
Mon Aug 15 08:51:00 GMT 2011


---
 gcc/graphite-interchange.c |   17 +++++++++++++++++
 gcc/graphite-poly.h        |   16 ++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index b819ece..68b9c1e 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -502,6 +502,23 @@ pbb_interchange_loop_depths (graphite_dim_t depth1, graphite_dim_t depth2,
 
   ppl_Polyhedron_map_space_dimensions (poly, map, dim);
   free (map);
+
+  {
+    isl_dim *d = isl_map_get_dim (pbb->transformed);
+    isl_dim *d1 = isl_dim_range (d);
+    unsigned n = isl_dim_size (d1, isl_dim_out);
+    isl_dim *d2 = isl_dim_add (d1, isl_dim_in, n);
+    isl_map *x = isl_map_universe (d2);
+
+    x = isl_map_equate (x, isl_dim_in, dim1, isl_dim_out, dim2);
+    x = isl_map_equate (x, isl_dim_in, dim2, isl_dim_out, dim1);
+
+    for (i = 0; i < n; i++)
+      if (i != dim1 && i != dim2)
+	x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i);
+
+    pbb->transformed = isl_map_apply_range (pbb->transformed, x);
+  }
 }
 
 /* Apply the interchange of loops at depths DEPTH1 and DEPTH2 to all
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index b05e2e7..bf537b1 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -1148,6 +1148,22 @@ pbb_update_scattering (poly_bb_p pbb, graphite_dim_t level, int dewey)
   ppl_delete_Linear_Expression (expr);
   ppl_Polyhedron_add_constraint (ph, new_cstr);
   ppl_delete_Constraint (new_cstr);
+
+  {
+    isl_dim *d = isl_map_get_dim (pbb->transformed);
+    isl_dim *d1 = isl_dim_range (d);
+    unsigned i, n = isl_dim_size (d1, isl_dim_out);
+    isl_dim *d2 = isl_dim_add (d1, isl_dim_in, n);
+    isl_map *x = isl_map_universe (d2);
+
+    x = isl_map_fix_si (x, isl_dim_out, sched, dewey);
+
+    for (i = 0; i < n; i++)
+      if (i != sched)
+	x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i);
+
+    pbb->transformed = isl_map_apply_range (pbb->transformed, x);
+  }
 }
 
 /* Updates the scattering of all the PBBs under LST to be at the DEWEY
-- 
1.7.4.1



More information about the Gcc-patches mailing list