diff options
author | Aditya Kumar <aditya.k7@samsung.com> | 2015-10-07 15:40:17 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2015-10-07 15:40:17 +0000 |
commit | bafcb15301475db9d9e73a73c41bda4082c276e9 (patch) | |
tree | 52d9f99e1a45ff8db4eea5f4b72274f513275471 /gcc/sese.h | |
parent | b850dd2f0b0c10067114eb0320b167be2ac87d6c (diff) | |
download | gcc-bafcb15301475db9d9e73a73c41bda4082c276e9.zip gcc-bafcb15301475db9d9e73a73c41bda4082c276e9.tar.gz gcc-bafcb15301475db9d9e73a73c41bda4082c276e9.tar.bz2 |
move graphite bookkeeping from sese to sese_info
2015-10-06 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-isl-ast-to-gimple.c (translate_isl_ast_to_gimple): Use
an sese_info_p.
(copy_def): Same.
(copy_internal_parameters): Same.
(translate_isl_ast_to_gimple): Use an sese_l.
(build_iv_mapping): Same.
* graphite-poly.c (new_sese): Rename new_sese_info.
(free_sese): Rename free_sese_info.
* graphite-poly.h (struct scop): Use an sese_info_p.
(scop_set_region): Same.
* graphite-scop-detection.c (struct sese_l): Moved...
(get_entry_bb): Moved...
(get_exit_bb): Moved...
(parameter_index_in_region_1): Use an sese_info_p.
(parameter_index_in_region): Same.
(scan_tree_for_params): Same.
(find_params_in_bb): Same.
(sese_dom_walker): Use an sese_l.
* graphite-sese-to-poly.c (remove_invariant_phi): Same.
(reduction_phi_p): Same.
(parameter_index_in_region_1): Use an sese_info_p.
(propagate_expr_outside_region): Use an sese_l.
* graphite.c: Replace uses of SCOP_REGION.
* sese.c (sese_record_loop): Use an sese_info_p.
(build_sese_loop_nests): Same.
(sese_build_liveouts_use): Same.
(sese_build_liveouts_bb): Same.
(sese_build_liveouts_bb): Same.
(sese_bad_liveouts_use): Same.
(sese_reset_debug_liveouts_bb): Same.
(sese_build_liveouts): Same.
(new_sese): Renamed new_sese_info.
(free_sese): Renamed free_sese_info.
(set_rename): Use an sese_info_p.
(graphite_copy_stmts_from_block): Same.
(copy_bb_and_scalar_dependences): Same.
(outermost_loop_in_sese_1): Use an sese_l.
(outermost_loop_in_sese): Same.
(if_region_set_false_region): Use an sese_info_p.
(move_sese_in_condition): Same.
(scalar_evolution_in_region): Use an sese_l.
* sese.h (struct sese_l): ... here.
(SESE_ENTRY): Remove.
(SESE_ENTRY_BB): Remove.
(SESE_EXIT): Remove.
(SESE_EXIT_BB): Remove.
(sese_contains_loop): Use an sese_info_p.
(sese_nb_params): Same.
(bb_in_sese_p): Use an sese_l.
(stmt_in_sese_p): Same.
(defined_in_sese_p): Same.
(loop_in_sese_p): Same.
(sese_loop_depth): Same.
(struct ifsese_s): Use an sese_info_p.
(gbb_loop_at_index): Use an sese_l.
(nb_common_loops): Same.
(scev_analyzable_p): Same.
Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r228572
Diffstat (limited to 'gcc/sese.h')
-rw-r--r-- | gcc/sese.h | 124 |
1 files changed, 73 insertions, 51 deletions
@@ -26,10 +26,48 @@ typedef hash_map<tree, tree> parameter_rename_map_t; /* A Single Entry, Single Exit region is a part of the CFG delimited by two edges. */ -typedef struct sese_s +struct sese_l { - /* Single ENTRY and single EXIT from the SESE region. */ - edge entry, exit; + sese_l (edge e, edge x) : entry (e), exit (x) {} + + /* This is to push objects of sese_l in a vec. */ + sese_l (int i) : entry (NULL), exit (NULL) { gcc_assert (i == 0); } + + operator bool () const { return entry && exit; } + + const sese_l & + operator= (const sese_l &s) + { + entry = s.entry; + exit = s.exit; + return *this; + } + + edge entry; + edge exit; +}; + +/* Get the entry of an sese S. */ + +static inline basic_block +get_entry_bb (sese_l &s) +{ + return s.entry->dest; +} + +/* Get the exit of an sese S. */ + +static inline basic_block +get_exit_bb (sese_l &s) +{ + return s.exit->src; +} + +/* A helper structure for bookkeeping information about a scop in graphite. */ +typedef struct sese_info_t +{ + /* The SESE region. */ + sese_l region; /* Parameters used within the SCOP. */ vec<tree> params; @@ -45,31 +83,27 @@ typedef struct sese_s can only add new params before generating the bb domains, otherwise they become invalid. */ bool add_params; -} *sese; +} *sese_info_p; -#define SESE_ENTRY(S) (S->entry) -#define SESE_ENTRY_BB(S) (S->entry->dest) -#define SESE_EXIT(S) (S->exit) -#define SESE_EXIT_BB(S) (S->exit->dest) #define SESE_PARAMS(S) (S->params) #define SESE_LOOPS(S) (S->loops) #define SESE_LOOP_NEST(S) (S->loop_nest) #define SESE_ADD_PARAMS(S) (S->add_params) -extern sese new_sese (edge, edge); -extern void free_sese (sese); -extern void sese_insert_phis_for_liveouts (sese, basic_block, edge, edge); -extern void build_sese_loop_nests (sese); -extern edge copy_bb_and_scalar_dependences (basic_block, sese, edge, +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 edge copy_bb_and_scalar_dependences (basic_block, sese_info_p, edge, vec<tree> , bool *); -extern struct loop *outermost_loop_in_sese (sese, basic_block); -extern tree scalar_evolution_in_region (sese, loop_p, tree); -extern bool invariant_in_sese_p_rec (tree, sese); +extern struct loop *outermost_loop_in_sese (sese_l &, basic_block); +extern tree scalar_evolution_in_region (sese_l &, loop_p, tree); +extern bool invariant_in_sese_p_rec (tree, sese_l &); /* Check that SESE contains LOOP. */ static inline bool -sese_contains_loop (sese sese, struct loop *loop) +sese_contains_loop (sese_info_p sese, struct loop *loop) { return bitmap_bit_p (SESE_LOOPS (sese), loop->num); } @@ -77,7 +111,7 @@ sese_contains_loop (sese sese, struct loop *loop) /* The number of parameters in REGION. */ static inline unsigned -sese_nb_params (sese region) +sese_nb_params (sese_info_p region) { return SESE_PARAMS (region).length (); } @@ -109,36 +143,32 @@ bb_in_region (basic_block bb, basic_block entry, basic_block exit) EXIT blocks. */ static inline bool -bb_in_sese_p (basic_block bb, sese region) +bb_in_sese_p (basic_block bb, sese_l &r) { - basic_block entry = SESE_ENTRY_BB (region); - basic_block exit = SESE_EXIT_BB (region); - - return bb_in_region (bb, entry, exit); + return bb_in_region (bb, r.entry->dest, r.exit->dest); } /* Returns true when STMT is defined in REGION. */ static inline bool -stmt_in_sese_p (gimple *stmt, sese region) +stmt_in_sese_p (gimple *stmt, sese_l &r) { basic_block bb = gimple_bb (stmt); - return bb && bb_in_sese_p (bb, region); + return bb && bb_in_sese_p (bb, r); } /* Returns true when NAME is defined in REGION. */ static inline bool -defined_in_sese_p (tree name, sese region) +defined_in_sese_p (tree name, sese_l &r) { - gimple *stmt = SSA_NAME_DEF_STMT (name); - return stmt_in_sese_p (stmt, region); + return stmt_in_sese_p (SSA_NAME_DEF_STMT (name), r); } /* Returns true when LOOP is in REGION. */ static inline bool -loop_in_sese_p (struct loop *loop, sese region) +loop_in_sese_p (struct loop *loop, sese_l ®ion) { return (bb_in_sese_p (loop->header, region) && bb_in_sese_p (loop->latch, region)); @@ -168,7 +198,7 @@ loop_in_sese_p (struct loop *loop, sese region) loop_2 is completely contained -> depth 1 */ static inline unsigned int -sese_loop_depth (sese region, loop_p loop) +sese_loop_depth (sese_l ®ion, loop_p loop) { unsigned int depth = 0; @@ -183,7 +213,7 @@ sese_loop_depth (sese region, loop_p loop) /* Splits BB to make a single entry single exit region. */ -static inline sese +static inline sese_info_p split_region_for_bb (basic_block bb) { edge entry, exit; @@ -205,15 +235,7 @@ split_region_for_bb (basic_block bb) exit = split_block (bb, gsi_stmt (gsi)); } - return new_sese (entry, exit); -} - -/* Returns the block preceding the entry of a SESE. */ - -static inline basic_block -block_before_sese (sese sese) -{ - return SESE_ENTRY (sese)->src; + return new_sese_info (entry, exit); } @@ -221,13 +243,13 @@ block_before_sese (sese sese) /* A single entry single exit specialized for conditions. */ typedef struct ifsese_s { - sese region; - sese true_region; - sese false_region; + sese_info_p region; + sese_info_p true_region; + sese_info_p false_region; } *ifsese; -extern void if_region_set_false_region (ifsese, sese); -extern ifsese move_sese_in_condition (sese); +extern void if_region_set_false_region (ifsese, sese_info_p); +extern ifsese move_sese_in_condition (sese_info_p); extern edge get_true_edge_from_guard_bb (basic_block); extern edge get_false_edge_from_guard_bb (basic_block); extern void set_ifsese_condition (ifsese, tree); @@ -235,13 +257,13 @@ extern void set_ifsese_condition (ifsese, tree); static inline edge if_region_entry (ifsese if_region) { - return SESE_ENTRY (if_region->region); + return if_region->region->region.entry; } static inline edge if_region_exit (ifsese if_region) { - return SESE_EXIT (if_region->region); + return if_region->region->region.exit; } static inline basic_block @@ -311,7 +333,7 @@ gbb_loop (gimple_poly_bb_p gbb) If there is no corresponding gimple loop, we return NULL. */ static inline loop_p -gbb_loop_at_index (gimple_poly_bb_p gbb, sese region, int index) +gbb_loop_at_index (gimple_poly_bb_p gbb, sese_l ®ion, int index) { loop_p loop = gbb_loop (gbb); int depth = sese_loop_depth (region, loop); @@ -319,7 +341,7 @@ gbb_loop_at_index (gimple_poly_bb_p gbb, sese region, int index) while (--depth > index) loop = loop_outer (loop); - gcc_assert (sese_contains_loop (region, loop)); + gcc_assert (loop_in_sese_p (loop, region)); return loop; } @@ -327,7 +349,7 @@ gbb_loop_at_index (gimple_poly_bb_p gbb, sese region, int index) /* The number of common loops in REGION for GBB1 and GBB2. */ static inline int -nb_common_loops (sese region, gimple_poly_bb_p gbb1, gimple_poly_bb_p gbb2) +nb_common_loops (sese_l ®ion, gimple_poly_bb_p gbb1, gimple_poly_bb_p gbb2) { loop_p l1 = gbb_loop (gbb1); loop_p l2 = gbb_loop (gbb2); @@ -340,7 +362,7 @@ nb_common_loops (sese region, gimple_poly_bb_p gbb1, gimple_poly_bb_p gbb2) evolution analyzer. */ static inline bool -scev_analyzable_p (tree def, sese region) +scev_analyzable_p (tree def, sese_l ®ion) { loop_p loop; tree scev; |