From 3c0a32c9310d31a517b77e5e0b78c8464df21b63 Mon Sep 17 00:00:00 2001 From: rakdver Date: Tue, 28 May 2002 12:53:47 +0000 Subject: * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53957 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfg.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'gcc/cfg.c') diff --git a/gcc/cfg.c b/gcc/cfg.c index 948a3454611..313516b32fa 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -65,6 +65,10 @@ static char *flow_firstobj; int n_basic_blocks; +/* First free basic block number. */ + +int last_basic_block; + /* Number of edges in the current function. */ int n_edges; @@ -243,14 +247,37 @@ unlink_block (b) b->prev_bb->next_bb = b->next_bb; } +/* Sequentially order blocks and compact the arrays. */ +void +compact_blocks () +{ + int i; + basic_block bb; + + i = 0; + FOR_EACH_BB (bb) + { + BASIC_BLOCK (i) = bb; + bb->index = i; + i++; + } + + if (i != n_basic_blocks) + abort (); + + last_basic_block = n_basic_blocks; +} + -/* Remove block B from the basic block array and compact behind it. */ +/* Remove block B from the basic block array. */ void -expunge_block_nocompact (b) +expunge_block (b) basic_block b; { unlink_block (b); + BASIC_BLOCK (b->index) = NULL; + n_basic_blocks--; /* Invalidate data to make bughunting easier. */ memset (b, 0, sizeof *b); @@ -258,25 +285,6 @@ expunge_block_nocompact (b) b->succ = (edge) first_deleted_block; first_deleted_block = (basic_block) b; } - -void -expunge_block (b) - basic_block b; -{ - int i, n = n_basic_blocks; - - for (i = b->index; i + 1 < n; ++i) - { - basic_block x = BASIC_BLOCK (i + 1); - BASIC_BLOCK (i) = x; - x->index = i; - } - - n_basic_blocks--; - basic_block_info->num_elements--; - - expunge_block_nocompact (b); -} /* Create an edge connecting SRC and DST with FLAGS optionally using edge cache CACHE. Return the new edge, NULL if already exist. */ -- cgit v1.2.1