diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-10 08:55:57 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-10 08:55:57 +0000 |
commit | 053fdd999453feb09cff376ef51ca167dc432205 (patch) | |
tree | f2b46ed67074fdbfd5baaae62b80c6995933ebe7 /gcc/tree-ssa-loop-manip.c | |
parent | 5a24a79a9ed43d9154273567b60e88b694924c4f (diff) | |
download | gcc-053fdd999453feb09cff376ef51ca167dc432205.tar.gz |
* Makefile.in (tree-optimize.o): Add CFGLOOP_H dependence.
* cfgloop.c (flow_loop_nodes_find): Export.
* cfgloop.h (flow_loop_nodes_find, fix_loop_structure):
Declare.
* cfgloopmanip.c (fix_loop_structure): New function.
* predict.c (predict_loops): Clean up the loops information.
* tree-cfg.c (cleanup_tree_cfg_loop): New function.
(tree_can_merge_blocks_p, remove_bb, tree_forwarder_block_p): Respect
loop structure.
* tree-flow.h (cleanup_tree_cfg_loop): Declare.
(rewrite_into_loop_closed_ssa): Declaration changed.
* tree-loop-linear.c (linear_transform_loops): Add argument to
rewrite_into_loop_closed_ssa call.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-ssa-loop-im.c (move_computations): Ditto.
* tree-ssa-loop.c (tree_loop_optimizer_init): Ditto.
* tree-vectorizer.c (vectorize_loops): Ditto.
* tree-optimize.c: Include cfgloop.h.
(execute_todo): Choose whether to call cleanup_tree_cfg or
cleanup_tree_cfg_loop.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables,
(tree_unroll_loops_completely): Enable cleanup_tree_cfg_loop call.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Enable
cleanup_tree_cfg_loop call.
* tree-ssa-loop-manip.c (find_uses_to_rename_bb): New function.
(find_uses_to_rename, rewrite_into_loop_closed_ssa): Support
work on part of cfg.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96232 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 848abbc88d6..a4057f75a66 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -259,27 +259,52 @@ find_uses_to_rename_stmt (tree stmt, bitmap *use_blocks) find_uses_to_rename_use (bb, var, use_blocks); } -/* Marks names that are used outside of the loop they are defined in - for rewrite. Records the set of blocks in that the ssa +/* Marks names that are used in BB and outside of the loop they are + defined in for rewrite. Records the set of blocks in that the ssa names are defined to USE_BLOCKS. */ static void -find_uses_to_rename (bitmap *use_blocks) +find_uses_to_rename_bb (basic_block bb, bitmap *use_blocks) { - basic_block bb; block_stmt_iterator bsi; + edge e; + edge_iterator ei; tree phi; - unsigned i; - FOR_EACH_BB (bb) - { - for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) - for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++) - find_uses_to_rename_use (EDGE_PRED (bb, i)->src, - PHI_ARG_DEF (phi, i), use_blocks); + FOR_EACH_EDGE (e, ei, bb->succs) + for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi)) + find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e), + use_blocks); + + for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + find_uses_to_rename_stmt (bsi_stmt (bsi), use_blocks); +} + +/* Marks names that are used outside of the loop they are defined in + for rewrite. Records the set of blocks in that the ssa + names are defined to USE_BLOCKS. If CHANGED_BBS is not NULL, + scan only blocks in this set. */ - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) - find_uses_to_rename_stmt (bsi_stmt (bsi), use_blocks); +static void +find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks) +{ + basic_block bb; + unsigned index; + bitmap_iterator bi; + + if (changed_bbs) + { + EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi) + { + find_uses_to_rename_bb (BASIC_BLOCK (index), use_blocks); + } + } + else + { + FOR_EACH_BB (bb) + { + find_uses_to_rename_bb (bb, use_blocks); + } } } @@ -307,10 +332,13 @@ find_uses_to_rename (bitmap *use_blocks) Looking from the outer loop with the normal SSA form, the first use of k is not well-behaved, while the second one is an induction variable with - base 99 and step 1. */ + base 99 and step 1. + + If CHANGED_BBS is not NULL, we look for uses outside loops only in + the basic blocks in this set. */ void -rewrite_into_loop_closed_ssa (void) +rewrite_into_loop_closed_ssa (bitmap changed_bbs) { bitmap loop_exits = get_loops_exits (); bitmap *use_blocks; @@ -322,7 +350,14 @@ rewrite_into_loop_closed_ssa (void) use_blocks = xcalloc (num_ssa_names, sizeof (bitmap)); /* Find the uses outside loops. */ - find_uses_to_rename (use_blocks); + find_uses_to_rename (changed_bbs, use_blocks); + + if (!any_marked_for_rewrite_p ()) + { + free (use_blocks); + BITMAP_FREE (loop_exits); + return; + } /* Add the phi nodes on exits of the loops for the names we need to rewrite. */ |