diff options
author | Sebastian Pop <sebpop@gmail.com> | 2017-10-06 11:26:33 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-10-06 11:26:33 +0000 |
commit | 312ce401906209132ac80b68b50ff2c21b2c1079 (patch) | |
tree | 11539f6d3d7f6cf76f3926ecf31a5b06d0e1c4b6 /gcc/graphite-dependences.c | |
parent | e78b10ceb987b6b71683f3731a283f329e5c6c9e (diff) | |
download | gcc-312ce401906209132ac80b68b50ff2c21b2c1079.zip gcc-312ce401906209132ac80b68b50ff2c21b2c1079.tar.gz gcc-312ce401906209132ac80b68b50ff2c21b2c1079.tar.bz2 |
graphite-dependences.c (scop_get_reads): Move code to...
2017-10-06 Sebastian Pop <sebpop@gmail.com>
* graphite-dependences.c (scop_get_reads): Move code to...
(scop_get_must_writes): Move code to...
(scop_get_may_writes): Move code to...
(scop_get_reads_and_writes): ... here.
(scop_get_dependences): Call scop_get_reads_and_writes.
From-SVN: r253486
Diffstat (limited to 'gcc/graphite-dependences.c')
-rw-r--r-- | gcc/graphite-dependences.c | 78 |
1 files changed, 21 insertions, 57 deletions
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index 4ed9d00..2066b2e 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -63,20 +63,21 @@ add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb) return constrain_domain (x, isl_set_copy (pbb->domain)); } -/* Returns all the memory reads in SCOP. */ +/* Returns an isl description of all memory operations in SCOP. The memory + reads are returned in READS and writes in MUST_WRITES and MAY_WRITES. */ -static isl_union_map * -scop_get_reads (scop_p scop) +static void +scop_get_reads_and_writes (scop_p scop, isl_union_map *reads, + isl_union_map *must_writes, + isl_union_map *may_writes) { int i, j; poly_bb_p pbb; poly_dr_p pdr; - isl_space *space = isl_set_get_space (scop->param_context); - isl_union_map *res = isl_union_map_empty (space); FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) { - FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr) + FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr) { if (pdr_read_p (pdr)) { if (dump_file) @@ -86,33 +87,14 @@ scop_get_reads (scop_p scop) } isl_union_map *um = isl_union_map_from_map (add_pdr_constraints (pdr, pbb)); - res = isl_union_map_union (res, um); + reads = isl_union_map_union (reads, um); if (dump_file) { fprintf (dump_file, "Reads depedence graph: "); - print_isl_union_map (dump_file, res); + print_isl_union_map (dump_file, reads); } } - } - - return isl_union_map_coalesce (res); -} - -/* Returns all the memory must writes in SCOP. */ - -static isl_union_map * -scop_get_must_writes (scop_p scop) -{ - int i, j; - poly_bb_p pbb; - poly_dr_p pdr; - isl_space *space = isl_set_get_space (scop->param_context); - isl_union_map *res = isl_union_map_empty (space); - - FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) - { - FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr) - if (pdr_write_p (pdr)) + else if (pdr_write_p (pdr)) { if (dump_file) { @@ -121,33 +103,14 @@ scop_get_must_writes (scop_p scop) } isl_union_map *um = isl_union_map_from_map (add_pdr_constraints (pdr, pbb)); - res = isl_union_map_union (res, um); + must_writes = isl_union_map_union (must_writes, um); if (dump_file) { fprintf (dump_file, "Must writes depedence graph: "); - print_isl_union_map (dump_file, res); + print_isl_union_map (dump_file, must_writes); } } - } - - return isl_union_map_coalesce (res); -} - -/* Returns all the memory may writes in SCOP. */ - -static isl_union_map * -scop_get_may_writes (scop_p scop) -{ - int i, j; - poly_bb_p pbb; - poly_dr_p pdr; - isl_space *space = isl_set_get_space (scop->param_context); - isl_union_map *res = isl_union_map_empty (space); - - FOR_EACH_VEC_ELT (scop->pbbs, i, pbb) - { - FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr) - if (pdr_may_write_p (pdr)) + else if (pdr_may_write_p (pdr)) { if (dump_file) { @@ -156,16 +119,15 @@ scop_get_may_writes (scop_p scop) } isl_union_map *um = isl_union_map_from_map (add_pdr_constraints (pdr, pbb)); - res = isl_union_map_union (res, um); + may_writes = isl_union_map_union (may_writes, um); if (dump_file) { fprintf (dump_file, "May writes depedence graph: "); - print_isl_union_map (dump_file, res); + print_isl_union_map (dump_file, may_writes); } } + } } - - return isl_union_map_coalesce (res); } /* Helper function used on each MAP of a isl_union_map. Computes the @@ -300,9 +262,11 @@ scop_get_dependences (scop_p scop) if (scop->dependence) return; - isl_union_map *reads = scop_get_reads (scop); - isl_union_map *must_writes = scop_get_must_writes (scop); - isl_union_map *may_writes = scop_get_may_writes (scop); + isl_space *space = isl_set_get_space (scop->param_context); + isl_union_map *reads = isl_union_map_empty (isl_space_copy (space)); + isl_union_map *must_writes = isl_union_map_empty (isl_space_copy (space)); + isl_union_map *may_writes = isl_union_map_empty (space); + scop_get_reads_and_writes (scop, reads, must_writes, may_writes); if (dump_file) { |