diff options
author | Kazu Hirata <kazu@codesourcery.com> | 2006-01-03 06:29:07 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2006-01-03 06:29:07 +0000 |
commit | e597f337e43e79b0427afe8bce99af767da17d53 (patch) | |
tree | ec16d6cddde6947565aa0f2400ed973bd0c8742c /gcc | |
parent | 78b76d0884d435c6e05d023db71a8b00c0f044b2 (diff) | |
download | gcc-e597f337e43e79b0427afe8bce99af767da17d53.zip gcc-e597f337e43e79b0427afe8bce99af767da17d53.tar.gz gcc-e597f337e43e79b0427afe8bce99af767da17d53.tar.bz2 |
basic-block.h (control_flow_graph): Change the type of x_label_to_block_map to VEC(basic_block,gc) *.
* basic-block.h (control_flow_graph): Change the type of
x_label_to_block_map to VEC(basic_block,gc) *.
* tree-cfg.c (init_empty_tree_cfg, label_to_block_fn,
set_bb_for_stmt): Adjust the uses of x_label_to_block_map.
From-SVN: r109265
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/basic-block.h | 2 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 30 |
3 files changed, 30 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da0843d..83867c3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-01-03 Kazu Hirata <kazu@codesourcery.com> + + * basic-block.h (control_flow_graph): Change the type of + x_label_to_block_map to VEC(basic_block,gc) *. + * tree-cfg.c (init_empty_tree_cfg, label_to_block_fn, + set_bb_for_stmt): Adjust the uses of x_label_to_block_map. + 2006-01-03 Steven Bosscher <stevenb.gcc@gmail.com> * fold-const.c (operand_equal_p): Accept a NULL operand 0 for diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 101f486..2615382 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -380,7 +380,7 @@ struct control_flow_graph GTY(()) /* Mapping of labels to their associated blocks. At present only used for the tree CFG. */ - varray_type x_label_to_block_map; + VEC(basic_block,gc) *x_label_to_block_map; enum profile_status { PROFILE_ABSENT, diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 37d041a..31bfc39 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -134,8 +134,10 @@ init_empty_tree_cfg (void) VARRAY_BB_INIT (basic_block_info, initial_cfg_capacity, "basic_block_info"); /* Build a mapping of labels to their associated blocks. */ - VARRAY_BB_INIT (label_to_block_map, initial_cfg_capacity, - "label to block map"); + label_to_block_map = VEC_alloc (basic_block, gc, initial_cfg_capacity); + VEC_safe_grow (basic_block, gc, label_to_block_map, initial_cfg_capacity); + 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; @@ -804,9 +806,10 @@ label_to_block_fn (struct function *ifun, tree dest) bsi_insert_before (&bsi, stmt, BSI_NEW_STMT); uid = LABEL_DECL_UID (dest); } - if (VARRAY_SIZE (ifun->cfg->x_label_to_block_map) <= (unsigned int)uid) + if (VEC_length (basic_block, ifun->cfg->x_label_to_block_map) + <= (unsigned int) uid) return NULL; - return VARRAY_BB (ifun->cfg->x_label_to_block_map, uid); + return VEC_index (basic_block, ifun->cfg->x_label_to_block_map, uid); } /* Create edges for a goto statement at block BB. */ @@ -2714,15 +2717,26 @@ set_bb_for_stmt (tree t, basic_block bb) uid = LABEL_DECL_UID (t); if (uid == -1) { + unsigned old_len = VEC_length (basic_block, label_to_block_map); LABEL_DECL_UID (t) = uid = cfun->last_label_uid++; - if (VARRAY_SIZE (label_to_block_map) <= (unsigned) uid) - VARRAY_GROW (label_to_block_map, 3 * uid / 2); + if (old_len <= (unsigned) uid) + { + basic_block *addr; + unsigned new_len = 3 * uid / 2; + + VEC_safe_grow (basic_block, gc, label_to_block_map, + new_len); + addr = VEC_address (basic_block, label_to_block_map); + memset (&addr[old_len], + 0, sizeof (basic_block) * (new_len - old_len)); + } } else /* We're moving an existing label. Make sure that we've removed it from the old block. */ - gcc_assert (!bb || !VARRAY_BB (label_to_block_map, uid)); - VARRAY_BB (label_to_block_map, uid) = bb; + gcc_assert (!bb + || !VEC_index (basic_block, label_to_block_map, uid)); + VEC_replace (basic_block, label_to_block_map, uid, bb); } } } |