diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-20 23:01:12 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-20 23:01:12 +0000 |
commit | e1dfbe3090ccf6cfbc7275cfdfa38f71647de3ed (patch) | |
tree | 8c98991ecdce73acfe22e53e466031d83b2524c1 /gcc/graphite-sese-to-poly.c | |
parent | 6f44b17da48973c9fe4f7b690879dd90bf8a8c90 (diff) | |
parent | 1b2bf75690af8115739ebba710a44d05388c7a1a (diff) | |
download | gcc-e1dfbe3090ccf6cfbc7275cfdfa38f71647de3ed.tar.gz |
Merge in trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@202802 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r-- | gcc/graphite-sese-to-poly.c | 106 |
1 files changed, 43 insertions, 63 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index ebf03ddf640..b159f236092 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" -#include "tree-flow.h" +#include "tree-ssa.h" #include "tree-pass.h" #include "cfgloop.h" #include "tree-chrec.h" @@ -1191,14 +1191,6 @@ add_conditions_to_constraints (scop_p scop) add_conditions_to_domain (pbb); } -/* Structure used to pass data to dom_walk. */ - -struct bsc -{ - vec<gimple> *conditions, *cases; - sese region; -}; - /* Returns a COND_EXPR statement when BB has a single predecessor, the edge between BB and its predecessor is not a loop exit edge, and the last statement of the single predecessor is a COND_EXPR. */ @@ -1224,20 +1216,43 @@ single_pred_cond_non_loop_exit (basic_block bb) return NULL; } +class sese_dom_walker : public dom_walker +{ +public: + sese_dom_walker (cdi_direction, sese); + ~sese_dom_walker (); + + virtual void before_dom_children (basic_block); + virtual void after_dom_children (basic_block); + +private: + vec<gimple> conditions_, cases_; + sese region_; +}; + +sese_dom_walker::sese_dom_walker (cdi_direction direction, sese region) + : dom_walker (direction), region_ (region) +{ + conditions_.create (3); + cases_.create (3); +} + +sese_dom_walker::~sese_dom_walker () +{ + conditions_.release (); + cases_.release (); +} + /* Call-back for dom_walk executed before visiting the dominated blocks. */ -static void -build_sese_conditions_before (struct dom_walk_data *dw_data, - basic_block bb) +void +sese_dom_walker::before_dom_children (basic_block bb) { - struct bsc *data = (struct bsc *) dw_data->global_data; - vec<gimple> *conditions = data->conditions; - vec<gimple> *cases = data->cases; gimple_bb_p gbb; gimple stmt; - if (!bb_in_sese_p (bb, data->region)) + if (!bb_in_sese_p (bb, region_)) return; stmt = single_pred_cond_non_loop_exit (bb); @@ -1246,75 +1261,39 @@ build_sese_conditions_before (struct dom_walk_data *dw_data, { edge e = single_pred_edge (bb); - conditions->safe_push (stmt); + conditions_.safe_push (stmt); if (e->flags & EDGE_TRUE_VALUE) - cases->safe_push (stmt); + cases_.safe_push (stmt); else - cases->safe_push (NULL); + cases_.safe_push (NULL); } gbb = gbb_from_bb (bb); if (gbb) { - GBB_CONDITIONS (gbb) = conditions->copy (); - GBB_CONDITION_CASES (gbb) = cases->copy (); + GBB_CONDITIONS (gbb) = conditions_.copy (); + GBB_CONDITION_CASES (gbb) = cases_.copy (); } } /* Call-back for dom_walk executed after visiting the dominated blocks. */ -static void -build_sese_conditions_after (struct dom_walk_data *dw_data, - basic_block bb) +void +sese_dom_walker::after_dom_children (basic_block bb) { - struct bsc *data = (struct bsc *) dw_data->global_data; - vec<gimple> *conditions = data->conditions; - vec<gimple> *cases = data->cases; - - if (!bb_in_sese_p (bb, data->region)) + if (!bb_in_sese_p (bb, region_)) return; if (single_pred_cond_non_loop_exit (bb)) { - conditions->pop (); - cases->pop (); + conditions_.pop (); + cases_.pop (); } } -/* Record all conditions in REGION. */ - -static void -build_sese_conditions (sese region) -{ - struct dom_walk_data walk_data; - vec<gimple> conditions; - conditions.create (3); - vec<gimple> cases; - cases.create (3); - struct bsc data; - - data.conditions = &conditions; - data.cases = &cases; - data.region = region; - - walk_data.dom_direction = CDI_DOMINATORS; - walk_data.initialize_block_local_data = NULL; - walk_data.before_dom_children = build_sese_conditions_before; - walk_data.after_dom_children = build_sese_conditions_after; - walk_data.global_data = &data; - walk_data.block_local_data_size = 0; - - init_walk_dominator_tree (&walk_data); - walk_dominator_tree (&walk_data, SESE_ENTRY_BB (region)); - fini_walk_dominator_tree (&walk_data); - - conditions.release (); - cases.release (); -} - /* Add constraints on the possible values of parameter P from the type of P. */ @@ -3179,7 +3158,8 @@ build_poly_scop (scop_p scop) rewrite_commutative_reductions_out_of_ssa (scop); build_sese_loop_nests (region); - build_sese_conditions (region); + /* Record all conditions in REGION. */ + sese_dom_walker (CDI_DOMINATORS, region).walk (cfun->cfg->x_entry_block_ptr); find_scop_parameters (scop); max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS); |