aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2002-05-28 14:53:47 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2002-05-28 12:53:47 +0000
commitbf77398cef20e7f1d079bb8b76d383c4ca163165 (patch)
treee6c0737229b9c2c57cf0353f3dd15ebecc686b75 /gcc/cfgcleanup.c
parentae12a094d64ceac6fa406c67f1e38e59bdfd95c9 (diff)
downloadgcc-bf77398cef20e7f1d079bb8b76d383c4ca163165.zip
gcc-bf77398cef20e7f1d079bb8b76d383c4ca163165.tar.gz
gcc-bf77398cef20e7f1d079bb8b76d383c4ca163165.tar.bz2
basic-block.h (last_basic_block): Declare.
* basic-block.h (last_basic_block): Declare. (expunge_block_nocompact): Declaration removed. (compact_blocks): Declare. * cfg.c (last_basic_block): New variable. (expunge_block_nocompact): Removed. (expunge_block): Do not compact basic blocks. (compact_blocks): New. * cfganal.c (flow_call_edges_add): Use the fact that bb indices no longer change. * cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Set last_basic_block. * cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Do not change real positions of blocks. (delete_unreachable_blocks): Simplified -- quadratic behavior now cannot occur. (cleanup_cfg): Compact blocks. * cfgrtl.c (create_basic_block): Insert basic blocks to the end of basic_block_info varray. (flow_delete_block): Comment update. (back_edge_of_syntactic_loop_p): Modify position check code. (verify_flow_info): Update checking. * flow.c (calculate_global_regs_live): Use FOR_EACH_BB. * ifcvt.c (SET_ORIG_INDEX, ORIG_INDEX): Removed. (find_if_case_1, find_if_case_2, if_convert): Use the fact that bb indices no longer change. * lcm.c (optimize_mode_switching): Replace n_basic_blocks with last_basic_block. * predict.c (estimate_bb_frequencies): Remove unneccessary code. * profile.c (branch_prob): Compact blocks. * sched-rgn.c (find_rgns): Replace n_basic_blocks with last_basic_block. From-SVN: r53957
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index a2ff17d..2e6e02d 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -688,7 +688,6 @@ merge_blocks_move_predecessor_nojumps (a, b)
basic_block a, b;
{
rtx barrier;
- int index;
barrier = next_nonnote_insn (a->end);
if (GET_CODE (barrier) != BARRIER)
@@ -714,14 +713,7 @@ merge_blocks_move_predecessor_nojumps (a, b)
fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
a->index, b->index);
- /* Swap the records for the two blocks around. Although we are deleting B,
- A is now where B was and we want to compact the BB array from where
- A used to be. */
- BASIC_BLOCK (a->index) = b;
- BASIC_BLOCK (b->index) = a;
- index = a->index;
- a->index = b->index;
- b->index = index;
+ /* Swap the records for the two blocks around. */
unlink_block (a);
link_block (a, b->prev_bb);
@@ -1755,13 +1747,10 @@ delete_unreachable_blocks ()
{
bool changed = false;
basic_block b, next_bb;
- int j = 0;
find_unreachable_blocks ();
- /* Delete all unreachable basic blocks. Do compaction concurrently,
- as otherwise we can wind up with O(N^2) behaviour here when we
- have oodles of dead code. */
+ /* Delete all unreachable basic blocks. */
for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
{
@@ -1769,18 +1758,10 @@ delete_unreachable_blocks ()
if (!(b->flags & BB_REACHABLE))
{
- flow_delete_block_noexpunge (b);
- expunge_block_nocompact (b);
+ flow_delete_block (b);
changed = true;
}
- else
- {
- BASIC_BLOCK (j) = b;
- b->index = j++;
- }
}
- n_basic_blocks = j;
- basic_block_info->num_elements = j;
if (changed)
tidy_fallthru_edges ();
@@ -1806,6 +1787,9 @@ cleanup_cfg (mode)
&& !reload_completed)
delete_trivially_dead_insns (get_insns(), max_reg_num ());
}
+
+ compact_blocks ();
+
while (try_optimize_cfg (mode))
{
delete_unreachable_blocks (), changed = true;