tree-into-ssa.c (find_idf): Speed up by putting the indexes of basic blocks into work_stack.

* tree-into-ssa.c (find_idf): Speed up by putting the indexes
	of basic blocks into work_stack.

From-SVN: r96367
This commit is contained in:
Kazu Hirata 2005-03-13 13:31:01 +00:00 committed by Kazu Hirata
parent 6bbaec0912
commit d357720d41
2 changed files with 13 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2005-03-13 Kazu Hirata <kazu@cs.umass.edu>
* tree-into-ssa.c (find_idf): Speed up by putting the indexes
of basic blocks into work_stack.
2005-03-13 Andy Hutchinson <HutchinsonAndy@netscape.net>
PR target/18251

View File

@ -111,7 +111,7 @@ static htab_t def_blocks;
static VEC(tree_on_heap) *block_defs_stack;
/* Basic block vectors used in this file ought to be allocated in the heap. */
DEF_VEC_MALLOC_P(basic_block);
DEF_VEC_MALLOC_P(int);
/* Global data to attach to the main dominator walk structure. */
struct mark_def_sites_global_data
@ -503,40 +503,37 @@ find_idf (bitmap def_blocks, bitmap *dfs)
{
bitmap_iterator bi;
unsigned bb_index;
VEC(basic_block) *work_stack;
VEC(int) *work_stack;
bitmap phi_insertion_points;
work_stack = VEC_alloc (basic_block, n_basic_blocks);
work_stack = VEC_alloc (int, n_basic_blocks);
phi_insertion_points = BITMAP_ALLOC (NULL);
/* Seed the work list with all the blocks in DEF_BLOCKS. */
EXECUTE_IF_SET_IN_BITMAP (def_blocks, 0, bb_index, bi)
VEC_safe_push (basic_block, work_stack, BASIC_BLOCK (bb_index));
VEC_safe_push (int, work_stack, bb_index);
/* Pop a block off the worklist, add every block that appears in
the original block's DF that we have not already processed to
the worklist. Iterate until the worklist is empty. Blocks
which are added to the worklist are potential sites for
PHI nodes. */
while (VEC_length (basic_block, work_stack) > 0)
while (VEC_length (int, work_stack) > 0)
{
basic_block bb = VEC_pop (basic_block, work_stack);
bb_index = bb->index;
bb_index = VEC_pop (int, work_stack);
EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points,
0, bb_index, bi)
{
bb = BASIC_BLOCK (bb_index);
/* Use a safe push because if there is a definition of VAR
in every basic block, then WORK_STACK may eventually have
more than N_BASIC_BLOCK entries. */
VEC_safe_push (basic_block, work_stack, bb);
VEC_safe_push (int, work_stack, bb_index);
bitmap_set_bit (phi_insertion_points, bb_index);
}
}
VEC_free (basic_block, work_stack);
VEC_free (int, work_stack);
return phi_insertion_points;
}