diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-18 02:39:50 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-18 02:39:50 +0000 |
commit | 54c9164053bed04b7797378ceb2652492d93f4e6 (patch) | |
tree | 20df7a9ff9e90aef22efdbedc2005fb546209870 /gcc/domwalk.h | |
parent | 5baed18933c8c68c9cafb921fac02c562843be20 (diff) | |
download | gcc-54c9164053bed04b7797378ceb2652492d93f4e6.tar.gz |
* compare-elim.c (find_comparison_dom_walker): New class
(find_comparisons_in_bb): Rename to
find_comparison_dom_walker::before_dom_children
(find_comparisons): Adjust
* domwalk.c (walk_dominator_tree): Rename to dom_walker::walk, and
adjust.
(init_walk_dominator_tree, fini_walk_dominator_tree): Remove
* domwalk.h (dom_walk_data): Convert it To a class dom_walker.
(init_walk_dominator_tree): Remove declaration.
(fini_walk_dominator_tree): Remove declaration.
* fwprop.c (single_def_use_dom_walker): New class
(single_def_use_enter_block): Convert to
single_def_use_dom_walker::before_dom_children.
(single_def_use_leave_block): Convert to
single_def_use_dom_walker::after_dom_children.
(build_single_def_use_links): Adjust.
* gimple-ssa-strength-reduction.c (find_candidates_dom_walker): New
class.
(find_candidates_in_block): Convert to
find_candidates_dom_walker::before_dom_children.
(execute_strength_reduction): Adjust.
* graphite-sese-to-poly.c (struct bsc, build_sese_conditions): Remove.
(sese_dom_walker): New class.
(sese_dom_walker::sese_dom_walker): New constructor.
(sese_dom_walker::~sese_dom_walker): New destructor.
(build_sese_conditions_before): Convert to
sese_dom_walker::before_dom_children.
(build_sese_conditions_after): Convert to
sese_dom_walker::after_dom_children.
(build_poly_scop): Adjust
* tree-into-ssa.c (rewrite_dom_walker): New class
(rewrite_enter_block): Convert to
rewrite_dom_walker::before_dom_children.
(rewrite_leave_block): Convert to
rewrite_dom_walker::after_dom_children.
(rewrite_update_dom_walker): New class.
(rewrite_update_enter_block): Convert to
rewrite_update_dom_walker::before_dom_children.
(rewrite_update_leave_block): Convert to
rewrite_update_dom_walker::after_dom_children.
(rewrite_blocks, rewrite_into_ssa): Adjust.
(mark_def_dom_walker): New class.
(mark_def_dom_walker::mark_def_dom_walker): New constructor.
(mark_def_dom_walker::~mark_def_dom_walker): New destructor.
(mark_def_sites_blocks): Convert to
mark_def_dom_walker::before_dom_children.
(mark_def_site_blocks): Remove.
* tree-ssa-dom.c (dom_opt_dom_walker): New class.
(tree_ssa_dominator_optimize): Adjust.
(dom_thread_across_edge): Convert to method
dom_opt_dom_walker::thread_across_edge.
(dom_opt_enter_block): Convert to member function
dom_opt_dom_walker::before_dom_children.
(dom_opt_leave_block): Convert to member function
dom_opt_dom_walker::after_dom_children.
* tree-ssa-dse.c (dse_dom_walker): New class.
(dse_enter_block): Convert to member function
dse_dom_walker::before_dom_children.
(tree_ssa_dse): Adjust.
* tree-ssa-loop-im.c (invariantness_dom_walker): New class.
(determine_invariantness_stmt): Convert to method
invariantness_dom_walker::before_dom_children.
(determine_invariantness): Remove
(move_computations_dom_walker): New class.
(move_computations_stmt): Convert to method
move_computations_dom_walker::before_dom_children.
(move_computations, tree_ssa_lim): Adjust.
* tree-ssa-phiopt.c (nontrapping_dom_walker): new class
(nt_init_block): Make method
notrappping_dom_walker::before_dom_children.
(nt_fini_block): Make
method nontrapping_dom_walker::after_dom_children.
(get_non_trapping): Adjust.
* tree-ssa-pre.c (eliminate_dom_walker): New class.
(eliminate_bb): Make method eliminate_dom_walker::before_dom_children.
(eliminate_leave_block): Make method.
eliminate_dom_walker::after_dom_children.
(eliminate): Adjust
* tree-ssa-strlen.c (strlen_dom_walker): New class.
(strlen_enter_block): Make method
strlen_dom_walker::before_dom_children.
(strlen_leave_block): Make
method strlen_dom_walker::after_dom_children.
(tree_ssa_strlen): Adjust.
* tree-ssa-uncprop.c (uncprop_dom_walker): New class.
(tree_ssa_uncprop): Adjust.
(uncprop_leave_block): Make method
uncprop_dom_walker::after_dom_children.
(uncprop_leave_block): Make method
uncprop_dom_walker::before_dom_children.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202679 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/domwalk.h')
-rw-r--r-- | gcc/domwalk.h | 68 |
1 files changed, 23 insertions, 45 deletions
diff --git a/gcc/domwalk.h b/gcc/domwalk.h index 54b7f3c86d9..b33d70eda23 100644 --- a/gcc/domwalk.h +++ b/gcc/domwalk.h @@ -18,57 +18,35 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -typedef void *void_p; - -/* This is the main data structure for the dominator walker. It provides - the callback hooks as well as a convenient place to hang block local - data and pass-global data. */ - -struct dom_walk_data +#ifndef GCC_DOM_WALK_H +#define GCC_DOM_WALK_H + +/** + * This is the main class for the dominator walker. It is expected that + * consumers will have a custom class inheriting from it, which will over ride + * at least one of before_dom_children and after_dom_children to implement the + * custom behavior. + */ +class dom_walker { - /* This is the direction of the dominator tree we want to walk. i.e., - if it is set to CDI_DOMINATORS, then we walk the dominator tree, - if it is set to CDI_POST_DOMINATORS, then we walk the post - dominator tree. */ - ENUM_BITFIELD (cdi_direction) dom_direction : 2; - - /* Function to initialize block local data. +public: + dom_walker (cdi_direction direction) : dom_direction_ (direction) {} - Note that the dominator walker infrastructure may provide a new - fresh, and zero'd block local data structure, or it may re-use an - existing block local data structure. - - If the block local structure has items such as virtual arrays, then - that allows your optimizer to re-use those arrays rather than - creating new ones. */ - void (*initialize_block_local_data) (struct dom_walk_data *, - basic_block, bool); + /* Walk the dominator tree. */ + void walk (basic_block); /* Function to call before the recursive walk of the dominator children. */ - void (*before_dom_children) (struct dom_walk_data *, basic_block); + virtual void before_dom_children (basic_block) {} /* Function to call after the recursive walk of the dominator children. */ - void (*after_dom_children) (struct dom_walk_data *, basic_block); - - /* Global data for a walk through the dominator tree. */ - void *global_data; + virtual void after_dom_children (basic_block) {} - /* Stack of any data we need to keep on a per-block basis. - - If you have no local data, then BLOCK_DATA_STACK will be NULL. */ - vec<void_p> block_data_stack; - - /* Size of the block local data. If this is zero, then it is assumed - you have no local data and thus no BLOCK_DATA_STACK as well. */ - size_t block_local_data_size; - - /* From here below are private data. Please do not use this - information/data outside domwalk.c. */ - - /* Stack of available block local structures. */ - vec<void_p> free_block_data; +private: + /* This is the direction of the dominator tree we want to walk. i.e., + if it is set to CDI_DOMINATORS, then we walk the dominator tree, + if it is set to CDI_POST_DOMINATORS, then we walk the post + dominator tree. */ + const ENUM_BITFIELD (cdi_direction) dom_direction_ : 2; }; -void walk_dominator_tree (struct dom_walk_data *, basic_block); -void init_walk_dominator_tree (struct dom_walk_data *); -void fini_walk_dominator_tree (struct dom_walk_data *); +#endif |