diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 05:31:36 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 05:31:36 +0000 |
commit | acba581956b8eb36ffcb56166286c148d544eac2 (patch) | |
tree | 344ce27f744edd0dc4cfd8b8894c04d59965f202 /gcc/graphite-interchange.c | |
parent | 64d8f27a1751f377b94dfa4ac0762dd15b6ea181 (diff) | |
download | gcc-acba581956b8eb36ffcb56166286c148d544eac2.tar.gz |
2009-11-18 Sebastian Pop <sebastian.pop@amd.com>
* graphite-interchange.c (memory_strides_in_loop_depth): New.
(pbb_interchange_profitable_p): Call memory_strides_in_loop_depth.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154639 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-interchange.c')
-rw-r--r-- | gcc/graphite-interchange.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c index 42a0b1dac7f..280a14e6d45 100644 --- a/gcc/graphite-interchange.c +++ b/gcc/graphite-interchange.c @@ -193,7 +193,7 @@ build_partial_difference (ppl_Pointset_Powerset_C_Polyhedron_t *p, /* Set STRIDE to the stride of PDR in memory by advancing by one in - time dimension DEPTH. */ + the loop at DEPTH. */ static void memory_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr) @@ -329,6 +329,32 @@ 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 */ + +static void +memory_strides_in_loop_depth (poly_bb_p pbb, graphite_dim_t depth, Value strides) +{ + int i; + poly_dr_p pdr; + Value s, n; + + value_set_si (strides, 0); + value_init (s); + value_init (n); + + for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++) + { + value_set_si (n, PDR_NB_REFS (pdr)); + + memory_stride_in_loop (s, depth, pdr); + value_multiply (s, s, n); + value_addto (strides, strides, s); + } + + value_clear (s); + value_clear (n); +} + /* Returns true when it is profitable to interchange time dimensions DEPTH1 and DEPTH2 with DEPTH1 < DEPTH2 for PBB. @@ -414,39 +440,21 @@ static bool pbb_interchange_profitable_p (graphite_dim_t depth1, graphite_dim_t depth2, poly_bb_p pbb) { - int i; - poly_dr_p pdr; - Value d1, d2, s, n; + Value d1, d2; bool res; gcc_assert (depth1 < depth2); value_init (d1); - value_set_si (d1, 0); value_init (d2); - value_set_si (d2, 0); - value_init (s); - value_init (n); - for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++) - { - value_set_si (n, PDR_NB_REFS (pdr)); - - memory_stride_in_loop (s, depth1, pdr); - value_multiply (s, s, n); - value_addto (d1, d1, s); - - memory_stride_in_loop (s, depth2, pdr); - value_multiply (s, s, n); - value_addto (d2, d2, s); - } + memory_strides_in_loop_depth (pbb, depth1, d1); + memory_strides_in_loop_depth (pbb, depth2, d2); res = value_lt (d1, d2); value_clear (d1); value_clear (d2); - value_clear (s); - value_clear (n); return res; } |