summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c97
1 files changed, 49 insertions, 48 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 1d4f9b0b1c2..429ba768f5d 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -94,7 +94,7 @@ static htab_t avail_exprs;
(null). When we finish processing the block, we pop off entries and
remove the expressions from the global hash table until we hit the
marker. */
-static VEC(tree_on_heap) *avail_exprs_stack;
+static VEC(tree,heap) *avail_exprs_stack;
/* Stack of trees used to restore the global currdefs to its original
state after completing optimization of a block and its dominator children.
@@ -107,7 +107,7 @@ static VEC(tree_on_heap) *avail_exprs_stack;
A NULL node is used to mark the last node associated with the
current block. */
-static VEC(tree_on_heap) *block_defs_stack;
+static VEC(tree,heap) *block_defs_stack;
/* Stack of statements we need to rescan during finalization for newly
exposed variables.
@@ -116,7 +116,7 @@ static VEC(tree_on_heap) *block_defs_stack;
expressions are removed from AVAIL_EXPRS. Else we may change the
hash code for an expression and be unable to find/remove it from
AVAIL_EXPRS. */
-static VEC(tree_on_heap) *stmts_to_rescan;
+static VEC(tree,heap) *stmts_to_rescan;
/* Structure for entries in the expression hash table.
@@ -148,7 +148,7 @@ struct expr_hash_elt
A NULL entry is used to mark the end of pairs which need to be
restored during finalization of this block. */
-static VEC(tree_on_heap) *const_and_copies_stack;
+static VEC(tree,heap) *const_and_copies_stack;
/* Bitmap of SSA_NAMEs known to have a nonzero value, even if we do not
know their exact value. */
@@ -159,7 +159,7 @@ static bitmap nonzero_vars;
A NULL entry is used to mark the end of names needing their
entry in NONZERO_VARS cleared during finalization of this block. */
-static VEC(tree_on_heap) *nonzero_vars_stack;
+static VEC(tree,heap) *nonzero_vars_stack;
/* Track whether or not we have changed the control flow graph. */
static bool cfg_altered;
@@ -254,7 +254,7 @@ struct vrp_hash_elt
list to determine which variables need their VRP data updated.
A NULL entry marks the end of the SSA_NAMEs associated with this block. */
-static VEC(tree_on_heap) *vrp_variables_stack;
+static VEC(tree,heap) *vrp_variables_stack;
struct eq_expr_value
{
@@ -382,12 +382,12 @@ tree_ssa_dominator_optimize (void)
/* Create our hash tables. */
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);
- avail_exprs_stack = VEC_alloc (tree_on_heap, 20);
- block_defs_stack = VEC_alloc (tree_on_heap, 20);
- const_and_copies_stack = VEC_alloc (tree_on_heap, 20);
- nonzero_vars_stack = VEC_alloc (tree_on_heap, 20);
- vrp_variables_stack = VEC_alloc (tree_on_heap, 20);
- stmts_to_rescan = VEC_alloc (tree_on_heap, 20);
+ avail_exprs_stack = VEC_alloc (tree, heap, 20);
+ block_defs_stack = VEC_alloc (tree, heap, 20);
+ const_and_copies_stack = VEC_alloc (tree, heap, 20);
+ nonzero_vars_stack = VEC_alloc (tree, heap, 20);
+ vrp_variables_stack = VEC_alloc (tree, heap, 20);
+ stmts_to_rescan = VEC_alloc (tree, heap, 20);
nonzero_vars = BITMAP_ALLOC (NULL);
need_eh_cleanup = BITMAP_ALLOC (NULL);
@@ -545,12 +545,12 @@ tree_ssa_dominator_optimize (void)
BITMAP_FREE (nonzero_vars);
BITMAP_FREE (need_eh_cleanup);
- VEC_free (tree_on_heap, block_defs_stack);
- VEC_free (tree_on_heap, avail_exprs_stack);
- VEC_free (tree_on_heap, const_and_copies_stack);
- VEC_free (tree_on_heap, nonzero_vars_stack);
- VEC_free (tree_on_heap, vrp_variables_stack);
- VEC_free (tree_on_heap, stmts_to_rescan);
+ VEC_free (tree, heap, block_defs_stack);
+ VEC_free (tree, heap, avail_exprs_stack);
+ VEC_free (tree, heap, const_and_copies_stack);
+ VEC_free (tree, heap, nonzero_vars_stack);
+ VEC_free (tree, heap, vrp_variables_stack);
+ VEC_free (tree, heap, stmts_to_rescan);
}
static bool
@@ -850,11 +850,11 @@ 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. */
- VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, nonzero_vars_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, vrp_variables_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, nonzero_vars_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, vrp_variables_stack, NULL_TREE);
record_equivalences_from_incoming_edge (bb);
@@ -910,10 +910,10 @@ static void
remove_local_expressions_from_table (void)
{
/* Remove all the expressions made available in this block. */
- while (VEC_length (tree_on_heap, avail_exprs_stack) > 0)
+ while (VEC_length (tree, avail_exprs_stack) > 0)
{
struct expr_hash_elt element;
- tree expr = VEC_pop (tree_on_heap, avail_exprs_stack);
+ tree expr = VEC_pop (tree, avail_exprs_stack);
if (expr == NULL_TREE)
break;
@@ -929,9 +929,9 @@ remove_local_expressions_from_table (void)
static void
restore_nonzero_vars_to_original_value (void)
{
- while (VEC_length (tree_on_heap, nonzero_vars_stack) > 0)
+ while (VEC_length (tree, nonzero_vars_stack) > 0)
{
- tree name = VEC_pop (tree_on_heap, nonzero_vars_stack);
+ tree name = VEC_pop (tree, nonzero_vars_stack);
if (name == NULL)
break;
@@ -947,16 +947,16 @@ restore_nonzero_vars_to_original_value (void)
static void
restore_vars_to_original_value (void)
{
- while (VEC_length (tree_on_heap, const_and_copies_stack) > 0)
+ while (VEC_length (tree, const_and_copies_stack) > 0)
{
tree prev_value, dest;
- dest = VEC_pop (tree_on_heap, const_and_copies_stack);
+ dest = VEC_pop (tree, const_and_copies_stack);
if (dest == NULL)
break;
- prev_value = VEC_pop (tree_on_heap, const_and_copies_stack);
+ prev_value = VEC_pop (tree, const_and_copies_stack);
SSA_NAME_VALUE (dest) = prev_value;
}
}
@@ -967,9 +967,9 @@ static void
restore_currdefs_to_original_value (void)
{
/* Restore CURRDEFS to its original state. */
- while (VEC_length (tree_on_heap, block_defs_stack) > 0)
+ while (VEC_length (tree, block_defs_stack) > 0)
{
- tree tmp = VEC_pop (tree_on_heap, block_defs_stack);
+ tree tmp = VEC_pop (tree, block_defs_stack);
tree saved_def, var;
if (tmp == NULL_TREE)
@@ -1050,9 +1050,9 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* Push a marker onto the available expression stack so that we
unwind any expressions related to the TRUE arm before processing
the false arm below. */
- VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, avail_exprs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, block_defs_stack, NULL_TREE);
+ VEC_safe_push (tree, heap, const_and_copies_stack, NULL_TREE);
edge_info = true_edge->aux;
@@ -1154,9 +1154,9 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
To be efficient, we note which variables have had their values
constrained in this block. So walk over each variable in the
VRP_VARIABLEs array. */
- while (VEC_length (tree_on_heap, vrp_variables_stack) > 0)
+ while (VEC_length (tree, vrp_variables_stack) > 0)
{
- tree var = VEC_pop (tree_on_heap, vrp_variables_stack);
+ tree var = VEC_pop (tree, vrp_variables_stack);
struct vrp_hash_elt vrp_hash_elt, *vrp_hash_elt_p;
void **slot;
@@ -1192,15 +1192,15 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
/* If we queued any statements to rescan in this block, then
go ahead and rescan them now. */
- while (VEC_length (tree_on_heap, stmts_to_rescan) > 0)
+ while (VEC_length (tree, stmts_to_rescan) > 0)
{
- tree stmt = VEC_last (tree_on_heap, stmts_to_rescan);
+ tree stmt = VEC_last (tree, stmts_to_rescan);
basic_block stmt_bb = bb_for_stmt (stmt);
if (stmt_bb != bb)
break;
- VEC_pop (tree_on_heap, stmts_to_rescan);
+ VEC_pop (tree, stmts_to_rescan);
mark_new_vars_to_rename (stmt);
}
}
@@ -1436,7 +1436,7 @@ record_var_is_nonzero (tree var)
/* Record this SSA_NAME so that we can reset the global table
when we leave this block. */
- VEC_safe_push (tree_on_heap, nonzero_vars_stack, var);
+ VEC_safe_push (tree, heap, nonzero_vars_stack, var);
}
/* Enter a statement into the true/false expression hash table indicating
@@ -1455,7 +1455,7 @@ record_cond (tree cond, tree value)
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree_on_heap, avail_exprs_stack, cond);
+ VEC_safe_push (tree, heap, avail_exprs_stack, cond);
}
else
free (element);
@@ -1594,8 +1594,9 @@ record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
SSA_NAME_VALUE (x) = y;
- VEC_safe_push (tree_on_heap, const_and_copies_stack, prev_x);
- VEC_safe_push (tree_on_heap, const_and_copies_stack, x);
+ VEC_reserve (tree, heap, const_and_copies_stack, 2);
+ VEC_quick_push (tree, const_and_copies_stack, prev_x);
+ VEC_quick_push (tree, const_and_copies_stack, x);
}
@@ -3125,7 +3126,7 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
}
if (may_have_exposed_new_symbols)
- VEC_safe_push (tree_on_heap, stmts_to_rescan, bsi_stmt (si));
+ VEC_safe_push (tree, heap, stmts_to_rescan, bsi_stmt (si));
}
/* Replace the RHS of STMT with NEW_RHS. If RHS can be found in the
@@ -3177,7 +3178,7 @@ update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs, bool insert)
we found a copy of this statement in the second hash table lookup
we want _no_ copies of this statement in BLOCK_AVAIL_EXPRs. */
if (insert)
- VEC_pop (tree_on_heap, avail_exprs_stack);
+ VEC_pop (tree, avail_exprs_stack);
/* And make sure we record the fact that we modified this
statement. */
@@ -3253,7 +3254,7 @@ lookup_avail_expr (tree stmt, bool insert)
if (*slot == NULL)
{
*slot = (void *) element;
- VEC_safe_push (tree_on_heap, avail_exprs_stack,
+ VEC_safe_push (tree, heap, avail_exprs_stack,
stmt ? stmt : element->rhs);
return NULL_TREE;
}
@@ -3393,7 +3394,7 @@ record_range (tree cond, basic_block bb)
VARRAY_GENERIC_PTR_INIT (*vrp_records_p, 2, "vrp records");
VARRAY_PUSH_GENERIC_PTR (*vrp_records_p, element);
- VEC_safe_push (tree_on_heap, vrp_variables_stack, TREE_OPERAND (cond, 0));
+ VEC_safe_push (tree, heap, vrp_variables_stack, TREE_OPERAND (cond, 0));
}
}