diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-12 17:57:40 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-12 17:57:40 +0000 |
commit | dce58e66ae4584a9832bccb103a155df58be9806 (patch) | |
tree | 6cc0ea65afc6e5ab5c27890dd53712843ef3bc17 /gcc/cfgloopmanip.c | |
parent | 2656a84c1153d7b11ea2524305a8f5b9f66b17a6 (diff) | |
download | gcc-dce58e66ae4584a9832bccb103a155df58be9806.tar.gz |
* doc/loop.texi: Document recording of loop exits.
* cfgloopmanip.c (loopify, duplicate_loop): Use alloc_loop.
(update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop,
update_single_exit_for_duplicated_loops): Removed.
(duplicate_loop_to_header_edge): Do not call
update_single_exits_after_duplication and
update_single_exit_for_duplicated_loops.
(loop_version): Do not update single_exit information.
(fix_loop_structure): Use record_loop_exits instead of
mark_single_exit_loops.
* tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Update
the lists of loop exits.
* cfghooks.c (redirect_edge_and_branch, redirect_edge_and_branch_force,
split_edge, merge_blocks): Update the lists of loop exits.
* modulo-sched.c (sms_schedule): Pass LOOPS_HAVE_RECORDED_EXITS to
loop_optimizer_init.
* loop-init.c (loop_optimizer_init): Call record_loop_exits instead
of mark_single_exit_loops.
(loop_optimizer_finalize): Call release_recorded_exits.
* tree-ssa-loop.c (tree_loop_optimizer_init): Pass
LOOPS_HAVE_RECORDED_EXITS to loop_optimizer_init.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg): Do not
update single exit information.
* lambda-code.c (perfect_nestify): Ditto.
* cfgloop.c (flow_loop_free): Destroy the list of exits of the loop.
(mark_single_exit_loops): Removed.
(alloc_loop, loop_exit_hash, loop_exit_eq, loop_exit_free,
get_exit_descriptions, rescan_loop_exit, record_loop_exits,
dump_recorded_exit, dump_recorded_exits, release_recorded_exits): New
functions.
(get_loop_exit_edges, single_exit): Use recorded exit lists.
(add_bb_to_loop, remove_bb_from_loops): Update the lists of loop exits.
(verify_loop_structure): Verify consistency of the exit lists.
(flow_loops_find): Use alloc_loop. Initialize exits hash.
(set_single_exit): Removed.
* cfgloop.h (struct loop_exit): New function.
(struct loop): single_exit_ field replaced by exits field.
(LOOPS_HAVE_MARKED_SINGLE_EXITS): Replaced by LOOPS_HAVE_RECORDED_EXITS.
(struct loops): Added exits hash.
(mark_single_exit_loops, set_single_exit): Declaration removed.
(release_recorded_exits, record_loop_exits, rescan_loop_exit): Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120728 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r-- | gcc/cfgloopmanip.c | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index fd7597e9a12..222bcb3623c 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -425,7 +425,7 @@ loopify (edge latch_edge, edge header_edge, basic_block *dom_bbs, *body; unsigned n_dom_bbs, i; sbitmap seen; - struct loop *loop = XCNEW (struct loop); + struct loop *loop = alloc_loop (); struct loop *outer = succ_bb->loop_father->outer; int freq; gcov_type cnt; @@ -643,7 +643,7 @@ struct loop * duplicate_loop (struct loop *loop, struct loop *target) { struct loop *cloop; - cloop = XCNEW (struct loop); + cloop = alloc_loop (); place_new_loop (cloop); /* Mark the new loop as copy of LOOP. */ @@ -746,65 +746,6 @@ can_duplicate_loop_p (struct loop *loop) return ret; } -/* The NBBS blocks in BBS will get duplicated and the copies will be placed - to LOOP. Update the single_exit information in superloops of LOOP. */ - -static void -update_single_exits_after_duplication (basic_block *bbs, unsigned nbbs, - struct loop *loop) -{ - unsigned i; - - for (i = 0; i < nbbs; i++) - bbs[i]->flags |= BB_DUPLICATED; - - for (; loop->outer; loop = loop->outer) - { - if (!single_exit (loop)) - continue; - - if (single_exit (loop)->src->flags & BB_DUPLICATED) - set_single_exit (loop, NULL); - } - - for (i = 0; i < nbbs; i++) - bbs[i]->flags &= ~BB_DUPLICATED; -} - -/* Updates single exit information for the copy of LOOP. */ - -static void -update_single_exit_for_duplicated_loop (struct loop *loop) -{ - struct loop *copy = loop->copy; - basic_block src, dest; - edge exit = single_exit (loop); - - if (!exit) - return; - - src = get_bb_copy (exit->src); - dest = exit->dest; - if (dest->flags & BB_DUPLICATED) - dest = get_bb_copy (dest); - - exit = find_edge (src, dest); - gcc_assert (exit != NULL); - set_single_exit (copy, exit); -} - -/* Updates single exit information for copies of ORIG_LOOPS and their subloops. - N is the number of the loops in the ORIG_LOOPS array. */ - -static void -update_single_exit_for_duplicated_loops (struct loop *orig_loops[], unsigned n) -{ - unsigned i; - - for (i = 0; i < n; i++) - update_single_exit_for_duplicated_loop (orig_loops[i]); -} - /* Sets probability and count of edge E to zero. The probability and count is redistributed evenly to the remaining edges coming from E->src. */ @@ -1018,10 +959,6 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, first_active_latch = latch; } - /* Update the information about single exits. */ - if (current_loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS) - update_single_exits_after_duplication (bbs, n, target); - spec_edges[SE_ORIG] = orig; spec_edges[SE_LATCH] = latch_edge; @@ -1036,15 +973,6 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, place_after); place_after = new_spec_edges[SE_LATCH]->src; - if (current_loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS) - { - for (i = 0; i < n; i++) - bbs[i]->flags |= BB_DUPLICATED; - update_single_exit_for_duplicated_loops (orig_loops, n_orig_loops); - for (i = 0; i < n; i++) - bbs[i]->flags &= ~BB_DUPLICATED; - } - if (flags & DLTHE_RECORD_COPY_NUMBER) for (i = 0; i < n; i++) { @@ -1378,7 +1306,7 @@ loop_version (struct loop *loop, bool place_after) { basic_block first_head, second_head; - edge entry, latch_edge, exit, true_edge, false_edge; + edge entry, latch_edge, true_edge, false_edge; int irred_flag; struct loop *nloop; basic_block cond_bb; @@ -1425,10 +1353,6 @@ loop_version (struct loop *loop, false /* Do not redirect all edges. */, then_scale, else_scale); - exit = single_exit (loop); - if (exit) - set_single_exit (nloop, find_edge (get_bb_copy (exit->src), exit->dest)); - /* loopify redirected latch_edge. Update its PENDING_STMTS. */ lv_flush_pending_stmts (latch_edge); @@ -1539,8 +1463,12 @@ fix_loop_structure (bitmap changed_bbs) bb->aux = NULL; } - if (current_loops->state & LOOPS_HAVE_MARKED_SINGLE_EXITS) - mark_single_exit_loops (); if (current_loops->state & LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) mark_irreducible_loops (); + + if (current_loops->state & LOOPS_HAVE_RECORDED_EXITS) + { + release_recorded_exits (); + record_loop_exits (); + } } |