summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r--gcc/tree-ssa-threadedge.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 64e42f3b701..40c9d44d924 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -43,32 +43,31 @@ along with GCC; see the file COPYING3. If not see
static int stmt_count;
/* Array to record value-handles per SSA_NAME. */
-VEC(tree,heap) *ssa_name_values;
+vec<tree> ssa_name_values;
/* Set the value for the SSA name NAME to VALUE. */
void
set_ssa_name_value (tree name, tree value)
{
- if (SSA_NAME_VERSION (name) >= VEC_length (tree, ssa_name_values))
- VEC_safe_grow_cleared (tree, heap, ssa_name_values,
- SSA_NAME_VERSION (name) + 1);
- VEC_replace (tree, ssa_name_values, SSA_NAME_VERSION (name), value);
+ if (SSA_NAME_VERSION (name) >= ssa_name_values.length ())
+ ssa_name_values.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
+ ssa_name_values[SSA_NAME_VERSION (name)] = value;
}
/* Initialize the per SSA_NAME value-handles array. Returns it. */
void
threadedge_initialize_values (void)
{
- gcc_assert (ssa_name_values == NULL);
- ssa_name_values = VEC_alloc(tree, heap, num_ssa_names);
+ gcc_assert (!ssa_name_values.exists ());
+ ssa_name_values.create (num_ssa_names);
}
/* Free the per SSA_NAME value-handle array. */
void
threadedge_finalize_values (void)
{
- VEC_free(tree, heap, ssa_name_values);
+ ssa_name_values.release ();
}
/* Return TRUE if we may be able to thread an incoming edge into
@@ -134,20 +133,20 @@ lhs_of_dominating_assert (tree op, basic_block bb, gimple stmt)
structures. */
static void
-remove_temporary_equivalences (VEC(tree, heap) **stack)
+remove_temporary_equivalences (vec<tree> *stack)
{
- while (VEC_length (tree, *stack) > 0)
+ while (stack->length () > 0)
{
tree prev_value, dest;
- dest = VEC_pop (tree, *stack);
+ dest = stack->pop ();
/* A NULL value indicates we should stop unwinding, otherwise
pop off the next entry as they're recorded in pairs. */
if (dest == NULL)
break;
- prev_value = VEC_pop (tree, *stack);
+ prev_value = stack->pop ();
set_ssa_name_value (dest, prev_value);
}
}
@@ -157,7 +156,7 @@ remove_temporary_equivalences (VEC(tree, heap) **stack)
done processing the current edge. */
static void
-record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack)
+record_temporary_equivalence (tree x, tree y, vec<tree> *stack)
{
tree prev_x = SSA_NAME_VALUE (x);
@@ -168,9 +167,9 @@ record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack)
}
set_ssa_name_value (x, y);
- VEC_reserve (tree, heap, *stack, 2);
- VEC_quick_push (tree, *stack, prev_x);
- VEC_quick_push (tree, *stack, x);
+ stack->reserve (2);
+ stack->quick_push (prev_x);
+ stack->quick_push (x);
}
/* Record temporary equivalences created by PHIs at the target of the
@@ -180,7 +179,7 @@ record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack)
indicating we should not thread this edge, else return TRUE. */
static bool
-record_temporary_equivalences_from_phis (edge e, VEC(tree, heap) **stack)
+record_temporary_equivalences_from_phis (edge e, vec<tree> *stack)
{
gimple_stmt_iterator gsi;
@@ -281,7 +280,7 @@ fold_assignment_stmt (gimple stmt)
static gimple
record_temporary_equivalences_from_stmts_at_dest (edge e,
- VEC(tree, heap) **stack,
+ vec<tree> *stack,
tree (*simplify) (gimple,
gimple))
{
@@ -610,10 +609,6 @@ cond_arg_set_in_bb (edge e, basic_block bb)
return false;
}
-DEF_VEC_O(tree);
-DEF_VEC_ALLOC_O_STACK(tree);
-#define VEC_tree_stack_alloc(alloc) VEC_stack_alloc (tree, alloc)
-
/* Copy debug stmts from DEST's chain of single predecessors up to
SRC, so that we don't lose the bindings as PHI nodes are introduced
when DEST gains new predecessors. */
@@ -643,7 +638,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
i++;
}
- VEC(tree, stack) *fewvars = NULL;
+ vec<tree, va_stack> fewvars = vec<tree, va_stack>();
pointer_set_t *vars = NULL;
/* If we're already starting with 3/4 of alloc_count, go for a
@@ -652,7 +647,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
if (i * 4 > alloc_count * 3)
vars = pointer_set_create ();
else if (alloc_count)
- fewvars = VEC_alloc (tree, stack, alloc_count);
+ vec_stack_alloc (tree, fewvars, alloc_count);
/* Now go through the initial debug stmts in DEST again, this time
actually inserting in VARS or FEWVARS. Don't bother checking for
@@ -675,7 +670,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
if (vars)
pointer_set_insert (vars, var);
else
- VEC_quick_push (tree, fewvars, var);
+ fewvars.quick_push (var);
}
basic_block bb = dest;
@@ -711,21 +706,21 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
continue;
else if (!vars)
{
- int i = VEC_length (tree, fewvars);
+ int i = fewvars.length ();
while (i--)
- if (VEC_index (tree, fewvars, i) == var)
+ if (fewvars[i] == var)
break;
if (i >= 0)
continue;
- if (VEC_length (tree, fewvars) < alloc_count)
- VEC_quick_push (tree, fewvars, var);
+ if (fewvars.length () < alloc_count)
+ fewvars.quick_push (var);
else
{
vars = pointer_set_create ();
for (i = 0; i < alloc_count; i++)
- pointer_set_insert (vars, VEC_index (tree, fewvars, i));
- VEC_free (tree, stack, fewvars);
+ pointer_set_insert (vars, fewvars[i]);
+ fewvars.release ();
pointer_set_insert (vars, var);
}
}
@@ -740,8 +735,8 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src)
if (vars)
pointer_set_destroy (vars);
- else if (fewvars)
- VEC_free (tree, stack, fewvars);
+ else if (fewvars.exists ())
+ fewvars.release ();
}
/* TAKEN_EDGE represents the an edge taken as a result of jump threading.
@@ -866,7 +861,7 @@ void
thread_across_edge (gimple dummy_cond,
edge e,
bool handle_dominating_asserts,
- VEC(tree, heap) **stack,
+ vec<tree> *stack,
tree (*simplify) (gimple, gimple))
{
gimple stmt;