diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2013-09-18 02:39:50 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2013-09-17 20:39:50 -0600 |
commit | 4d9192b50c325156ab000884a57a3d7cfe4f79c6 (patch) | |
tree | 20df7a9ff9e90aef22efdbedc2005fb546209870 /gcc/domwalk.c | |
parent | 3b3cc26bcc127eceeb6d257313555fc2149cf6d4 (diff) | |
download | gcc-4d9192b50c325156ab000884a57a3d7cfe4f79c6.tar.gz |
compare-elim.c (find_comparison_dom_walker): New class
* 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.
From-SVN: r202679
Diffstat (limited to 'gcc/domwalk.c')
-rw-r--r-- | gcc/domwalk.c | 87 |
1 files changed, 12 insertions, 75 deletions
diff --git a/gcc/domwalk.c b/gcc/domwalk.c index 8c1ddc69490..bffa4aa4851 100644 --- a/gcc/domwalk.c +++ b/gcc/domwalk.c @@ -144,23 +144,17 @@ cmp_bb_postorder (const void *a, const void *b) } /* Recursively walk the dominator tree. - - WALK_DATA contains a set of callbacks to perform pass-specific - actions during the dominator walk as well as a stack of block local - data maintained during the dominator walk. - BB is the basic block we are currently visiting. */ void -walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) +dom_walker::walk (basic_block bb) { - void *bd = NULL; basic_block dest; basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks * 2); int sp = 0; int *postorder, postorder_num; - if (walk_data->dom_direction == CDI_DOMINATORS) + if (dom_direction_ == CDI_DOMINATORS) { postorder = XNEWVEC (int, n_basic_blocks); postorder_num = inverted_post_order_compute (postorder); @@ -177,37 +171,9 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) || bb == ENTRY_BLOCK_PTR || bb == EXIT_BLOCK_PTR) { - /* Callback to initialize the local data structure. */ - if (walk_data->initialize_block_local_data) - { - bool recycled; - - /* First get some local data, reusing any local data - pointer we may have saved. */ - if (walk_data->free_block_data.length () > 0) - { - bd = walk_data->free_block_data.pop (); - recycled = 1; - } - else - { - bd = xcalloc (1, walk_data->block_local_data_size); - recycled = 0; - } - - /* Push the local data into the local data stack. */ - walk_data->block_data_stack.safe_push (bd); - - /* Call the initializer. */ - walk_data->initialize_block_local_data (walk_data, bb, - recycled); - - } - - /* Callback for operations to execute before we have walked the - dominator children, but before we walk statements. */ - if (walk_data->before_dom_children) - (*walk_data->before_dom_children) (walk_data, bb); + /* Callback for subclasses to do custom things before we have walked + the dominator children, but before we walk statements. */ + before_dom_children (bb); /* Mark the current BB to be popped out of the recursion stack once children are processed. */ @@ -215,10 +181,10 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) worklist[sp++] = NULL; int saved_sp = sp; - for (dest = first_dom_son (walk_data->dom_direction, bb); - dest; dest = next_dom_son (walk_data->dom_direction, dest)) + for (dest = first_dom_son (dom_direction_, bb); + dest; dest = next_dom_son (dom_direction_, dest)) worklist[sp++] = dest; - if (walk_data->dom_direction == CDI_DOMINATORS) + if (dom_direction_ == CDI_DOMINATORS) switch (sp - saved_sp) { case 0: @@ -235,48 +201,19 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) --sp; bb = worklist[--sp]; - /* Callback for operations to execute after we have walked the - dominator children, but before we walk statements. */ - if (walk_data->after_dom_children) - (*walk_data->after_dom_children) (walk_data, bb); - - if (walk_data->initialize_block_local_data) - { - /* And finally pop the record off the block local data stack. */ - bd = walk_data->block_data_stack.pop (); - /* And save the block data so that we can re-use it. */ - walk_data->free_block_data.safe_push (bd); - } + /* Callback allowing subclasses to do custom things after we have + walked dominator children, but before we walk statements. */ + after_dom_children (bb); } if (sp) bb = worklist[--sp]; else break; } - if (walk_data->dom_direction == CDI_DOMINATORS) + if (dom_direction_ == CDI_DOMINATORS) { free (bb_postorder); bb_postorder = NULL; } free (worklist); } - -void -init_walk_dominator_tree (struct dom_walk_data *walk_data) -{ - walk_data->free_block_data.create (0); - walk_data->block_data_stack.create (0); -} - -void -fini_walk_dominator_tree (struct dom_walk_data *walk_data) -{ - if (walk_data->initialize_block_local_data) - { - while (walk_data->free_block_data.length () > 0) - free (walk_data->free_block_data.pop ()); - } - - walk_data->free_block_data.release (); - walk_data->block_data_stack.release (); -} |