summaryrefslogtreecommitdiff
path: root/gcc/graphite-interchange.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2010-01-08 04:35:43 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-01-08 04:35:43 +0000
commiteaffa76227b6b049f692a9958d24f5fc4f9d27d1 (patch)
tree68af4bfdf48fe4b2e9486fc57eab043165cd3dd5 /gcc/graphite-interchange.c
parentbf69e7546b49ad9e5143e82e73bc051421205c12 (diff)
downloadgcc-eaffa76227b6b049f692a9958d24f5fc4f9d27d1.tar.gz
Memoize memory strides per loop.
2010-01-07 Sebastian Pop <sebastian.pop@amd.com> * graphite-interchange.c (memory_stride_in_loop): Renamed pdr_stride_in_loop. (memory_strides_in_loop): Renamed memory_strides_in_loop_1. (memory_strides_in_loop): Memoize the memory strides per loop. (lst_interchange_profitable_p): Do not initialize to zero the memory strides. * graphite-poly.h (struct lst): Add a field memory_strides. (LST_LOOP_MEMORY_STRIDES): New. (new_lst_loop): Initialize LST_LOOP_MEMORY_STRIDES to -1. (free_lst): Clear LST_LOOP_MEMORY_STRIDES. From-SVN: r155725
Diffstat (limited to 'gcc/graphite-interchange.c')
-rw-r--r--gcc/graphite-interchange.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index 90982f84f93..918e334e367 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -196,7 +196,7 @@ build_partial_difference (ppl_Pointset_Powerset_C_Polyhedron_t *p,
the loop at DEPTH. */
static void
-memory_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr)
+pdr_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr)
{
ppl_dimension_type time_depth;
ppl_Linear_Expression_t le, lma;
@@ -329,11 +329,12 @@ memory_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr)
ppl_delete_Linear_Expression (le);
}
+
/* Sets STRIDES to the sum of all the strides of the data references
accessed in LOOP at DEPTH. */
static void
-memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides)
+memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, Value strides)
{
int i, j;
lst_p l;
@@ -345,11 +346,11 @@ memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides)
for (j = 0; VEC_iterate (lst_p, LST_SEQ (loop), j, l); j++)
if (LST_LOOP_P (l))
- memory_strides_in_loop (l, depth, strides);
+ memory_strides_in_loop_1 (l, depth, strides);
else
for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (LST_PBB (l)), i, pdr); i++)
{
- memory_stride_in_loop (s, depth, pdr);
+ pdr_stride_in_loop (s, depth, pdr);
value_set_si (n, PDR_NB_REFS (pdr));
value_multiply (s, s, n);
value_addto (strides, strides, s);
@@ -359,6 +360,21 @@ memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides)
value_clear (n);
}
+/* Sets STRIDES to the sum of all the strides of the data references
+ accessed in LOOP at DEPTH. */
+
+static void
+memory_strides_in_loop (lst_p loop, graphite_dim_t depth, Value strides)
+{
+ if (value_mone_p (loop->memory_strides))
+ {
+ value_set_si (strides, 0);
+ memory_strides_in_loop_1 (loop, depth, strides);
+ }
+ else
+ value_assign (strides, loop->memory_strides);
+}
+
/* Return true when the interchange of loops LOOP1 and LOOP2 is
profitable.
@@ -452,8 +468,6 @@ lst_interchange_profitable_p (lst_p loop1, lst_p loop2)
value_init (d1);
value_init (d2);
- value_set_si (d1, 0);
- value_set_si (d2, 0);
memory_strides_in_loop (loop1, lst_depth (loop1), d1);
memory_strides_in_loop (loop2, lst_depth (loop2), d2);