diff options
author | Aditya Kumar <aditya.k7@samsung.com> | 2016-01-21 02:13:14 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2016-01-21 02:13:14 +0000 |
commit | 5431c9ea56229569343aa9ddc6b176916b41f248 (patch) | |
tree | 234fcd82f7d5202fe9ee93e08fcfad10ffa19491 /gcc | |
parent | d7eff5b2843c5113220b825704600408558f4236 (diff) | |
download | gcc-5431c9ea56229569343aa9ddc6b176916b41f248.zip gcc-5431c9ea56229569343aa9ddc6b176916b41f248.tar.gz gcc-5431c9ea56229569343aa9ddc6b176916b41f248.tar.bz2 |
record loops in execution order
* graphite-scop-detection.c (record_loop_in_sese): New.
(gather_bbs::before_dom_children): Call record_loop_in_sese.
(build_scops): Remove call to build_sese_loop_nests.
* sese.c (sese_record_loop): Remove.
(build_sese_loop_nests): Remove.
(new_sese_info): Remove region->loops.
(free_sese_info): Same.
* sese.h (sese_contains_loop): Same.
(build_sese_loop_nests): Remove.
(sese_contains_loop): Remove.
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r232654
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/graphite-scop-detection.c | 29 | ||||
-rw-r--r-- | gcc/sese.c | 54 | ||||
-rw-r--r-- | gcc/sese.h | 10 |
4 files changed, 40 insertions, 67 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f55177c..ca0bb51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,20 @@ 2016-01-21 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> + * graphite-scop-detection.c (record_loop_in_sese): New. + (gather_bbs::before_dom_children): Call record_loop_in_sese. + (build_scops): Remove call to build_sese_loop_nests. + * sese.c (sese_record_loop): Remove. + (build_sese_loop_nests): Remove. + (new_sese_info): Remove region->loops. + (free_sese_info): Same. + * sese.h (sese_contains_loop): Same. + (build_sese_loop_nests): Remove. + (sese_contains_loop): Remove. + +2016-01-21 Aditya Kumar <aditya.k7@samsung.com> + Sebastian Pop <s.pop@samsung.com> + * graphite-scop-detection.c (loop_is_valid_scop): Renamed loop_is_valid_in_scop. (scop_detection::harmful_stmt_in_region): Renamed harmful_loop_in_region. Call loop_is_valid_in_scop. diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index cd376d1..68b9f4d 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1874,15 +1874,40 @@ gather_bbs::gather_bbs (cdi_direction direction, scop_p scop) { } +/* Record in execution order the loops fully contained in the region. */ + +static void +record_loop_in_sese (basic_block bb, sese_info_p region) +{ + loop_p father = bb->loop_father; + if (loop_in_sese_p (father, region->region)) + { + bool found = false; + loop_p loop0; + int j; + FOR_EACH_VEC_ELT (region->loop_nest, j, loop0) + if (father == loop0) + { + found = true; + break; + } + if (!found) + region->loop_nest.safe_push (father); + } +} + /* Call-back for dom_walk executed before visiting the dominated blocks. */ edge gather_bbs::before_dom_children (basic_block bb) { - if (!bb_in_sese_p (bb, scop->scop_info->region)) + sese_info_p region = scop->scop_info; + if (!bb_in_sese_p (bb, region->region)) return NULL; + record_loop_in_sese (bb, region); + gcond *stmt = single_pred_cond_non_loop_exit (bb); if (stmt) @@ -1991,8 +2016,6 @@ build_scops (vec<scop_p> *scops) continue; } - build_sese_loop_nests (scop->scop_info); - find_scop_parameters (scop); graphite_dim_t max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS); @@ -43,56 +43,6 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #include "tree-ssa-propagate.h" -/* Record LOOP as occurring in REGION. */ - -static void -sese_record_loop (sese_info_p region, loop_p loop) -{ - if (sese_contains_loop (region, loop)) - return; - - bitmap_set_bit (region->loops, loop->num); - region->loop_nest.safe_push (loop); -} - -/* Build the loop nests contained in REGION. Returns true when the - operation was successful. */ - -void -build_sese_loop_nests (sese_info_p region) -{ - unsigned i; - basic_block bb; - struct loop *loop0, *loop1; - - FOR_EACH_BB_FN (bb, cfun) - if (bb_in_sese_p (bb, region->region)) - { - struct loop *loop = bb->loop_father; - - /* Only add loops if they are completely contained in the SCoP. */ - if (loop->header == bb - && bb_in_sese_p (loop->latch, region->region)) - sese_record_loop (region, loop); - } - - /* Make sure that the loops in the SESE_LOOP_NEST are ordered. It - can be the case that an inner loop is inserted before an outer - loop. To avoid this, semi-sort once. */ - FOR_EACH_VEC_ELT (region->loop_nest, i, loop0) - { - if (region->loop_nest.length () == i + 1) - break; - - loop1 = region->loop_nest[i + 1]; - if (loop0->num > loop1->num) - { - region->loop_nest[i] = loop1; - region->loop_nest[i + 1] = loop0; - } - } -} - /* For a USE in BB, if BB is outside REGION, mark the USE in the LIVEOUTS set. */ @@ -228,7 +178,6 @@ new_sese_info (edge entry, edge exit) region->region.entry = entry; region->region.exit = exit; - region->loops = BITMAP_ALLOC (NULL); region->loop_nest.create (3); region->params.create (3); region->rename_map = new rename_map_t; @@ -244,9 +193,6 @@ new_sese_info (edge entry, edge exit) void free_sese_info (sese_info_p region) { - if (region->loops) - region->loops = BITMAP_ALLOC (NULL); - region->params.release (); region->loop_nest.release (); @@ -86,7 +86,6 @@ typedef struct sese_info_t rename_map_t *rename_map; /* Loops completely contained in this SESE. */ - bitmap loops; vec<loop_p> loop_nest; /* Basic blocks contained in this SESE. */ @@ -107,20 +106,11 @@ typedef struct sese_info_t extern sese_info_p new_sese_info (edge, edge); extern void free_sese_info (sese_info_p); extern void sese_insert_phis_for_liveouts (sese_info_p, basic_block, edge, edge); -extern void build_sese_loop_nests (sese_info_p); extern struct loop *outermost_loop_in_sese (sese_l &, basic_block); extern tree scalar_evolution_in_region (const sese_l &, loop_p, tree); extern bool scev_analyzable_p (tree, sese_l &); extern bool invariant_in_sese_p_rec (tree, const sese_l &, bool *); -/* Check that SESE contains LOOP. */ - -static inline bool -sese_contains_loop (sese_info_p sese, struct loop *loop) -{ - return bitmap_bit_p (sese->loops, loop->num); -} - /* The number of parameters in REGION. */ static inline unsigned |