diff options
author | Kazu Hirata <kazu@codesourcery.com> | 2006-01-11 18:43:15 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2006-01-11 18:43:15 +0000 |
commit | 68f9b84438d3ad84f1baf6413723a205e6a49b07 (patch) | |
tree | 107754d72857ad15b86879bbb0e898761aed1c26 | |
parent | 043c2d9e0840ed72c6eca4eb9eb75e382224ad3d (diff) | |
download | gcc-68f9b84438d3ad84f1baf6413723a205e6a49b07.zip gcc-68f9b84438d3ad84f1baf6413723a205e6a49b07.tar.gz gcc-68f9b84438d3ad84f1baf6413723a205e6a49b07.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/basic-block.h | 7 | ||||
-rw-r--r-- | gcc/cfg.c | 10 | ||||
-rw-r--r-- | gcc/cfgbuild.c | 9 | ||||
-rw-r--r-- | gcc/cfglayout.c | 2 | ||||
-rw-r--r-- | gcc/cfgrtl.c | 10 | ||||
-rw-r--r-- | gcc/ifcvt.c | 2 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 29 |
8 files changed, 63 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b966da7..692e45a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 2615382..d9fd10c 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -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. */ @@ -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 diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index 834119d..6a7395a 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -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); diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 5880819a..265afd7 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -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; diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 6ff6c39..7652472 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -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++; diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index d892535..2390f2f 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -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). */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 40a29bc..4b34dda 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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++; |