aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gcc.gnu.org>2004-11-19 10:21:44 -0800
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-11-19 10:21:44 -0800
commit3a2e4b46f56c32ab31a482b6ffbe545e8cbfefd0 (patch)
treecef3e7dc682cfc4ccf35d090d8831c64c6f3c3ce /gcc/tree-ssa-dom.c
parent0e1ad529d715d705d1d4f8dbc188a52a3a570637 (diff)
downloadgcc-3a2e4b46f56c32ab31a482b6ffbe545e8cbfefd0.zip
gcc-3a2e4b46f56c32ab31a482b6ffbe545e8cbfefd0.tar.gz
gcc-3a2e4b46f56c32ab31a482b6ffbe545e8cbfefd0.tar.bz2
re PR tree-optimization/18507 (block_defs_stack varrray should not be GC'ed)
2004-11-19 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/18507 * tree-flow.h (tree2): Typedef because there is already a VEC(tree). Define a VEC(tree2) for head. (register_new_def): Change second argument to be a VEC(tree2). * tree-ssa-dom.c (block_defs_stack): Change to be a VEC(tree2). (tree_ssa_dominator_optimize): Initialize block_defs_stack with the VEC(tree2) function. Also free it before returning. (dom_opt_initialize_block): Use VEC_safe_push instead of VARRAY_PUSH_TREE for block_defs_stack. (restore_currdefs_to_original_value): Use VEC_length instead of VARRAY_ACTIVE_SIZE. VEC_pop instead of VARRAY_TOP_TREE/VARRAY_POP. (dom_opt_finalize_block): Use VEC_safe_push instead of VARRAY_PUSH_TREE for block_defs_stack. * tree-into-ssa.c (block_defs_stack): Change to be a VEC(tree2). (rewrite_initialize_block): Use VEC_safe_push instead of VARRAY_PUSH_TREE for block_defs_stack. (ssa_register_new_def): Likewise. (ssa_rewrite_initialize_block): Likewise. (rewrite_finalize_block): Use VEC_length instead of VARRAY_ACTIVE_SIZE. VEC_pop instead of VARRAY_TOP_TREE/VARRAY_POP. (ssa_rewrite_finalize_block): Likewise. (register_new_def): Change second argument to be a VEC(tree2). Use VEC_safe_push instead of VARRAY_PUSH_TREE. (rewrite_blocks): Initialize block_defs_stack with the VEC(tree2) function. Also free it before returning. (rewrite_ssa_into_ssa): Likewise. From-SVN: r90926
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index e47b3f8..badf23b 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -106,7 +106,9 @@ static varray_type avail_exprs_stack;
A NULL node is used to mark the last node associated with the
current block. */
-varray_type block_defs_stack;
+VEC(tree_on_heap) *block_defs_stack;
+
+/* FIXME: The other stacks should also be VEC(tree_on_heap). */
/* Stack of statements we need to rescan during finalization for newly
exposed variables.
@@ -384,7 +386,7 @@ tree_ssa_dominator_optimize (void)
avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free);
vrp_data = htab_create (ceil_log2 (num_ssa_names), vrp_hash, vrp_eq, free);
VARRAY_TREE_INIT (avail_exprs_stack, 20, "Available expression stack");
- VARRAY_TREE_INIT (block_defs_stack, 20, "Block DEFS stack");
+ block_defs_stack = VEC_alloc (tree_on_heap, 20);
VARRAY_TREE_INIT (const_and_copies_stack, 20, "Block const_and_copies stack");
VARRAY_TREE_INIT (nonzero_vars_stack, 20, "Block nonzero_vars stack");
VARRAY_TREE_INIT (vrp_variables_stack, 20, "Block vrp_variables stack");
@@ -502,6 +504,9 @@ tree_ssa_dominator_optimize (void)
if (value && !is_gimple_min_invariant (value))
SSA_NAME_VALUE (name) = NULL;
}
+
+ VEC_free (tree_on_heap, block_defs_stack);
+ block_defs_stack = NULL;
}
static bool
@@ -804,7 +809,7 @@ dom_opt_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Push a marker on the stacks of local information so that we know how
far to unwind when we finalize this block. */
VARRAY_PUSH_TREE (avail_exprs_stack, NULL_TREE);
- VARRAY_PUSH_TREE (block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
VARRAY_PUSH_TREE (const_and_copies_stack, NULL_TREE);
VARRAY_PUSH_TREE (nonzero_vars_stack, NULL_TREE);
VARRAY_PUSH_TREE (vrp_variables_stack, NULL_TREE);
@@ -925,13 +930,11 @@ static void
restore_currdefs_to_original_value (void)
{
/* Restore CURRDEFS to its original state. */
- while (VARRAY_ACTIVE_SIZE (block_defs_stack) > 0)
+ while (VEC_length (tree_on_heap, block_defs_stack) > 0)
{
- tree tmp = VARRAY_TOP_TREE (block_defs_stack);
+ tree tmp = VEC_pop (tree_on_heap, block_defs_stack);
tree saved_def, var;
- VARRAY_POP (block_defs_stack);
-
if (tmp == NULL_TREE)
break;
@@ -999,7 +1002,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
unwind any expressions related to the TRUE arm before processing
the false arm below. */
VARRAY_PUSH_TREE (avail_exprs_stack, NULL_TREE);
- VARRAY_PUSH_TREE (block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
VARRAY_PUSH_TREE (const_and_copies_stack, NULL_TREE);
edge_info = true_edge->aux;