Commit 78492bf5 by Steven Bosscher Committed by Steven Bosscher

Makefile.in (tree-ssa-propagate.o): Depend on vec.h.

	* Makefile.in (tree-ssa-propagate.o): Depend on vec.h.
	* tree-ssa-propagate.c: Include vec.h.
	(interesting_ssa_edges, varying_ssa_edges): Make these VECs
	instead of varrays.
	(cfg_blocks_add): Assert the block is not already in the worklist.
	Update uses of interesting_ssa_edges and varying_ssa_edges.
	(process_ssa_edge_worklist, ssa_prop_init, ssa_prop_fini,
	ssa_propagate): Likewise.

From-SVN: r88249
parent ef787822
2004-09-28 Steven Bosscher <stevenb@suse.de>
* Makefile.in (tree-ssa-propagate.o): Depend on vec.h.
* tree-ssa-propagate.c: Include vec.h.
(interesting_ssa_edges, varying_ssa_edges): Make these VECs
instead of varrays.
(cfg_blocks_add): Assert the block is not already in the worklist.
Update uses of interesting_ssa_edges and varying_ssa_edges.
(process_ssa_edge_worklist, ssa_prop_init, ssa_prop_fini,
ssa_propagate): Likewise.
2004-09-28 Joseph S. Myers <jsm@polyomino.org.uk> 2004-09-28 Joseph S. Myers <jsm@polyomino.org.uk>
PR c/16409 PR c/16409
......
...@@ -1635,7 +1635,7 @@ tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \ ...@@ -1635,7 +1635,7 @@ tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \
diagnostic.h errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h \ diagnostic.h errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h \ $(TREE_DUMP_H) $(BASIC_BLOCK_H) tree-pass.h langhooks.h \
tree-ssa-propagate.h tree-ssa-propagate.h vec.h
tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \ errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
......
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
#include "tree-pass.h" #include "tree-pass.h"
#include "tree-ssa-propagate.h" #include "tree-ssa-propagate.h"
#include "langhooks.h" #include "langhooks.h"
#include "varray.h"
#include "vec.h"
/* This file implements a generic value propagation engine based on /* This file implements a generic value propagation engine based on
the same propagation used by the SSA-CCP algorithm [1]. the same propagation used by the SSA-CCP algorithm [1].
...@@ -142,7 +143,7 @@ static sbitmap bb_in_list; ...@@ -142,7 +143,7 @@ static sbitmap bb_in_list;
definition has changed. SSA edges are def-use edges in the SSA definition has changed. SSA edges are def-use edges in the SSA
web. For each D-U edge, we store the target statement or PHI node web. For each D-U edge, we store the target statement or PHI node
U. */ U. */
static GTY(()) varray_type interesting_ssa_edges; static GTY(()) VEC(tree) *interesting_ssa_edges;
/* Identical to INTERESTING_SSA_EDGES. For performance reasons, the /* Identical to INTERESTING_SSA_EDGES. For performance reasons, the
list of SSA edges is split into two. One contains all SSA edges list of SSA edges is split into two. One contains all SSA edges
...@@ -158,7 +159,7 @@ static GTY(()) varray_type interesting_ssa_edges; ...@@ -158,7 +159,7 @@ static GTY(()) varray_type interesting_ssa_edges;
don't use a separate worklist for VARYING edges, we end up with don't use a separate worklist for VARYING edges, we end up with
situations where lattice values move from situations where lattice values move from
UNDEFINED->INTERESTING->VARYING instead of UNDEFINED->VARYING. */ UNDEFINED->INTERESTING->VARYING instead of UNDEFINED->VARYING. */
static GTY(()) varray_type varying_ssa_edges; static GTY(()) VEC(tree) *varying_ssa_edges;
/* Return true if the block worklist empty. */ /* Return true if the block worklist empty. */
...@@ -170,7 +171,8 @@ cfg_blocks_empty_p (void) ...@@ -170,7 +171,8 @@ cfg_blocks_empty_p (void)
} }
/* Add a basic block to the worklist. */ /* Add a basic block to the worklist. The block must not be already
in the worklist. */
static void static void
cfg_blocks_add (basic_block bb) cfg_blocks_add (basic_block bb)
...@@ -178,8 +180,7 @@ cfg_blocks_add (basic_block bb) ...@@ -178,8 +180,7 @@ cfg_blocks_add (basic_block bb)
if (bb == ENTRY_BLOCK_PTR || bb == EXIT_BLOCK_PTR) if (bb == ENTRY_BLOCK_PTR || bb == EXIT_BLOCK_PTR)
return; return;
if (TEST_BIT (bb_in_list, bb->index)) gcc_assert (!TEST_BIT (bb_in_list, bb->index));
return;
if (cfg_blocks_empty_p ()) if (cfg_blocks_empty_p ())
{ {
...@@ -247,9 +248,9 @@ add_ssa_edge (tree var, bool is_varying) ...@@ -247,9 +248,9 @@ add_ssa_edge (tree var, bool is_varying)
{ {
STMT_IN_SSA_EDGE_WORKLIST (use_stmt) = 1; STMT_IN_SSA_EDGE_WORKLIST (use_stmt) = 1;
if (is_varying) if (is_varying)
VARRAY_PUSH_TREE (varying_ssa_edges, use_stmt); VEC_safe_push (tree, varying_ssa_edges, use_stmt);
else else
VARRAY_PUSH_TREE (interesting_ssa_edges, use_stmt); VEC_safe_push (tree, interesting_ssa_edges, use_stmt);
} }
} }
} }
...@@ -340,19 +341,20 @@ simulate_stmt (tree stmt) ...@@ -340,19 +341,20 @@ simulate_stmt (tree stmt)
/* Process an SSA edge worklist. WORKLIST is the SSA edge worklist to /* Process an SSA edge worklist. WORKLIST is the SSA edge worklist to
drain. This pops statements off the given WORKLIST and processes drain. This pops statements off the given WORKLIST and processes
them until there are no more statements on WORKLIST. */ them until there are no more statements on WORKLIST.
We take a pointer to WORKLIST because it may be reallocated when an
SSA edge is added to it in simulate_stmt. */
static void static void
process_ssa_edge_worklist (varray_type *worklist) process_ssa_edge_worklist (VEC(tree) **worklist)
{ {
/* Drain the entire worklist. */ /* Drain the entire worklist. */
while (VARRAY_ACTIVE_SIZE (*worklist) > 0) while (VEC_length (tree, *worklist) > 0)
{ {
basic_block bb; basic_block bb;
/* Pull the statement to simulate off the worklist. */ /* Pull the statement to simulate off the worklist. */
tree stmt = VARRAY_TOP_TREE (*worklist); tree stmt = VEC_pop (tree, *worklist);
VARRAY_POP (*worklist);
/* If this statement was already visited by simulate_block, then /* If this statement was already visited by simulate_block, then
we don't need to visit it again here. */ we don't need to visit it again here. */
...@@ -463,8 +465,8 @@ ssa_prop_init (void) ...@@ -463,8 +465,8 @@ ssa_prop_init (void)
basic_block bb; basic_block bb;
/* Worklists of SSA edges. */ /* Worklists of SSA edges. */
VARRAY_TREE_INIT (interesting_ssa_edges, 20, "interesting_ssa_edges"); interesting_ssa_edges = VEC_alloc (tree, 20);
VARRAY_TREE_INIT (varying_ssa_edges, 20, "varying_ssa_edges"); varying_ssa_edges = VEC_alloc (tree, 20);
executable_blocks = sbitmap_alloc (last_basic_block); executable_blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (executable_blocks); sbitmap_zero (executable_blocks);
...@@ -507,8 +509,8 @@ ssa_prop_init (void) ...@@ -507,8 +509,8 @@ ssa_prop_init (void)
static void static void
ssa_prop_fini (void) ssa_prop_fini (void)
{ {
interesting_ssa_edges = NULL; VEC_free (tree, interesting_ssa_edges);
varying_ssa_edges = NULL; VEC_free (tree, varying_ssa_edges);
cfg_blocks = NULL; cfg_blocks = NULL;
sbitmap_free (bb_in_list); sbitmap_free (bb_in_list);
sbitmap_free (executable_blocks); sbitmap_free (executable_blocks);
...@@ -653,8 +655,8 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt, ...@@ -653,8 +655,8 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt,
/* Iterate until the worklists are empty. */ /* Iterate until the worklists are empty. */
while (!cfg_blocks_empty_p () while (!cfg_blocks_empty_p ()
|| VARRAY_ACTIVE_SIZE (interesting_ssa_edges) > 0 || VEC_length (tree, interesting_ssa_edges) > 0
|| VARRAY_ACTIVE_SIZE (varying_ssa_edges) > 0) || VEC_length (tree, varying_ssa_edges) > 0)
{ {
if (!cfg_blocks_empty_p ()) if (!cfg_blocks_empty_p ())
{ {
......
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