diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2009-08-28 20:40:59 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-08-28 20:40:59 +0000 |
commit | 7bd2a8a7ef778f7425121974cea4204a11c24388 (patch) | |
tree | f4bc77546493208666cd3b4afa7a90ecb6195f6a /gcc/graphite-poly.c | |
parent | 93b2db87bba9552a502db78e9e9bcd67b5687c98 (diff) | |
download | gcc-7bd2a8a7ef778f7425121974cea4204a11c24388.zip gcc-7bd2a8a7ef778f7425121974cea4204a11c24388.tar.gz gcc-7bd2a8a7ef778f7425121974cea4204a11c24388.tar.bz2 |
graphite-interchange.c (pbb_interchange_profitable_p): Adjust the strides by multiplying by PDR_NB_REFS.
2009-08-28 Sebastian Pop <sebastian.pop@amd.com>
* graphite-interchange.c (pbb_interchange_profitable_p): Adjust
the strides by multiplying by PDR_NB_REFS.
* graphite-poly.c (can_collapse_pdr): New.
(pdr_find_duplicate): New.
(new_poly_dr): Call pdr_find_duplicate. Collapse duplicate PDRs.
Initialize PDR_NB_REFS.
* graphite-poly.h (struct poly_dr): Add field nb_refs.
(PDR_NB_REFS): New.
(new_poly_dr): Number of subscripts is a graphite_dim_t.
From-SVN: r151191
Diffstat (limited to 'gcc/graphite-poly.c')
-rw-r--r-- | gcc/graphite-poly.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 21bba6c6..3e005d4 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -261,6 +261,53 @@ apply_poly_transforms (scop_p scop) return transform_done; } +/* Returns true when PDR in the same PBB and is a duplicate of the + data reference described by ACCESSES, TYPE, and NB_SUBSCRIPTS. */ + +static inline bool +can_collapse_pdr (poly_dr_p pdr, poly_bb_p pbb, + ppl_Pointset_Powerset_C_Polyhedron_t accesses, + enum poly_dr_type type, graphite_dim_t nb_subscripts) +{ + bool res = false; + ppl_Pointset_Powerset_C_Polyhedron_t af, diff; + + if (PDR_PBB (pdr) != pbb + || PDR_NB_SUBSCRIPTS (pdr) != nb_subscripts + || PDR_TYPE (pdr) != type) + return false; + + ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron + (&diff, accesses); + af = PDR_ACCESSES (pdr); + ppl_Pointset_Powerset_C_Polyhedron_difference_assign (diff, af); + + if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (diff)) + res = true; + + ppl_delete_Pointset_Powerset_C_Polyhedron (diff); + return res; +} + +/* Returns a duplicate of the data reference described by ACCESSES, + TYPE, and NB_SUBSCRIPTS in the vector PBB_DRS (PBB). If there is + no duplicate, returns NULL. */ + +static inline poly_dr_p +pdr_find_duplicate (poly_bb_p pbb, + ppl_Pointset_Powerset_C_Polyhedron_t accesses, + enum poly_dr_type type, graphite_dim_t nb_subscripts) +{ + int i; + poly_dr_p pdr; + + for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++) + if (can_collapse_pdr (pdr, pbb, accesses, type, nb_subscripts)) + return pdr; + + return NULL; +} + /* Create a new polyhedral data reference and add it to PBB. It is defined by its ACCESSES, its TYPE, and the number of subscripts NB_SUBSCRIPTS. */ @@ -268,12 +315,21 @@ apply_poly_transforms (scop_p scop) void new_poly_dr (poly_bb_p pbb, ppl_Pointset_Powerset_C_Polyhedron_t accesses, - enum poly_dr_type type, void *cdr, int nb_subscripts) + enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts) { - poly_dr_p pdr = XNEW (struct poly_dr); static int id = 0; + poly_dr_p pdr; + poly_dr_p same = pdr_find_duplicate (pbb, accesses, type, nb_subscripts); + + if (same) + { + PDR_NB_REFS (same) += 1; + return; + } + pdr = XNEW (struct poly_dr); PDR_ID (pdr) = id++; + PDR_NB_REFS (pdr) = 1; PDR_PBB (pdr) = pbb; PDR_ACCESSES (pdr) = accesses; PDR_TYPE (pdr) = type; |