=== modified file 'gcc/tree-ssa-structalias.c'
@@ -477,11 +477,14 @@ struct constraint_expr
typedef struct constraint_expr ce_s;
DEF_VEC_O(ce_s);
-DEF_VEC_ALLOC_O(ce_s, heap);
-static void get_constraint_for_1 (tree, VEC(ce_s, heap) **, bool, bool);
-static void get_constraint_for (tree, VEC(ce_s, heap) **);
-static void get_constraint_for_rhs (tree, VEC(ce_s, heap) **);
-static void do_deref (VEC (ce_s, heap) **);
+DEF_VEC_ALLOC_O_STACK(ce_s);
+#define VEC_ce_s_stack_alloc(alloc) \
+ VEC_stack_alloc (ce_s, alloc)
+
+static void get_constraint_for_1 (tree, VEC(ce_s, stack) **, bool, bool);
+static void get_constraint_for (tree, VEC(ce_s, stack) **);
+static void get_constraint_for_rhs (tree, VEC(ce_s, stack) **);
+static void do_deref (VEC (ce_s, stack) **);
/* Our set constraints are made up of two constraint expressions, one
LHS, and one RHS.
@@ -2736,7 +2739,7 @@ new_scalar_tmp_constraint_exp (const cha
If address_p is true, the result will be taken its address of. */
static void
-get_constraint_for_ssa_var (tree t, VEC(ce_s, heap) **results, bool address_p)
+get_constraint_for_ssa_var (tree t, VEC(ce_s, stack) **results, bool address_p)
{
struct constraint_expr cexpr;
varinfo_t vi;
@@ -2776,12 +2779,12 @@ get_constraint_for_ssa_var (tree t, VEC(
for (; vi; vi = vi->next)
{
cexpr.var = vi->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, stack, *results, &cexpr);
}
return;
}
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, stack, *results, &cexpr);
}
/* Process constraint T, performing various simplifications and then
@@ -2861,7 +2864,7 @@ bitpos_of_field (const tree fdecl)
static void
get_constraint_for_ptr_offset (tree ptr, tree offset,
- VEC (ce_s, heap) **results)
+ VEC (ce_s, stack) **results)
{
struct constraint_expr c;
unsigned int j, n;
@@ -2920,7 +2923,7 @@ get_constraint_for_ptr_offset (tree ptr,
c2.type = ADDRESSOF;
c2.offset = 0;
if (c2.var != c.var)
- VEC_safe_push (ce_s, heap, *results, &c2);
+ VEC_safe_push (ce_s, stack, *results, &c2);
temp = temp->next;
}
while (temp);
@@ -2955,7 +2958,7 @@ get_constraint_for_ptr_offset (tree ptr,
c2.var = temp->next->id;
c2.type = ADDRESSOF;
c2.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &c2);
+ VEC_safe_push (ce_s, stack, *results, &c2);
}
c.var = temp->id;
c.offset = 0;
@@ -2974,7 +2977,7 @@ get_constraint_for_ptr_offset (tree ptr,
as the lhs. */
static void
-get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results,
+get_constraint_for_component_ref (tree t, VEC(ce_s, stack) **results,
bool address_p, bool lhs_p)
{
tree orig_t = t;
@@ -2999,7 +3002,7 @@ get_constraint_for_component_ref (tree t
temp.offset = 0;
temp.var = integer_id;
temp.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
return;
}
@@ -3021,7 +3024,7 @@ get_constraint_for_component_ref (tree t
temp.offset = 0;
temp.var = anything_id;
temp.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
return;
}
}
@@ -3062,7 +3065,7 @@ get_constraint_for_component_ref (tree t
bitpos, bitmaxsize))
{
cexpr.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, stack, *results, &cexpr);
if (address_p)
break;
}
@@ -3077,7 +3080,7 @@ get_constraint_for_component_ref (tree t
while (curr->next != NULL)
curr = curr->next;
cexpr.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, stack, *results, &cexpr);
}
else if (VEC_length (ce_s, *results) == 0)
/* Assert that we found *some* field there. The user couldn't be
@@ -3090,7 +3093,7 @@ get_constraint_for_component_ref (tree t
cexpr.type = SCALAR;
cexpr.var = anything_id;
cexpr.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &cexpr);
+ VEC_safe_push (ce_s, stack, *results, &cexpr);
}
}
else if (bitmaxsize == 0)
@@ -3136,7 +3139,7 @@ get_constraint_for_component_ref (tree t
This is needed so that we can handle dereferencing DEREF constraints. */
static void
-do_deref (VEC (ce_s, heap) **constraints)
+do_deref (VEC (ce_s, stack) **constraints)
{
struct constraint_expr *c;
unsigned int i = 0;
@@ -3163,7 +3166,7 @@ do_deref (VEC (ce_s, heap) **constraints
address of it. */
static void
-get_constraint_for_address_of (tree t, VEC (ce_s, heap) **results)
+get_constraint_for_address_of (tree t, VEC (ce_s, stack) **results)
{
struct constraint_expr *c;
unsigned int i;
@@ -3182,7 +3185,7 @@ get_constraint_for_address_of (tree t, V
/* Given a tree T, return the constraint expression for it. */
static void
-get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p,
+get_constraint_for_1 (tree t, VEC (ce_s, stack) **results, bool address_p,
bool lhs_p)
{
struct constraint_expr temp;
@@ -3214,7 +3217,7 @@ get_constraint_for_1 (tree t, VEC (ce_s,
temp.var = nonlocal_id;
temp.type = ADDRESSOF;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
return;
}
@@ -3224,7 +3227,7 @@ get_constraint_for_1 (tree t, VEC (ce_s,
temp.var = readonly_id;
temp.type = SCALAR;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
return;
}
@@ -3275,7 +3278,7 @@ get_constraint_for_1 (tree t, VEC (ce_s,
if (curr->offset - vi->offset < size)
{
cs.var = curr->id;
- VEC_safe_push (ce_s, heap, *results, &cs);
+ VEC_safe_push (ce_s, stack, *results, &cs);
}
else
break;
@@ -3310,17 +3313,17 @@ get_constraint_for_1 (tree t, VEC (ce_s,
{
unsigned int i;
tree val;
- VEC (ce_s, heap) *tmp = NULL;
+ VEC (ce_s, stack) *tmp = VEC_alloc (ce_s, stack, 32);
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
{
struct constraint_expr *rhsp;
unsigned j;
get_constraint_for_1 (val, &tmp, address_p, lhs_p);
FOR_EACH_VEC_ELT (ce_s, tmp, j, rhsp)
- VEC_safe_push (ce_s, heap, *results, rhsp);
+ VEC_safe_push (ce_s, stack, *results, rhsp);
VEC_truncate (ce_s, tmp, 0);
}
- VEC_free (ce_s, heap, tmp);
+ VEC_free (ce_s, stack, tmp);
/* We do not know whether the constructor was complete,
so technically we have to add &NOTHING or &ANYTHING
like we do for an empty constructor as well. */
@@ -3341,7 +3344,7 @@ get_constraint_for_1 (tree t, VEC (ce_s,
temp.type = ADDRESSOF;
temp.var = nonlocal_id;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
return;
}
default:;
@@ -3351,13 +3354,13 @@ get_constraint_for_1 (tree t, VEC (ce_s,
temp.type = ADDRESSOF;
temp.var = anything_id;
temp.offset = 0;
- VEC_safe_push (ce_s, heap, *results, &temp);
+ VEC_safe_push (ce_s, stack, *results, &temp);
}
/* Given a gimple tree T, return the constraint expression vector for it. */
static void
-get_constraint_for (tree t, VEC (ce_s, heap) **results)
+get_constraint_for (tree t, VEC (ce_s, stack) **results)
{
gcc_assert (VEC_length (ce_s, *results) == 0);
@@ -3368,7 +3371,7 @@ get_constraint_for (tree t, VEC (ce_s, h
to be used as the rhs of a constraint. */
static void
-get_constraint_for_rhs (tree t, VEC (ce_s, heap) **results)
+get_constraint_for_rhs (tree t, VEC (ce_s, stack) **results)
{
gcc_assert (VEC_length (ce_s, *results) == 0);
@@ -3380,7 +3383,7 @@ get_constraint_for_rhs (tree t, VEC (ce_
entries in *LHSC. */
static void
-process_all_all_constraints (VEC (ce_s, heap) *lhsc, VEC (ce_s, heap) *rhsc)
+process_all_all_constraints (VEC (ce_s, stack) *lhsc, VEC (ce_s, stack) *rhsc)
{
struct constraint_expr *lhsp, *rhsp;
unsigned i, j;
@@ -3410,8 +3413,9 @@ static void
do_structure_copy (tree lhsop, tree rhsop)
{
struct constraint_expr *lhsp, *rhsp;
- VEC (ce_s, heap) *lhsc = NULL, *rhsc = NULL;
unsigned j;
+ VEC (ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+ VEC (ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
get_constraint_for (lhsop, &lhsc);
get_constraint_for_rhs (rhsop, &rhsc);
@@ -3470,14 +3474,14 @@ do_structure_copy (tree lhsop, tree rhso
else
gcc_unreachable ();
- VEC_free (ce_s, heap, lhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, lhsc);
+ VEC_free (ce_s, stack, rhsc);
}
/* Create constraints ID = { rhsc }. */
static void
-make_constraints_to (unsigned id, VEC(ce_s, heap) *rhsc)
+make_constraints_to (unsigned id, VEC(ce_s, stack) *rhsc)
{
struct constraint_expr *c;
struct constraint_expr includes;
@@ -3496,10 +3500,10 @@ make_constraints_to (unsigned id, VEC(ce
static void
make_constraint_to (unsigned id, tree op)
{
- VEC(ce_s, heap) *rhsc = NULL;
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
get_constraint_for_rhs (op, &rhsc);
make_constraints_to (id, rhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
/* Create a constraint ID = &FROM. */
@@ -3690,7 +3694,7 @@ get_function_part_constraint (varinfo_t
RHS. */
static void
-handle_rhs_call (gimple stmt, VEC(ce_s, heap) **results)
+handle_rhs_call (gimple stmt, VEC(ce_s, stack) **results)
{
struct constraint_expr rhsc;
unsigned i;
@@ -3744,7 +3748,7 @@ handle_rhs_call (gimple stmt, VEC(ce_s,
rhsc.var = get_call_use_vi (stmt)->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
/* The static chain escapes as well. */
@@ -3756,22 +3760,23 @@ handle_rhs_call (gimple stmt, VEC(ce_s,
&& gimple_call_lhs (stmt) != NULL_TREE
&& TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
{
- VEC(ce_s, heap) *tmpc = NULL;
struct constraint_expr lhsc, *c;
+ VEC(ce_s, stack) *tmpc = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for_address_of (gimple_call_lhs (stmt), &tmpc);
lhsc.var = escaped_id;
lhsc.offset = 0;
lhsc.type = SCALAR;
FOR_EACH_VEC_ELT (ce_s, tmpc, i, c)
process_constraint (new_constraint (lhsc, *c));
- VEC_free(ce_s, heap, tmpc);
+ VEC_free(ce_s, stack, tmpc);
}
/* Regular functions return nonlocal memory. */
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
/* For non-IPA mode, generate constraints necessary for a call
@@ -3779,10 +3784,10 @@ handle_rhs_call (gimple stmt, VEC(ce_s,
the LHS point to global and escaped variables. */
static void
-handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc,
+handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, stack) *rhsc,
tree fndecl)
{
- VEC(ce_s, heap) *lhsc = NULL;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
get_constraint_for (lhs, &lhsc);
/* If the store is to a global decl make sure to
@@ -3796,7 +3801,7 @@ handle_lhs_call (gimple stmt, tree lhs,
tmpc.var = escaped_id;
tmpc.offset = 0;
tmpc.type = SCALAR;
- VEC_safe_push (ce_s, heap, lhsc, &tmpc);
+ VEC_safe_push (ce_s, stack, lhsc, &tmpc);
}
/* If the call returns an argument unmodified override the rhs
@@ -3810,7 +3815,7 @@ handle_lhs_call (gimple stmt, tree lhs,
arg = gimple_call_arg (stmt, flags & ERF_RETURN_ARG_MASK);
get_constraint_for (arg, &rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
else if (flags & ERF_NOALIAS)
{
@@ -3831,19 +3836,19 @@ handle_lhs_call (gimple stmt, tree lhs,
tmpc.var = vi->id;
tmpc.offset = 0;
tmpc.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, rhsc, &tmpc);
+ VEC_safe_push (ce_s, stack, rhsc, &tmpc);
}
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
}
/* For non-IPA mode, generate constraints necessary for a call of a
const function that returns a pointer in the statement STMT. */
static void
-handle_const_call (gimple stmt, VEC(ce_s, heap) **results)
+handle_const_call (gimple stmt, VEC(ce_s, stack) **results)
{
struct constraint_expr rhsc;
unsigned int k;
@@ -3858,34 +3863,35 @@ handle_const_call (gimple stmt, VEC(ce_s
rhsc.var = uses->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
/* May return arguments. */
for (k = 0; k < gimple_call_num_args (stmt); ++k)
{
tree arg = gimple_call_arg (stmt, k);
- VEC(ce_s, heap) *argc = NULL;
unsigned i;
struct constraint_expr *argp;
+ VEC(ce_s, stack) *argc = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for_rhs (arg, &argc);
FOR_EACH_VEC_ELT (ce_s, argc, i, argp)
- VEC_safe_push (ce_s, heap, *results, argp);
- VEC_free(ce_s, heap, argc);
+ VEC_safe_push (ce_s, stack, *results, argp);
+ VEC_free(ce_s, stack, argc);
}
/* May return addresses of globals. */
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = ADDRESSOF;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
/* For non-IPA mode, generate constraints necessary for a call to a
pure function in statement STMT. */
static void
-handle_pure_call (gimple stmt, VEC(ce_s, heap) **results)
+handle_pure_call (gimple stmt, VEC(ce_s, stack) **results)
{
struct constraint_expr rhsc;
unsigned i;
@@ -3920,12 +3926,12 @@ handle_pure_call (gimple stmt, VEC(ce_s,
rhsc.var = uses->id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
- VEC_safe_push (ce_s, heap, *results, &rhsc);
+ VEC_safe_push (ce_s, stack, *results, &rhsc);
}
@@ -3966,9 +3972,9 @@ static bool
find_func_aliases_for_builtin_call (gimple t)
{
tree fndecl = gimple_call_fndecl (t);
- VEC(ce_s, heap) *lhsc = NULL;
- VEC(ce_s, heap) *rhsc = NULL;
varinfo_t fi;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
if (fndecl != NULL_TREE
&& DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
@@ -4007,16 +4013,16 @@ find_func_aliases_for_builtin_call (gimp
else
get_constraint_for (dest, &rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, lhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, lhsc);
+ VEC_free (ce_s, stack, rhsc);
}
get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
do_deref (&lhsc);
do_deref (&rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, lhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, lhsc);
+ VEC_free (ce_s, stack, rhsc);
return true;
}
case BUILT_IN_MEMSET:
@@ -4031,8 +4037,8 @@ find_func_aliases_for_builtin_call (gimp
get_constraint_for (res, &lhsc);
get_constraint_for (dest, &rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, lhsc);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, lhsc);
+ VEC_free (ce_s, stack, rhsc);
}
get_constraint_for_ptr_offset (dest, NULL_TREE, &lhsc);
do_deref (&lhsc);
@@ -4050,7 +4056,7 @@ find_func_aliases_for_builtin_call (gimp
ac.offset = 0;
FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (*lhsp, ac));
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
return true;
}
/* All the following functions do not return pointers, do not
@@ -4096,7 +4102,7 @@ find_func_aliases_for_builtin_call (gimp
get_constraint_for (frame, &rhsc);
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
/* Make the frame point to the function for
the trampoline adjustment call. */
@@ -4104,8 +4110,8 @@ find_func_aliases_for_builtin_call (gimp
do_deref (&lhsc);
get_constraint_for (nfunc, &rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, rhsc);
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, rhsc);
+ VEC_free (ce_s, stack, lhsc);
return true;
}
@@ -4124,8 +4130,8 @@ find_func_aliases_for_builtin_call (gimp
get_constraint_for (tramp, &rhsc);
do_deref (&rhsc);
process_all_all_constraints (lhsc, rhsc);
- VEC_free (ce_s, heap, rhsc);
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, rhsc);
+ VEC_free (ce_s, stack, lhsc);
}
return true;
}
@@ -4148,7 +4154,7 @@ find_func_aliases_for_builtin_call (gimp
rhs.type = ADDRESSOF;
FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (*lhsp, rhs));
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
/* va_list is clobbered. */
make_constraint_to (get_call_clobber_vi (t)->id, valist);
return true;
@@ -4193,9 +4199,9 @@ static void
find_func_aliases_for_call (gimple t)
{
tree fndecl = gimple_call_fndecl (t);
- VEC(ce_s, heap) *lhsc = NULL;
- VEC(ce_s, heap) *rhsc = NULL;
varinfo_t fi;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
if (fndecl != NULL_TREE
&& DECL_BUILT_IN (fndecl)
@@ -4206,7 +4212,7 @@ find_func_aliases_for_call (gimple t)
if (!in_ipa_mode
|| (fndecl && !fi->is_fn_info))
{
- VEC(ce_s, heap) *rhsc = NULL;
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
int flags = gimple_call_flags (t);
/* Const functions can return their arguments and addresses
@@ -4225,7 +4231,7 @@ find_func_aliases_for_call (gimple t)
handle_rhs_call (t, &rhsc);
if (gimple_call_lhs (t))
handle_lhs_call (t, gimple_call_lhs (t), flags, rhsc, fndecl);
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
else
{
@@ -4263,11 +4269,11 @@ find_func_aliases_for_call (gimple t)
&& DECL_RESULT (fndecl)
&& DECL_BY_REFERENCE (DECL_RESULT (fndecl)))
{
- VEC(ce_s, heap) *tem = NULL;
- VEC_safe_push (ce_s, heap, tem, &rhs);
+ VEC(ce_s, stack) *tem = VEC_alloc (ce_s, stack, 32);
+ VEC_safe_push (ce_s, stack, tem, &rhs);
do_deref (&tem);
rhs = *VEC_index (ce_s, tem, 0);
- VEC_free(ce_s, heap, tem);
+ VEC_free(ce_s, stack, tem);
}
FOR_EACH_VEC_ELT (ce_s, lhsc, j, lhsp)
process_constraint (new_constraint (*lhsp, rhs));
@@ -4286,7 +4292,7 @@ find_func_aliases_for_call (gimple t)
lhs = get_function_part_constraint (fi, fi_result);
FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
/* If we use a static chain, pass it along. */
@@ -4312,10 +4318,10 @@ static void
find_func_aliases (gimple origt)
{
gimple t = origt;
- VEC(ce_s, heap) *lhsc = NULL;
- VEC(ce_s, heap) *rhsc = NULL;
struct constraint_expr *c;
varinfo_t fi;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
/* Now build constraints expressions. */
if (gimple_code (t) == GIMPLE_PHI)
@@ -4395,18 +4401,19 @@ find_func_aliases (gimple origt)
else
{
/* All other operations are merges. */
- VEC (ce_s, heap) *tmp = NULL;
struct constraint_expr *rhsp;
unsigned i, j;
+ VEC (ce_s, stack) *tmp = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for_rhs (gimple_assign_rhs1 (t), &rhsc);
for (i = 2; i < gimple_num_ops (t); ++i)
{
get_constraint_for_rhs (gimple_op (t, i), &tmp);
FOR_EACH_VEC_ELT (ce_s, tmp, j, rhsp)
- VEC_safe_push (ce_s, heap, rhsc, rhsp);
+ VEC_safe_push (ce_s, stack, rhsc, rhsp);
VEC_truncate (ce_s, tmp, 0);
}
- VEC_free (ce_s, heap, tmp);
+ VEC_free (ce_s, stack, tmp);
}
process_all_all_constraints (lhsc, rhsc);
}
@@ -4477,16 +4484,17 @@ find_func_aliases (gimple origt)
any global memory. */
if (op)
{
- VEC(ce_s, heap) *lhsc = NULL;
struct constraint_expr rhsc, *lhsp;
unsigned j;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for (op, &lhsc);
rhsc.var = nonlocal_id;
rhsc.offset = 0;
rhsc.type = SCALAR;
FOR_EACH_VEC_ELT (ce_s, lhsc, j, lhsp)
process_constraint (new_constraint (*lhsp, rhsc));
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
}
}
for (i = 0; i < gimple_asm_ninputs (t); ++i)
@@ -4510,8 +4518,8 @@ find_func_aliases (gimple origt)
}
}
- VEC_free (ce_s, heap, rhsc);
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, rhsc);
+ VEC_free (ce_s, stack, lhsc);
}
@@ -4521,14 +4529,15 @@ find_func_aliases (gimple origt)
static void
process_ipa_clobber (varinfo_t fi, tree ptr)
{
- VEC(ce_s, heap) *ptrc = NULL;
struct constraint_expr *c, lhs;
unsigned i;
+ VEC(ce_s, stack) *ptrc = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for_rhs (ptr, &ptrc);
lhs = get_function_part_constraint (fi, fi_clobbers);
FOR_EACH_VEC_ELT (ce_s, ptrc, i, c)
process_constraint (new_constraint (lhs, *c));
- VEC_free (ce_s, heap, ptrc);
+ VEC_free (ce_s, stack, ptrc);
}
/* Walk statement T setting up clobber and use constraints according to the
@@ -4539,9 +4548,9 @@ static void
find_func_clobbers (gimple origt)
{
gimple t = origt;
- VEC(ce_s, heap) *lhsc = NULL;
- VEC(ce_s, heap) *rhsc = NULL;
varinfo_t fi;
+ VEC(ce_s, stack) *lhsc = VEC_alloc (ce_s, stack, 32);
+ VEC(ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
/* Add constraints for clobbered/used in IPA mode.
We are not interested in what automatic variables are clobbered
@@ -4579,7 +4588,7 @@ find_func_clobbers (gimple origt)
get_constraint_for_address_of (lhs, &rhsc);
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhsc, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
}
@@ -4607,7 +4616,7 @@ find_func_clobbers (gimple origt)
get_constraint_for_address_of (rhs, &rhsc);
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
}
@@ -4647,12 +4656,12 @@ find_func_clobbers (gimple origt)
lhs = get_function_part_constraint (fi, fi_clobbers);
FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (lhs, *lhsp));
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
lhs = get_function_part_constraint (fi, fi_uses);
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
return;
}
/* The following function clobbers memory pointed to by
@@ -4666,7 +4675,7 @@ find_func_clobbers (gimple origt)
lhs = get_function_part_constraint (fi, fi_clobbers);
FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp)
process_constraint (new_constraint (lhs, *lhsp));
- VEC_free (ce_s, heap, lhsc);
+ VEC_free (ce_s, stack, lhsc);
return;
}
/* The following functions clobber their second and third
@@ -4735,7 +4744,7 @@ find_func_clobbers (gimple origt)
get_constraint_for_address_of (arg, &rhsc);
FOR_EACH_VEC_ELT (ce_s, rhsc, j, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
/* Build constraints for propagating clobbers/uses along the
@@ -4796,7 +4805,7 @@ find_func_clobbers (gimple origt)
anything_id);
}
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
@@ -5436,9 +5445,10 @@ create_variable_info_for (tree decl, con
if (in_ipa_mode
&& DECL_INITIAL (decl))
{
- VEC (ce_s, heap) *rhsc = NULL;
struct constraint_expr lhs, *rhsp;
unsigned i;
+ VEC (ce_s, stack) *rhsc = VEC_alloc (ce_s, stack, 32);
+
get_constraint_for_rhs (DECL_INITIAL (decl), &rhsc);
lhs.var = vi->id;
lhs.offset = 0;
@@ -5455,7 +5465,7 @@ create_variable_info_for (tree decl, con
FOR_EACH_VEC_ELT (ce_s, rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp));
}
- VEC_free (ce_s, heap, rhsc);
+ VEC_free (ce_s, stack, rhsc);
}
}
=== modified file 'gcc/tree-ssa-sccvn.c'
@@ -2221,7 +2221,7 @@ vn_phi_insert (gimple phi, tree result)
/* Print set of components in strongly connected component SCC to OUT. */
static void
-print_scc (FILE *out, VEC (tree, heap) *scc)
+print_scc (FILE *out, VEC (tree, stack) *scc)
{
tree var;
unsigned int i;
@@ -3203,7 +3203,7 @@ compare_ops (const void *pa, const void
array will give you the members in RPO order. */
static void
-sort_scc (VEC (tree, heap) *scc)
+sort_scc (VEC (tree, stack) *scc)
{
VEC_qsort (tree, scc, compare_ops);
}
@@ -3254,7 +3254,7 @@ copy_reference (vn_reference_t oref, vn_
/* Process a strongly connected component in the SSA graph. */
static void
-process_scc (VEC (tree, heap) *scc)
+process_scc (VEC (tree, stack) *scc)
{
tree var;
unsigned int i;
@@ -3334,8 +3334,8 @@ DEF_VEC_ALLOC_O(ssa_op_iter,heap);
static bool
extract_and_process_scc_for_name (tree name)
{
- VEC (tree, heap) *scc = NULL;
tree x;
+ VEC (tree, stack) *scc = VEC_alloc (tree, stack, 16);
/* Found an SCC, pop the components off the SCC stack and
process them. */
@@ -3344,7 +3344,7 @@ extract_and_process_scc_for_name (tree n
x = VEC_pop (tree, sccstack);
VN_INFO (x)->on_sccstack = false;
- VEC_safe_push (tree, heap, scc, x);
+ VEC_safe_push (tree, stack, scc, x);
} while (x != name);
/* Bail out of SCCVN in case a SCC turns out to be incredibly large. */
@@ -3366,7 +3366,7 @@ extract_and_process_scc_for_name (tree n
process_scc (scc);
- VEC_free (tree, heap, scc);
+ VEC_free (tree, stack, scc);
return true;
}
=== modified file 'gcc/vecir.h'
@@ -28,6 +28,9 @@ along with GCC; see the file COPYING3.
DEF_VEC_P(tree);
DEF_VEC_ALLOC_P(tree,gc);
DEF_VEC_ALLOC_P(tree,heap);
+DEF_VEC_ALLOC_P_STACK(tree);
+#define VEC_tree_stack_alloc(alloc) \
+ VEC_stack_alloc (tree, alloc)
/* A varray of gimple statements. */
DEF_VEC_P(gimple);