basic-block.h (control_flow_graph): Change the type of x_basic_block_info to VEC(basic_block,gc) *.

* basic-block.h (control_flow_graph): Change the type of
	x_basic_block_info to VEC(basic_block,gc) *.
	(BASIC_BLOCK_FOR_FUNCTION, BASIC_BLOCK): Adjust the uses of
	basic_block_info.
	(SET_BASIC_BLOCK): New.
	* cfg.c (compact_blocks, expunge_block): Use SET_BASIC_BLOCK
	instead of BASIC_BLOCK when assigning to BASIC_BLOCK.
	* cfgbuild.c (find_basic_blocks): Likewise.
	* cfglayout.c (fixup_reorder_chain): Likewise.
	* cfgrtl.c (create_basic_block_structure,
	rtl_create_basic_block): Likewise.
	* ifcvt.c (find_if_case_1): Likewise.
	* tree-cfg.c (init_empty_tree_cfg, build_tree_cfg, create_bb):
	Likewise.

From-SVN: r109596
This commit is contained in:
Kazu Hirata 2006-01-11 18:43:15 +00:00 committed by Kazu Hirata
parent 043c2d9e08
commit 68f9b84438
8 changed files with 63 additions and 23 deletions

View File

@ -1,3 +1,20 @@
2006-01-11 Kazu Hirata <kazu@codesourcery.com>
* basic-block.h (control_flow_graph): Change the type of
x_basic_block_info to VEC(basic_block,gc) *.
(BASIC_BLOCK_FOR_FUNCTION, BASIC_BLOCK): Adjust the uses of
basic_block_info.
(SET_BASIC_BLOCK): New.
* cfg.c (compact_blocks, expunge_block): Use SET_BASIC_BLOCK
instead of BASIC_BLOCK when assigning to BASIC_BLOCK.
* cfgbuild.c (find_basic_blocks): Likewise.
* cfglayout.c (fixup_reorder_chain): Likewise.
* cfgrtl.c (create_basic_block_structure,
rtl_create_basic_block): Likewise.
* ifcvt.c (find_if_case_1): Likewise.
* tree-cfg.c (init_empty_tree_cfg, build_tree_cfg, create_bb):
Likewise.
2005-01-11 Kenneth Zadeck <zadeck@naturalbridge.com>
* Makefile.in Removed rotted odf.c entry.

View File

@ -367,7 +367,7 @@ struct control_flow_graph GTY(())
basic_block x_exit_block_ptr;
/* Index by basic block number, get basic block struct info. */
varray_type x_basic_block_info;
VEC(basic_block,gc) *x_basic_block_info;
/* Number of basic blocks in this flow graph. */
int x_n_basic_blocks;
@ -399,7 +399,7 @@ struct control_flow_graph GTY(())
#define label_to_block_map_for_function(FN) ((FN)->cfg->x_label_to_block_map)
#define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
(VARRAY_BB (basic_block_info_for_function(FN), (N)))
(VEC_index (basic_block, basic_block_info_for_function(FN), (N)))
/* Defines for textual backward source compatibility. */
#define ENTRY_BLOCK_PTR (cfun->cfg->x_entry_block_ptr)
@ -411,7 +411,8 @@ struct control_flow_graph GTY(())
#define label_to_block_map (cfun->cfg->x_label_to_block_map)
#define profile_status (cfun->cfg->x_profile_status)
#define BASIC_BLOCK(N) (VARRAY_BB (basic_block_info, (N)))
#define BASIC_BLOCK(N) (VEC_index (basic_block, basic_block_info, (N)))
#define SET_BASIC_BLOCK(N,BB) (VEC_replace (basic_block, basic_block_info, (N), (BB)))
/* TRUE if we should re-run loop discovery after threading jumps, FALSE
otherwise. */

View File

@ -163,13 +163,13 @@ compact_blocks (void)
int i;
basic_block bb;
BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
BASIC_BLOCK (i) = bb;
SET_BASIC_BLOCK (i, bb);
bb->index = i;
i++;
}
@ -177,7 +177,7 @@ compact_blocks (void)
gcc_assert (i == n_basic_blocks);
for (; i < last_basic_block; i++)
BASIC_BLOCK (i) = NULL;
SET_BASIC_BLOCK (i, NULL);
last_basic_block = n_basic_blocks;
}
@ -188,7 +188,7 @@ void
expunge_block (basic_block b)
{
unlink_block (b);
BASIC_BLOCK (b->index) = NULL;
SET_BASIC_BLOCK (b->index, NULL);
n_basic_blocks--;
/* We should be able to ggc_free here, but we are not.
The dead SSA_NAMES are left pointing to dead statements that are pointing

View File

@ -542,9 +542,12 @@ find_basic_blocks (rtx f)
instructions at all until close to the end of compilation when we
actually lay them out. */
VARRAY_BB_INIT (basic_block_info, n_basic_blocks, "basic_block_info");
BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
basic_block_info = VEC_alloc (basic_block, gc, n_basic_blocks);
VEC_safe_grow (basic_block, gc, basic_block_info, n_basic_blocks);
memset (VEC_address (basic_block, basic_block_info), 0,
sizeof (basic_block) * n_basic_blocks);
SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
find_basic_blocks_1 (f);

View File

@ -814,7 +814,7 @@ fixup_reorder_chain (void)
for (; bb; prev_bb = bb, bb = bb->aux, index ++)
{
bb->index = index;
BASIC_BLOCK (index) = bb;
SET_BASIC_BLOCK (index, bb);
bb->prev_bb = prev_bb;
prev_bb->next_bb = bb;

View File

@ -305,7 +305,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
bb->index = last_basic_block++;
bb->flags = BB_NEW | BB_RTL;
link_block (bb, after);
BASIC_BLOCK (bb->index) = bb;
SET_BASIC_BLOCK (bb->index, bb);
update_bb_for_insn (bb);
BB_SET_PARTITION (bb, BB_UNPARTITIONED);
@ -328,10 +328,14 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
basic_block bb;
/* Grow the basic block array if needed. */
if ((size_t) last_basic_block >= VARRAY_SIZE (basic_block_info))
if ((size_t) last_basic_block >= VEC_length (basic_block, basic_block_info))
{
size_t old_size = VEC_length (basic_block, basic_block_info);
size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
VARRAY_GROW (basic_block_info, new_size);
basic_block *p;
VEC_safe_grow (basic_block, gc, basic_block_info, new_size);
p = VEC_address (basic_block, basic_block_info);
memset (&p[old_size], 0, sizeof (basic_block) * (new_size - old_size));
}
n_basic_blocks++;

View File

@ -3135,7 +3135,7 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge)
if (new_bb)
{
new_bb->index = then_bb_index;
BASIC_BLOCK (then_bb_index) = new_bb;
SET_BASIC_BLOCK (then_bb_index, new_bb);
/* Since the fallthru edge was redirected from test_bb to new_bb,
we need to ensure that new_bb is in the same partition as
test bb (you can not fall through across section boundaries). */

View File

@ -131,7 +131,10 @@ init_empty_tree_cfg (void)
profile_status = PROFILE_ABSENT;
n_basic_blocks = NUM_FIXED_BLOCKS;
last_basic_block = NUM_FIXED_BLOCKS;
VARRAY_BB_INIT (basic_block_info, initial_cfg_capacity, "basic_block_info");
basic_block_info = VEC_alloc (basic_block, gc, initial_cfg_capacity);
VEC_safe_grow (basic_block, gc, basic_block_info, initial_cfg_capacity);
memset (VEC_address (basic_block, basic_block_info), 0,
sizeof (basic_block) * initial_cfg_capacity);
/* Build a mapping of labels to their associated blocks. */
label_to_block_map = VEC_alloc (basic_block, gc, initial_cfg_capacity);
@ -139,8 +142,8 @@ init_empty_tree_cfg (void)
memset (VEC_address (basic_block, label_to_block_map),
0, sizeof (basic_block) * initial_cfg_capacity);
BASIC_BLOCK (ENTRY_BLOCK) = ENTRY_BLOCK_PTR;
BASIC_BLOCK (EXIT_BLOCK) = EXIT_BLOCK_PTR;
SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
}
@ -178,7 +181,15 @@ build_tree_cfg (tree *tp)
create_empty_bb (ENTRY_BLOCK_PTR);
/* Adjust the size of the array. */
VARRAY_GROW (basic_block_info, n_basic_blocks);
if (VEC_length (basic_block, basic_block_info) < (size_t) n_basic_blocks)
{
size_t old_size = VEC_length (basic_block, basic_block_info);
basic_block *p;
VEC_safe_grow (basic_block, gc, basic_block_info, n_basic_blocks);
p = VEC_address (basic_block, basic_block_info);
memset (&p[old_size], 0,
sizeof (basic_block) * (n_basic_blocks - old_size));
}
/* To speed up statement iterator walks, we first purge dead labels. */
cleanup_dead_labels ();
@ -382,14 +393,18 @@ create_bb (void *h, void *e, basic_block after)
link_block (bb, after);
/* Grow the basic block array if needed. */
if ((size_t) last_basic_block == VARRAY_SIZE (basic_block_info))
if ((size_t) last_basic_block == VEC_length (basic_block, basic_block_info))
{
size_t old_size = VEC_length (basic_block, basic_block_info);
size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
VARRAY_GROW (basic_block_info, new_size);
basic_block *p;
VEC_safe_grow (basic_block, gc, basic_block_info, new_size);
p = VEC_address (basic_block, basic_block_info);
memset (&p[old_size], 0, sizeof (basic_block) * (new_size - old_size));
}
/* Add the newly created block to the array. */
BASIC_BLOCK (last_basic_block) = bb;
SET_BASIC_BLOCK (last_basic_block, bb);
n_basic_blocks++;
last_basic_block++;