Commit e597f337 by Kazu Hirata Committed by Kazu Hirata

basic-block.h (control_flow_graph): Change the type of x_label_to_block_map to…

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
parent 78b76d08
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
......
......@@ -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,
......
......@@ -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);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment