add auto_vec

2013-11-22  Trevor Saunders  <tsaunders@mozilla.com>

gcc/
	* vec.h (auto_vec): New class.
	* cfganal.c, cfgloop.c, cgraphunit.c, config/i386/i386.c, dwarf2out.c,
	function.c, genautomata.c, gimple.c, haifa-sched.c, ipa-inline.c,
	ira-build.c, loop-unroll.c, omp-low.c, ree.c, trans-mem.c,
tree-call-cdce.c, tree-eh.c, tree-if-conv.c, tree-into-ssa.c,
tree-loop-distribution.c, tree-predcom.c, tree-sra.c,
tree-sssa-forwprop.c, tree-ssa-loop-manip.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-structalias.c,
	tree-vect-loop.c, tree-vect-stmts.c: Use auto_vec and stack_vec as
	appropriate instead of vec for local variables.

	cp/
	* parser.c, semantics.c: Change some local variables from vec to
	auto_vec or stack_vec.

From-SVN: r205244
This commit is contained in:
Trevor Saunders 2013-11-22 05:45:37 +00:00 committed by Trevor Saunders
parent d41d612242
commit ef062b13d7
35 changed files with 107 additions and 221 deletions

View File

@ -1,3 +1,16 @@
2013-11-22 Trevor Saunders <tsaunders@mozilla.com>
* vec.h (auto_vec): New class.
* cfganal.c, cfgloop.c, cgraphunit.c, config/i386/i386.c, dwarf2out.c,
function.c, genautomata.c, gimple.c, haifa-sched.c, ipa-inline.c,
ira-build.c, loop-unroll.c, omp-low.c, ree.c, trans-mem.c,
tree-call-cdce.c, tree-eh.c, tree-if-conv.c, tree-into-ssa.c,
tree-loop-distribution.c, tree-predcom.c, tree-sra.c,
tree-sssa-forwprop.c, tree-ssa-loop-manip.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-structalias.c,
tree-vect-loop.c, tree-vect-stmts.c: Use auto_vec and stack_vec as
appropriate instead of vec for local variables.
2013-11-21 Teresa Johnson <tejohnson@google.com> 2013-11-21 Teresa Johnson <tejohnson@google.com>
PR target/59233 PR target/59233

View File

@ -1286,11 +1286,10 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs)
{ {
bitmap_iterator bi; bitmap_iterator bi;
unsigned bb_index, i; unsigned bb_index, i;
vec<int> work_stack;
bitmap phi_insertion_points; bitmap phi_insertion_points;
/* Each block can appear at most twice on the work-stack. */ /* Each block can appear at most twice on the work-stack. */
work_stack.create (2 * n_basic_blocks_for_fn (cfun)); auto_vec<int> work_stack (2 * n_basic_blocks_for_fn (cfun));
phi_insertion_points = BITMAP_ALLOC (NULL); phi_insertion_points = BITMAP_ALLOC (NULL);
/* Seed the work list with all the blocks in DEF_BLOCKS. We use /* Seed the work list with all the blocks in DEF_BLOCKS. We use
@ -1324,8 +1323,6 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs)
} }
} }
work_stack.release ();
return phi_insertion_points; return phi_insertion_points;
} }

View File

@ -405,7 +405,6 @@ flow_loops_find (struct loops *loops)
int *rc_order; int *rc_order;
int b; int b;
unsigned i; unsigned i;
vec<loop_p> larray;
/* Ensure that the dominators are computed. */ /* Ensure that the dominators are computed. */
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
@ -434,7 +433,7 @@ flow_loops_find (struct loops *loops)
/* Gather all loop headers in reverse completion order and allocate /* Gather all loop headers in reverse completion order and allocate
loop structures for loops that are not already present. */ loop structures for loops that are not already present. */
larray.create (loops->larray->length ()); auto_vec<loop_p> larray (loops->larray->length ());
for (b = 0; b < n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; b++) for (b = 0; b < n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; b++)
{ {
basic_block header = BASIC_BLOCK (rc_order[b]); basic_block header = BASIC_BLOCK (rc_order[b]);
@ -510,8 +509,6 @@ flow_loops_find (struct loops *loops)
} }
} }
larray.release ();
return loops; return loops;
} }

View File

@ -1525,7 +1525,6 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
int i; int i;
tree resdecl; tree resdecl;
tree restmp = NULL; tree restmp = NULL;
vec<tree> vargs;
gimple call; gimple call;
gimple ret; gimple ret;
@ -1579,7 +1578,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
for (arg = a; arg; arg = DECL_CHAIN (arg)) for (arg = a; arg; arg = DECL_CHAIN (arg))
nargs++; nargs++;
vargs.create (nargs); auto_vec<tree> vargs (nargs);
if (this_adjusting) if (this_adjusting)
vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset, vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
virtual_offset)); virtual_offset));
@ -1591,7 +1590,6 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
vargs.quick_push (arg); vargs.quick_push (arg);
call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs); call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
node->callees->call_stmt = call; node->callees->call_stmt = call;
vargs.release ();
gimple_call_set_from_thunk (call, true); gimple_call_set_from_thunk (call, true);
if (restmp) if (restmp)
{ {

View File

@ -30708,7 +30708,6 @@ ix86_generate_version_dispatcher_body (void *node_p)
{ {
tree resolver_decl; tree resolver_decl;
basic_block empty_bb; basic_block empty_bb;
vec<tree> fn_ver_vec = vNULL;
tree default_ver_decl; tree default_ver_decl;
struct cgraph_node *versn; struct cgraph_node *versn;
struct cgraph_node *node; struct cgraph_node *node;
@ -30738,7 +30737,7 @@ ix86_generate_version_dispatcher_body (void *node_p)
push_cfun (DECL_STRUCT_FUNCTION (resolver_decl)); push_cfun (DECL_STRUCT_FUNCTION (resolver_decl));
fn_ver_vec.create (2); stack_vec<tree, 2> fn_ver_vec;
for (versn_info = node_version_info->next; versn_info; for (versn_info = node_version_info->next; versn_info;
versn_info = versn_info->next) versn_info = versn_info->next)
@ -30756,7 +30755,6 @@ ix86_generate_version_dispatcher_body (void *node_p)
} }
dispatch_function_versions (resolver_decl, &fn_ver_vec, &empty_bb); dispatch_function_versions (resolver_decl, &fn_ver_vec, &empty_bb);
fn_ver_vec.release ();
rebuild_cgraph_edges (); rebuild_cgraph_edges ();
pop_cfun (); pop_cfun ();
return resolver_decl; return resolver_decl;

View File

@ -1,3 +1,8 @@
2013-11-22 Trevor Saunders <tsaunders@mozilla.com>
* parser.c, semantics.c: Change some local variables from vec to
auto_vec or stack_vec.
2013-11-18 Richard Sandiford <rdsandiford@googlemail.com> 2013-11-18 Richard Sandiford <rdsandiford@googlemail.com>
* decl.c (reshape_init_array_1): Use tree_to_uhwi rather than * decl.c (reshape_init_array_1): Use tree_to_uhwi rather than

View File

@ -30345,7 +30345,7 @@ static void
cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok, cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
enum pragma_context) enum pragma_context)
{ {
vec<tree> types = vNULL; auto_vec<tree> types;
enum tree_code reduc_code = ERROR_MARK; enum tree_code reduc_code = ERROR_MARK;
tree reduc_id = NULL_TREE, orig_reduc_id = NULL_TREE, type; tree reduc_id = NULL_TREE, orig_reduc_id = NULL_TREE, type;
unsigned int i; unsigned int i;
@ -30460,7 +30460,6 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
{ {
fail: fail:
cp_parser_skip_to_pragma_eol (parser, pragma_tok); cp_parser_skip_to_pragma_eol (parser, pragma_tok);
types.release ();
return; return;
} }
@ -30565,7 +30564,6 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
} }
cp_parser_require_pragma_eol (parser, pragma_tok); cp_parser_require_pragma_eol (parser, pragma_tok);
types.release ();
} }
/* OpenMP 4.0 /* OpenMP 4.0

View File

@ -4376,24 +4376,17 @@ handle_omp_array_sections (tree c)
{ {
bool maybe_zero_len = false; bool maybe_zero_len = false;
unsigned int first_non_one = 0; unsigned int first_non_one = 0;
vec<tree> types = vNULL; auto_vec<tree> types;
tree first = handle_omp_array_sections_1 (c, OMP_CLAUSE_DECL (c), types, tree first = handle_omp_array_sections_1 (c, OMP_CLAUSE_DECL (c), types,
maybe_zero_len, first_non_one); maybe_zero_len, first_non_one);
if (first == error_mark_node) if (first == error_mark_node)
{
types.release ();
return true; return true;
}
if (first == NULL_TREE) if (first == NULL_TREE)
{
types.release ();
return false; return false;
}
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND)
{ {
tree t = OMP_CLAUSE_DECL (c); tree t = OMP_CLAUSE_DECL (c);
tree tem = NULL_TREE; tree tem = NULL_TREE;
types.release ();
if (processing_template_decl) if (processing_template_decl)
return false; return false;
/* Need to evaluate side effects in the length expressions /* Need to evaluate side effects in the length expressions
@ -4423,10 +4416,7 @@ handle_omp_array_sections (tree c)
if (int_size_in_bytes (TREE_TYPE (first)) <= 0) if (int_size_in_bytes (TREE_TYPE (first)) <= 0)
maybe_zero_len = true; maybe_zero_len = true;
if (processing_template_decl && maybe_zero_len) if (processing_template_decl && maybe_zero_len)
{
types.release ();
return false; return false;
}
for (i = num, t = OMP_CLAUSE_DECL (c); i > 0; for (i = num, t = OMP_CLAUSE_DECL (c); i > 0;
t = TREE_CHAIN (t)) t = TREE_CHAIN (t))
@ -4469,7 +4459,6 @@ handle_omp_array_sections (tree c)
"array section is not contiguous in %qs " "array section is not contiguous in %qs "
"clause", "clause",
omp_clause_code_name[OMP_CLAUSE_CODE (c)]); omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
types.release ();
return true; return true;
} }
} }
@ -4525,7 +4514,6 @@ handle_omp_array_sections (tree c)
size = size_binop (MULT_EXPR, size, l); size = size_binop (MULT_EXPR, size, l);
} }
} }
types.release ();
if (!processing_template_decl) if (!processing_template_decl)
{ {
if (side_effects) if (side_effects)

View File

@ -19111,7 +19111,7 @@ static char *
gen_producer_string (void) gen_producer_string (void)
{ {
size_t j; size_t j;
vec<dchar_p> switches = vNULL; auto_vec<dchar_p> switches;
const char *language_string = lang_hooks.name; const char *language_string = lang_hooks.name;
char *producer, *tail; char *producer, *tail;
const char *p; const char *p;
@ -19192,7 +19192,6 @@ gen_producer_string (void)
} }
*tail = '\0'; *tail = '\0';
switches.release ();
return producer; return producer;
} }

View File

@ -5722,9 +5722,8 @@ convert_jumps_to_returns (basic_block last_bb, bool simple_p,
rtx label; rtx label;
edge_iterator ei; edge_iterator ei;
edge e; edge e;
vec<basic_block> src_bbs; auto_vec<basic_block> src_bbs (EDGE_COUNT (last_bb->preds));
src_bbs.create (EDGE_COUNT (last_bb->preds));
FOR_EACH_EDGE (e, ei, last_bb->preds) FOR_EACH_EDGE (e, ei, last_bb->preds)
if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)) if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
src_bbs.quick_push (e->src); src_bbs.quick_push (e->src);

View File

@ -3340,7 +3340,6 @@ static alt_state_t
uniq_sort_alt_states (alt_state_t alt_states_list) uniq_sort_alt_states (alt_state_t alt_states_list)
{ {
alt_state_t curr_alt_state; alt_state_t curr_alt_state;
vec<alt_state_t> alt_states;
size_t i; size_t i;
size_t prev_unique_state_ind; size_t prev_unique_state_ind;
alt_state_t result; alt_state_t result;
@ -3350,7 +3349,7 @@ uniq_sort_alt_states (alt_state_t alt_states_list)
if (alt_states_list->next_alt_state == 0) if (alt_states_list->next_alt_state == 0)
return alt_states_list; return alt_states_list;
alt_states.create (150); stack_vec<alt_state_t, 150> alt_states;
for (curr_alt_state = alt_states_list; for (curr_alt_state = alt_states_list;
curr_alt_state != NULL; curr_alt_state != NULL;
curr_alt_state = curr_alt_state->next_alt_state) curr_alt_state = curr_alt_state->next_alt_state)
@ -3374,7 +3373,6 @@ uniq_sort_alt_states (alt_state_t alt_states_list)
result = alt_states[0]; result = alt_states[0];
alt_states.release ();
return result; return result;
} }
@ -5148,7 +5146,6 @@ check_regexp_units_distribution (const char *insn_reserv_name,
bool annotation_reservation_message_reported_p; bool annotation_reservation_message_reported_p;
regexp_t seq, allof, unit; regexp_t seq, allof, unit;
struct unit_usage *unit_usage_ptr; struct unit_usage *unit_usage_ptr;
vec<int> marked;
if (regexp == NULL || regexp->mode != rm_oneof) if (regexp == NULL || regexp->mode != rm_oneof)
return; return;
@ -5228,7 +5225,7 @@ check_regexp_units_distribution (const char *insn_reserv_name,
unit_usage_ptr = unit_usage_ptr->next) unit_usage_ptr = unit_usage_ptr->next)
unit_usage_ptr->unit_decl->last_distribution_check_cycle = -1; unit_usage_ptr->unit_decl->last_distribution_check_cycle = -1;
n_alts = REGEXP_ONEOF (regexp)->regexps_num; n_alts = REGEXP_ONEOF (regexp)->regexps_num;
marked.create (n_alts); auto_vec<int> marked (n_alts);
for (i = 0; i < n_alts; i++) for (i = 0; i < n_alts; i++)
marked.safe_push (0); marked.safe_push (0);
annotation_reservation_message_reported_p = false; annotation_reservation_message_reported_p = false;
@ -5294,7 +5291,6 @@ check_regexp_units_distribution (const char *insn_reserv_name,
} }
} }
} }
marked.release ();
cycle_alt_unit_usages.release (); cycle_alt_unit_usages.release ();
obstack_free (&unit_usages, NULL); obstack_free (&unit_usages, NULL);
} }
@ -5488,8 +5484,7 @@ form_ainsn_with_same_reservs (automaton_t automaton)
{ {
ainsn_t curr_ainsn; ainsn_t curr_ainsn;
size_t i; size_t i;
vec<ainsn_t> last_insns; stack_vec<ainsn_t, 150> last_insns;
last_insns.create (150);
for (curr_ainsn = automaton->ainsn_list; for (curr_ainsn = automaton->ainsn_list;
curr_ainsn != NULL; curr_ainsn != NULL;
@ -5519,7 +5514,6 @@ form_ainsn_with_same_reservs (automaton_t automaton)
curr_ainsn->first_insn_with_same_reservs = 1; curr_ainsn->first_insn_with_same_reservs = 1;
} }
} }
last_insns.release ();
} }
/* Forming unit reservations which can affect creating the automaton /* Forming unit reservations which can affect creating the automaton
@ -5561,8 +5555,7 @@ make_automaton (automaton_t automaton)
state_t state; state_t state;
state_t start_state; state_t start_state;
state_t state2; state_t state2;
vec<state_t> state_stack; stack_vec<state_t, 150> state_stack;
state_stack.create (150);
int states_n; int states_n;
reserv_sets_t reservs_matter = form_reservs_matter (automaton); reserv_sets_t reservs_matter = form_reservs_matter (automaton);
@ -5621,7 +5614,6 @@ make_automaton (automaton_t automaton)
} }
add_arc (state, state2, automaton->advance_ainsn); add_arc (state, state2, automaton->advance_ainsn);
} }
state_stack.release ();
} }
/* Form lists of all arcs of STATE marked by the same ainsn. */ /* Form lists of all arcs of STATE marked by the same ainsn. */
@ -5764,12 +5756,10 @@ NDFA_to_DFA (automaton_t automaton)
state_t start_state; state_t start_state;
state_t state; state_t state;
decl_t decl; decl_t decl;
vec<state_t> state_stack; auto_vec<state_t> state_stack;
int i; int i;
int states_n; int states_n;
state_stack.create (0);
/* Create the start state (empty state). */ /* Create the start state (empty state). */
start_state = automaton->start_state; start_state = automaton->start_state;
start_state->it_was_placed_in_stack_for_DFA_forming = 1; start_state->it_was_placed_in_stack_for_DFA_forming = 1;
@ -5810,7 +5800,6 @@ NDFA_to_DFA (automaton_t automaton)
add_arc (state, state, automaton->collapse_ainsn); add_arc (state, state, automaton->collapse_ainsn);
} }
} }
state_stack.release ();
} }
/* The following variable value is current number (1, 2, ...) of passing /* The following variable value is current number (1, 2, ...) of passing
@ -6258,13 +6247,11 @@ set_new_cycle_flags (state_t state)
static void static void
minimize_DFA (automaton_t automaton) minimize_DFA (automaton_t automaton)
{ {
vec<state_t> equiv_classes = vNULL; auto_vec<state_t> equiv_classes;
evaluate_equiv_classes (automaton, &equiv_classes); evaluate_equiv_classes (automaton, &equiv_classes);
merge_states (automaton, equiv_classes); merge_states (automaton, equiv_classes);
pass_states (automaton, set_new_cycle_flags); pass_states (automaton, set_new_cycle_flags);
equiv_classes.release ();
} }
/* Values of two variables are counted number of states and arcs in an /* Values of two variables are counted number of states and arcs in an

View File

@ -2051,8 +2051,7 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
{ {
int i; int i;
int nargs = gimple_call_num_args (stmt); int nargs = gimple_call_num_args (stmt);
vec<tree> vargs; auto_vec<tree> vargs (nargs);
vargs.create (nargs);
gimple new_stmt; gimple new_stmt;
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
@ -2064,7 +2063,7 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
vargs); vargs);
else else
new_stmt = gimple_build_call_vec (gimple_call_fn (stmt), vargs); new_stmt = gimple_build_call_vec (gimple_call_fn (stmt), vargs);
vargs.release ();
if (gimple_call_lhs (stmt)) if (gimple_call_lhs (stmt))
gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt)); gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));

View File

@ -4223,7 +4223,7 @@ undo_replacements_for_backtrack (struct haifa_saved_data *save)
static void static void
unschedule_insns_until (rtx insn) unschedule_insns_until (rtx insn)
{ {
vec<rtx> recompute_vec = vNULL; auto_vec<rtx> recompute_vec;
/* Make two passes over the insns to be unscheduled. First, we clear out /* Make two passes over the insns to be unscheduled. First, we clear out
dependencies and other trivial bookkeeping. */ dependencies and other trivial bookkeeping. */
@ -4281,7 +4281,6 @@ unschedule_insns_until (rtx insn)
else if (QUEUE_INDEX (con) != QUEUE_SCHEDULED) else if (QUEUE_INDEX (con) != QUEUE_SCHEDULED)
TODO_SPEC (con) = recompute_todo_spec (con, true); TODO_SPEC (con) = recompute_todo_spec (con, true);
} }
recompute_vec.release ();
} }
/* Restore scheduler state from the topmost entry on the backtracking queue. /* Restore scheduler state from the topmost entry on the backtracking queue.

View File

@ -1524,7 +1524,7 @@ inline_small_functions (void)
fibheap_t edge_heap = fibheap_new (); fibheap_t edge_heap = fibheap_new ();
bitmap updated_nodes = BITMAP_ALLOC (NULL); bitmap updated_nodes = BITMAP_ALLOC (NULL);
int min_size, max_size; int min_size, max_size;
vec<cgraph_edge_p> new_indirect_edges = vNULL; auto_vec<cgraph_edge_p> new_indirect_edges;
int initial_size = 0; int initial_size = 0;
struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
struct cgraph_edge_hook_list *edge_removal_hook_holder; struct cgraph_edge_hook_list *edge_removal_hook_holder;
@ -1815,7 +1815,6 @@ inline_small_functions (void)
} }
free_growth_caches (); free_growth_caches ();
new_indirect_edges.release ();
fibheap_delete (edge_heap); fibheap_delete (edge_heap);
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,

View File

@ -1711,7 +1711,7 @@ ira_loop_tree_body_rev_postorder (ira_loop_tree_node_t loop_node ATTRIBUTE_UNUSE
{ {
ira_loop_tree_node_t subloop_node; ira_loop_tree_node_t subloop_node;
unsigned int i; unsigned int i;
vec<ira_loop_tree_node_t> dfs_stack; auto_vec<ira_loop_tree_node_t> dfs_stack;
/* This is a bit of strange abuse of the BB_VISITED flag: We use /* This is a bit of strange abuse of the BB_VISITED flag: We use
the flag to mark blocks we still have to visit to add them to the flag to mark blocks we still have to visit to add them to
@ -1765,7 +1765,6 @@ ira_loop_tree_body_rev_postorder (ira_loop_tree_node_t loop_node ATTRIBUTE_UNUSE
} }
#undef BB_TO_VISIT #undef BB_TO_VISIT
dfs_stack.release ();
} }
gcc_assert (topsort_nodes.length () == n_loop_preorder); gcc_assert (topsort_nodes.length () == n_loop_preorder);
@ -1807,8 +1806,7 @@ ira_traverse_loop_tree (bool bb_p, ira_loop_tree_node_t loop_node,
if (bb_p) if (bb_p)
{ {
vec<ira_loop_tree_node_t> auto_vec<ira_loop_tree_node_t> loop_preorder;
loop_preorder = vNULL;
unsigned int i; unsigned int i;
/* Add all nodes to the set of nodes to visit. The IRA loop tree /* Add all nodes to the set of nodes to visit. The IRA loop tree
@ -1832,8 +1830,6 @@ ira_traverse_loop_tree (bool bb_p, ira_loop_tree_node_t loop_node,
(*postorder_func) (subloop_node); (*postorder_func) (subloop_node);
loop_rev_postorder.release (); loop_rev_postorder.release ();
} }
loop_preorder.release ();
} }
for (subloop_node = loop_node->subloops; for (subloop_node = loop_node->subloops;

View File

@ -578,7 +578,6 @@ peel_loop_completely (struct loop *loop)
sbitmap wont_exit; sbitmap wont_exit;
unsigned HOST_WIDE_INT npeel; unsigned HOST_WIDE_INT npeel;
unsigned i; unsigned i;
vec<edge> remove_edges;
edge ein; edge ein;
struct niter_desc *desc = get_simple_loop_desc (loop); struct niter_desc *desc = get_simple_loop_desc (loop);
struct opt_info *opt_info = NULL; struct opt_info *opt_info = NULL;
@ -595,8 +594,7 @@ peel_loop_completely (struct loop *loop)
if (desc->noloop_assumptions) if (desc->noloop_assumptions)
bitmap_clear_bit (wont_exit, 1); bitmap_clear_bit (wont_exit, 1);
remove_edges.create (0); auto_vec<edge> remove_edges;
if (flag_split_ivs_in_unroller) if (flag_split_ivs_in_unroller)
opt_info = analyze_insns_in_loop (loop); opt_info = analyze_insns_in_loop (loop);
@ -622,7 +620,6 @@ peel_loop_completely (struct loop *loop)
/* Remove the exit edges. */ /* Remove the exit edges. */
FOR_EACH_VEC_ELT (remove_edges, i, ein) FOR_EACH_VEC_ELT (remove_edges, i, ein)
remove_path (ein); remove_path (ein);
remove_edges.release ();
} }
ein = desc->in_edge; ein = desc->in_edge;
@ -760,7 +757,6 @@ unroll_loop_constant_iterations (struct loop *loop)
unsigned exit_mod; unsigned exit_mod;
sbitmap wont_exit; sbitmap wont_exit;
unsigned i; unsigned i;
vec<edge> remove_edges;
edge e; edge e;
unsigned max_unroll = loop->lpt_decision.times; unsigned max_unroll = loop->lpt_decision.times;
struct niter_desc *desc = get_simple_loop_desc (loop); struct niter_desc *desc = get_simple_loop_desc (loop);
@ -778,7 +774,7 @@ unroll_loop_constant_iterations (struct loop *loop)
wont_exit = sbitmap_alloc (max_unroll + 1); wont_exit = sbitmap_alloc (max_unroll + 1);
bitmap_ones (wont_exit); bitmap_ones (wont_exit);
remove_edges.create (0); auto_vec<edge> remove_edges;
if (flag_split_ivs_in_unroller if (flag_split_ivs_in_unroller
|| flag_variable_expansion_in_unroller) || flag_variable_expansion_in_unroller)
opt_info = analyze_insns_in_loop (loop); opt_info = analyze_insns_in_loop (loop);
@ -928,7 +924,6 @@ unroll_loop_constant_iterations (struct loop *loop)
/* Remove the edges. */ /* Remove the edges. */
FOR_EACH_VEC_ELT (remove_edges, i, e) FOR_EACH_VEC_ELT (remove_edges, i, e)
remove_path (e); remove_path (e);
remove_edges.release ();
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
@ -1099,11 +1094,9 @@ unroll_loop_runtime_iterations (struct loop *loop)
rtx old_niter, niter, init_code, branch_code, tmp; rtx old_niter, niter, init_code, branch_code, tmp;
unsigned i, j, p; unsigned i, j, p;
basic_block preheader, *body, swtch, ezc_swtch; basic_block preheader, *body, swtch, ezc_swtch;
vec<basic_block> dom_bbs;
sbitmap wont_exit; sbitmap wont_exit;
int may_exit_copy; int may_exit_copy;
unsigned n_peel; unsigned n_peel;
vec<edge> remove_edges;
edge e; edge e;
bool extra_zero_check, last_may_exit; bool extra_zero_check, last_may_exit;
unsigned max_unroll = loop->lpt_decision.times; unsigned max_unroll = loop->lpt_decision.times;
@ -1117,7 +1110,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
opt_info = analyze_insns_in_loop (loop); opt_info = analyze_insns_in_loop (loop);
/* Remember blocks whose dominators will have to be updated. */ /* Remember blocks whose dominators will have to be updated. */
dom_bbs.create (0); auto_vec<basic_block> dom_bbs;
body = get_loop_body (loop); body = get_loop_body (loop);
for (i = 0; i < loop->num_nodes; i++) for (i = 0; i < loop->num_nodes; i++)
@ -1174,7 +1167,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
/* Precondition the loop. */ /* Precondition the loop. */
split_edge_and_insert (loop_preheader_edge (loop), init_code); split_edge_and_insert (loop_preheader_edge (loop), init_code);
remove_edges.create (0); auto_vec<edge> remove_edges;
wont_exit = sbitmap_alloc (max_unroll + 2); wont_exit = sbitmap_alloc (max_unroll + 2);
@ -1298,7 +1291,6 @@ unroll_loop_runtime_iterations (struct loop *loop)
/* Remove the edges. */ /* Remove the edges. */
FOR_EACH_VEC_ELT (remove_edges, i, e) FOR_EACH_VEC_ELT (remove_edges, i, e)
remove_path (e); remove_path (e);
remove_edges.release ();
/* We must be careful when updating the number of iterations due to /* We must be careful when updating the number of iterations due to
preconditioning and the fact that the value must be valid at entry preconditioning and the fact that the value must be valid at entry
@ -1335,8 +1327,6 @@ unroll_loop_runtime_iterations (struct loop *loop)
";; Unrolled loop %d times, counting # of iterations " ";; Unrolled loop %d times, counting # of iterations "
"in runtime, %i insns\n", "in runtime, %i insns\n",
max_unroll, num_loop_insns (loop)); max_unroll, num_loop_insns (loop));
dom_bbs.release ();
} }
/* Decide whether to simply peel LOOP and how much. */ /* Decide whether to simply peel LOOP and how much. */

View File

@ -6901,7 +6901,6 @@ static void
expand_omp_sections (struct omp_region *region) expand_omp_sections (struct omp_region *region)
{ {
tree t, u, vin = NULL, vmain, vnext, l2; tree t, u, vin = NULL, vmain, vnext, l2;
vec<tree> label_vec;
unsigned len; unsigned len;
basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb; basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
gimple_stmt_iterator si, switch_si; gimple_stmt_iterator si, switch_si;
@ -6954,7 +6953,7 @@ expand_omp_sections (struct omp_region *region)
/* Use vec::quick_push on label_vec throughout, since we know the size /* Use vec::quick_push on label_vec throughout, since we know the size
in advance. */ in advance. */
label_vec.create (len); auto_vec<tree> label_vec (len);
/* The call to GOMP_sections_start goes in ENTRY_BB, replacing the /* The call to GOMP_sections_start goes in ENTRY_BB, replacing the
GIMPLE_OMP_SECTIONS statement. */ GIMPLE_OMP_SECTIONS statement. */
@ -7050,7 +7049,6 @@ expand_omp_sections (struct omp_region *region)
stmt = gimple_build_switch (vmain, u, label_vec); stmt = gimple_build_switch (vmain, u, label_vec);
gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT); gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT);
gsi_remove (&switch_si, true); gsi_remove (&switch_si, true);
label_vec.release ();
si = gsi_start_bb (default_bb); si = gsi_start_bb (default_bb);
stmt = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0); stmt = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);

View File

@ -862,7 +862,7 @@ find_and_remove_re (void)
rtx curr_insn = NULL_RTX; rtx curr_insn = NULL_RTX;
int num_re_opportunities = 0, num_realized = 0, i; int num_re_opportunities = 0, num_realized = 0, i;
vec<ext_cand> reinsn_list; vec<ext_cand> reinsn_list;
vec<rtx> reinsn_del_list; auto_vec<rtx> reinsn_del_list;
ext_state state; ext_state state;
/* Construct DU chain to get all reaching definitions of each /* Construct DU chain to get all reaching definitions of each
@ -873,7 +873,6 @@ find_and_remove_re (void)
df_set_flags (DF_DEFER_INSN_RESCAN); df_set_flags (DF_DEFER_INSN_RESCAN);
max_insn_uid = get_max_uid (); max_insn_uid = get_max_uid ();
reinsn_del_list.create (0);
reinsn_list = find_removable_extensions (); reinsn_list = find_removable_extensions ();
state.defs_list.create (0); state.defs_list.create (0);
state.copies_list.create (0); state.copies_list.create (0);
@ -910,7 +909,6 @@ find_and_remove_re (void)
delete_insn (curr_insn); delete_insn (curr_insn);
reinsn_list.release (); reinsn_list.release ();
reinsn_del_list.release ();
state.defs_list.release (); state.defs_list.release ();
state.copies_list.release (); state.copies_list.release ();
state.modified_list.release (); state.modified_list.release ();

View File

@ -1944,10 +1944,10 @@ tm_region_init (struct tm_region *region)
edge_iterator ei; edge_iterator ei;
edge e; edge e;
basic_block bb; basic_block bb;
vec<basic_block> queue = vNULL; auto_vec<basic_block> queue;
bitmap visited_blocks = BITMAP_ALLOC (NULL); bitmap visited_blocks = BITMAP_ALLOC (NULL);
struct tm_region *old_region; struct tm_region *old_region;
vec<tm_region_p> bb_regions = vNULL; auto_vec<tm_region_p> bb_regions;
all_tm_regions = region; all_tm_regions = region;
bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)); bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
@ -1991,9 +1991,7 @@ tm_region_init (struct tm_region *region)
} }
} }
while (!queue.is_empty ()); while (!queue.is_empty ());
queue.release ();
BITMAP_FREE (visited_blocks); BITMAP_FREE (visited_blocks);
bb_regions.release ();
} }
/* The "gate" function for all transactional memory expansion and optimization /* The "gate" function for all transactional memory expansion and optimization
@ -4521,7 +4519,6 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone)
{ {
struct tm_ipa_cg_data *d; struct tm_ipa_cg_data *d;
bitmap new_irr, old_irr; bitmap new_irr, old_irr;
vec<basic_block> queue;
bool ret = false; bool ret = false;
/* Builtin operators (operator new, and such). */ /* Builtin operators (operator new, and such). */
@ -4533,7 +4530,7 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone)
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
d = get_cg_data (&node, true); d = get_cg_data (&node, true);
queue.create (10); stack_vec<basic_block, 10> queue;
new_irr = BITMAP_ALLOC (&tm_obstack); new_irr = BITMAP_ALLOC (&tm_obstack);
/* Scan each tm region, propagating irrevocable status through the tree. */ /* Scan each tm region, propagating irrevocable status through the tree. */
@ -4600,7 +4597,6 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone)
else else
BITMAP_FREE (new_irr); BITMAP_FREE (new_irr);
queue.release ();
pop_cfun (); pop_cfun ();
return ret; return ret;
@ -5207,7 +5203,7 @@ ipa_tm_transform_calls (struct cgraph_node *node, struct tm_region *region,
bool need_ssa_rename = false; bool need_ssa_rename = false;
edge e; edge e;
edge_iterator ei; edge_iterator ei;
vec<basic_block> queue = vNULL; auto_vec<basic_block> queue;
bitmap visited_blocks = BITMAP_ALLOC (NULL); bitmap visited_blocks = BITMAP_ALLOC (NULL);
queue.safe_push (bb); queue.safe_push (bb);
@ -5233,7 +5229,6 @@ ipa_tm_transform_calls (struct cgraph_node *node, struct tm_region *region,
} }
while (!queue.is_empty ()); while (!queue.is_empty ());
queue.release ();
BITMAP_FREE (visited_blocks); BITMAP_FREE (visited_blocks);
return need_ssa_rename; return need_ssa_rename;

View File

@ -871,7 +871,7 @@ tree_call_cdce (void)
basic_block bb; basic_block bb;
gimple_stmt_iterator i; gimple_stmt_iterator i;
bool something_changed = false; bool something_changed = false;
vec<gimple> cond_dead_built_in_calls = vNULL; auto_vec<gimple> cond_dead_built_in_calls;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
/* Collect dead call candidates. */ /* Collect dead call candidates. */
@ -900,8 +900,6 @@ tree_call_cdce (void)
something_changed something_changed
= shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls); = shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls);
cond_dead_built_in_calls.release ();
if (something_changed) if (something_changed)
{ {
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);

View File

@ -3569,7 +3569,7 @@ lower_eh_dispatch (basic_block src, gimple stmt)
{ {
case ERT_TRY: case ERT_TRY:
{ {
vec<tree> labels = vNULL; auto_vec<tree> labels;
tree default_label = NULL; tree default_label = NULL;
eh_catch c; eh_catch c;
edge_iterator ei; edge_iterator ei;
@ -3657,8 +3657,6 @@ lower_eh_dispatch (basic_block src, gimple stmt)
x = gimple_build_switch (filter, default_label, labels); x = gimple_build_switch (filter, default_label, labels);
gsi_insert_before (&gsi, x, GSI_SAME_STMT); gsi_insert_before (&gsi, x, GSI_SAME_STMT);
labels.release ();
} }
pointer_set_destroy (seen_values); pointer_set_destroy (seen_values);
} }

View File

@ -1215,7 +1215,6 @@ if_convertible_loop_p (struct loop *loop)
free (dr->aux); free (dr->aux);
} }
loop_nest.release ();
free_data_refs (refs); free_data_refs (refs);
free_dependence_relations (ddrs); free_dependence_relations (ddrs);
return res; return res;

View File

@ -764,7 +764,6 @@ find_dfsnum_interval (struct dom_dfsnum *defs, unsigned n, unsigned s)
static void static void
prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses) prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
{ {
vec<int> worklist;
bitmap_iterator bi; bitmap_iterator bi;
unsigned i, b, p, u, top; unsigned i, b, p, u, top;
bitmap live_phis; bitmap live_phis;
@ -836,7 +835,7 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
dfs_out numbers, increase the dfs number by one (so that it corresponds dfs_out numbers, increase the dfs number by one (so that it corresponds
to the start of the following interval, not to the end of the current to the start of the following interval, not to the end of the current
one). We use WORKLIST as a stack. */ one). We use WORKLIST as a stack. */
worklist.create (n_defs + 1); auto_vec<int> worklist (n_defs + 1);
worklist.quick_push (1); worklist.quick_push (1);
top = 1; top = 1;
n_defs = 1; n_defs = 1;
@ -923,7 +922,6 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
} }
} }
worklist.release ();
bitmap_copy (phis, live_phis); bitmap_copy (phis, live_phis);
BITMAP_FREE (live_phis); BITMAP_FREE (live_phis);
free (defs); free (defs);
@ -1084,11 +1082,10 @@ insert_phi_nodes (bitmap_head *dfs)
hash_table <var_info_hasher>::iterator hi; hash_table <var_info_hasher>::iterator hi;
unsigned i; unsigned i;
var_info_p info; var_info_p info;
vec<var_info_p> vars;
timevar_push (TV_TREE_INSERT_PHI_NODES); timevar_push (TV_TREE_INSERT_PHI_NODES);
vars.create (var_infos.elements ()); auto_vec<var_info_p> vars (var_infos.elements ());
FOR_EACH_HASH_TABLE_ELEMENT (var_infos, info, var_info_p, hi) FOR_EACH_HASH_TABLE_ELEMENT (var_infos, info, var_info_p, hi)
if (info->info.need_phi_state != NEED_PHI_STATE_NO) if (info->info.need_phi_state != NEED_PHI_STATE_NO)
vars.quick_push (info); vars.quick_push (info);
@ -1104,8 +1101,6 @@ insert_phi_nodes (bitmap_head *dfs)
BITMAP_FREE (idf); BITMAP_FREE (idf);
} }
vars.release ();
timevar_pop (TV_TREE_INSERT_PHI_NODES); timevar_pop (TV_TREE_INSERT_PHI_NODES);
} }

View File

@ -1406,7 +1406,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
control_dependences *cd, int *nb_calls) control_dependences *cd, int *nb_calls)
{ {
struct graph *rdg; struct graph *rdg;
vec<partition_t> partitions;
partition_t partition; partition_t partition;
bool any_builtin; bool any_builtin;
int i, nbp; int i, nbp;
@ -1432,7 +1431,7 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
dump_rdg (dump_file, rdg); dump_rdg (dump_file, rdg);
partitions.create (3); stack_vec<partition_t, 3> partitions;
rdg_build_partitions (rdg, stmts, &partitions); rdg_build_partitions (rdg, stmts, &partitions);
any_builtin = false; any_builtin = false;
@ -1658,7 +1657,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
FOR_EACH_VEC_ELT (partitions, i, partition) FOR_EACH_VEC_ELT (partitions, i, partition)
partition_free (partition); partition_free (partition);
partitions.release ();
free_rdg (rdg); free_rdg (rdg);
return nbp - *nb_calls; return nbp - *nb_calls;
@ -1687,7 +1685,7 @@ tree_loop_distribution (void)
walking to innermost loops. */ walking to innermost loops. */
FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
{ {
vec<gimple> work_list = vNULL; auto_vec<gimple> work_list;
basic_block *bbs; basic_block *bbs;
int num = loop->num; int num = loop->num;
unsigned int i; unsigned int i;
@ -1769,8 +1767,6 @@ out:
} }
else if (dump_file && (dump_flags & TDF_DETAILS)) else if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Loop %d is the same.\n", num); fprintf (dump_file, "Loop %d is the same.\n", num);
work_list.release ();
} }
if (cd) if (cd)

View File

@ -1538,7 +1538,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
static void static void
execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars) execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
{ {
vec<tree> vars; auto_vec<tree> vars;
dref a; dref a;
unsigned n_writes = 0, ridx, i; unsigned n_writes = 0, ridx, i;
tree var; tree var;
@ -1577,8 +1577,6 @@ execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
replace_ref_with (a->stmt, vars[ridx], replace_ref_with (a->stmt, vars[ridx],
!is_read, !is_read); !is_read, !is_read);
} }
vars.release ();
} }
/* Returns the single statement in that NAME is used, excepting /* Returns the single statement in that NAME is used, excepting
@ -2272,7 +2270,7 @@ try_combine_chains (vec<chain_p> *chains)
{ {
unsigned i, j; unsigned i, j;
chain_p ch1, ch2, cch; chain_p ch1, ch2, cch;
vec<chain_p> worklist = vNULL; auto_vec<chain_p> worklist;
FOR_EACH_VEC_ELT (*chains, i, ch1) FOR_EACH_VEC_ELT (*chains, i, ch1)
if (chain_can_be_combined_p (ch1)) if (chain_can_be_combined_p (ch1))
@ -2298,8 +2296,6 @@ try_combine_chains (vec<chain_p> *chains)
} }
} }
} }
worklist.release ();
} }
/* Prepare initializers for CHAIN in LOOP. Returns false if this is /* Prepare initializers for CHAIN in LOOP. Returns false if this is

View File

@ -3784,10 +3784,9 @@ analyze_modified_params (vec<access_p> representatives)
static void static void
propagate_dereference_distances (void) propagate_dereference_distances (void)
{ {
vec<basic_block> queue;
basic_block bb; basic_block bb;
queue.create (last_basic_block_for_function (cfun)); auto_vec<basic_block> queue (last_basic_block_for_function (cfun));
queue.quick_push (ENTRY_BLOCK_PTR_FOR_FN (cfun)); queue.quick_push (ENTRY_BLOCK_PTR_FOR_FN (cfun));
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
@ -3847,8 +3846,6 @@ propagate_dereference_distances (void)
queue.quick_push (e->src); queue.quick_push (e->src);
} }
} }
queue.release ();
} }
/* Dump a dereferences TABLE with heading STR to file F. */ /* Dump a dereferences TABLE with heading STR to file F. */

View File

@ -1281,8 +1281,7 @@ static void
simplify_gimple_switch_label_vec (gimple stmt, tree index_type) simplify_gimple_switch_label_vec (gimple stmt, tree index_type)
{ {
unsigned int branch_num = gimple_switch_num_labels (stmt); unsigned int branch_num = gimple_switch_num_labels (stmt);
vec<tree> labels; auto_vec<tree> labels (branch_num);
labels.create (branch_num);
unsigned int i, len; unsigned int i, len;
/* Collect the existing case labels in a VEC, and preprocess it as if /* Collect the existing case labels in a VEC, and preprocess it as if
@ -1343,8 +1342,6 @@ simplify_gimple_switch_label_vec (gimple stmt, tree index_type)
} }
BITMAP_FREE (target_blocks); BITMAP_FREE (target_blocks);
} }
labels.release ();
} }
/* STMT is a SWITCH_EXPR for which we attempt to find equivalent forms of /* STMT is a SWITCH_EXPR for which we attempt to find equivalent forms of

View File

@ -187,7 +187,6 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
{ {
unsigned i; unsigned i;
bitmap_iterator bi; bitmap_iterator bi;
vec<basic_block> worklist;
struct loop *def_loop = def_bb->loop_father; struct loop *def_loop = def_bb->loop_father;
unsigned def_loop_depth = loop_depth (def_loop); unsigned def_loop_depth = loop_depth (def_loop);
bitmap def_loop_exits; bitmap def_loop_exits;
@ -195,7 +194,7 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
/* Normally the work list size is bounded by the number of basic /* Normally the work list size is bounded by the number of basic
blocks in the largest loop. We don't know this number, but we blocks in the largest loop. We don't know this number, but we
can be fairly sure that it will be relatively small. */ can be fairly sure that it will be relatively small. */
worklist.create (MAX (8, n_basic_blocks_for_fn (cfun) / 128)); auto_vec<basic_block> worklist (MAX (8, n_basic_blocks_for_fn (cfun) / 128));
EXECUTE_IF_SET_IN_BITMAP (use_blocks, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (use_blocks, 0, i, bi)
{ {
@ -258,7 +257,6 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
worklist.quick_push (pred); worklist.quick_push (pred);
} }
} }
worklist.release ();
def_loop_exits = BITMAP_ALLOC (&loop_renamer_obstack); def_loop_exits = BITMAP_ALLOC (&loop_renamer_obstack);
for (struct loop *loop = def_loop; for (struct loop *loop = def_loop;
@ -1046,7 +1044,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
unsigned new_est_niter, i, prob; unsigned new_est_niter, i, prob;
unsigned irr = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP; unsigned irr = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
sbitmap wont_exit; sbitmap wont_exit;
vec<edge> to_remove = vNULL; auto_vec<edge> to_remove;
est_niter = expected_loop_iterations (loop); est_niter = expected_loop_iterations (loop);
determine_exit_conditions (loop, desc, factor, determine_exit_conditions (loop, desc, factor,
@ -1194,7 +1192,6 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
ok = remove_path (e); ok = remove_path (e);
gcc_assert (ok); gcc_assert (ok);
} }
to_remove.release ();
update_ssa (TODO_update_ssa); update_ssa (TODO_update_ssa);
/* Ensure that the frequencies in the loop match the new estimated /* Ensure that the frequencies in the loop match the new estimated

View File

@ -2182,11 +2182,10 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
phis to translate through. */ phis to translate through. */
else else
{ {
vec<basic_block> worklist;
size_t i; size_t i;
basic_block bprime, first = NULL; basic_block bprime, first = NULL;
worklist.create (EDGE_COUNT (block->succs)); auto_vec<basic_block> worklist (EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs) FOR_EACH_EDGE (e, ei, block->succs)
{ {
if (!first if (!first
@ -2224,7 +2223,6 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
else else
bitmap_set_and (ANTIC_OUT, ANTIC_IN (bprime)); bitmap_set_and (ANTIC_OUT, ANTIC_IN (bprime));
} }
worklist.release ();
} }
/* Prune expressions that are clobbered in block and thus become /* Prune expressions that are clobbered in block and thus become
@ -2346,11 +2344,10 @@ compute_partial_antic_aux (basic_block block,
them. */ them. */
else else
{ {
vec<basic_block> worklist;
size_t i; size_t i;
basic_block bprime; basic_block bprime;
worklist.create (EDGE_COUNT (block->succs)); auto_vec<basic_block> worklist (EDGE_COUNT (block->succs));
FOR_EACH_EDGE (e, ei, block->succs) FOR_EACH_EDGE (e, ei, block->succs)
{ {
if (e->flags & EDGE_DFS_BACK) if (e->flags & EDGE_DFS_BACK)
@ -2382,7 +2379,6 @@ compute_partial_antic_aux (basic_block block,
expression_for_id (i)); expression_for_id (i));
} }
} }
worklist.release ();
} }
/* Prune expressions that are clobbered in block and thus become /* Prune expressions that are clobbered in block and thus become
@ -3462,7 +3458,6 @@ do_regular_insertion (basic_block block, basic_block dom)
} }
exprs.release (); exprs.release ();
avail.release ();
return new_stuff; return new_stuff;
} }
@ -3480,7 +3475,7 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
bool new_stuff = false; bool new_stuff = false;
vec<pre_expr> exprs; vec<pre_expr> exprs;
pre_expr expr; pre_expr expr;
vec<pre_expr> avail = vNULL; auto_vec<pre_expr> avail;
int i; int i;
exprs = sorted_array_from_bitmap_set (PA_IN (block)); exprs = sorted_array_from_bitmap_set (PA_IN (block));
@ -3601,7 +3596,6 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
} }
exprs.release (); exprs.release ();
avail.release ();
return new_stuff; return new_stuff;
} }
@ -3826,7 +3820,7 @@ compute_avail (void)
{ {
vn_reference_t ref; vn_reference_t ref;
pre_expr result = NULL; pre_expr result = NULL;
vec<vn_reference_op_s> ops = vNULL; auto_vec<vn_reference_op_s> ops;
/* We can value number only calls to real functions. */ /* We can value number only calls to real functions. */
if (gimple_call_internal_p (stmt)) if (gimple_call_internal_p (stmt))
@ -3836,7 +3830,6 @@ compute_avail (void)
vn_reference_lookup_pieces (gimple_vuse (stmt), 0, vn_reference_lookup_pieces (gimple_vuse (stmt), 0,
gimple_expr_type (stmt), gimple_expr_type (stmt),
ops, &ref, VN_NOWALK); ops, &ref, VN_NOWALK);
ops.release ();
if (!ref) if (!ref)
continue; continue;

View File

@ -2660,8 +2660,8 @@ maybe_optimize_range_tests (gimple stmt)
basic_block bb; basic_block bb;
edge_iterator ei; edge_iterator ei;
edge e; edge e;
vec<operand_entry_t> ops = vNULL; auto_vec<operand_entry_t> ops;
vec<inter_bb_range_test_entry> bbinfo = vNULL; auto_vec<inter_bb_range_test_entry> bbinfo;
bool any_changes = false; bool any_changes = false;
/* Consider only basic blocks that end with GIMPLE_COND or /* Consider only basic blocks that end with GIMPLE_COND or
@ -2975,8 +2975,6 @@ maybe_optimize_range_tests (gimple stmt)
break; break;
} }
} }
bbinfo.release ();
ops.release ();
} }
/* Return true if OPERAND is defined by a PHI node which uses the LHS /* Return true if OPERAND is defined by a PHI node which uses the LHS
@ -4401,7 +4399,7 @@ reassociate_bb (basic_block bb)
if (associative_tree_code (rhs_code)) if (associative_tree_code (rhs_code))
{ {
vec<operand_entry_t> ops = vNULL; auto_vec<operand_entry_t> ops;
tree powi_result = NULL_TREE; tree powi_result = NULL_TREE;
/* There may be no immediate uses left by the time we /* There may be no immediate uses left by the time we
@ -4489,8 +4487,6 @@ reassociate_bb (basic_block bb)
gsi_insert_after (&gsi, mul_stmt, GSI_NEW_STMT); gsi_insert_after (&gsi, mul_stmt, GSI_NEW_STMT);
} }
} }
ops.release ();
} }
} }
} }

View File

@ -1751,8 +1751,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
tree base2; tree base2;
HOST_WIDE_INT offset2, size2, maxsize2; HOST_WIDE_INT offset2, size2, maxsize2;
int i, j; int i, j;
vec<vn_reference_op_s> auto_vec<vn_reference_op_s> rhs;
rhs = vNULL;
vn_reference_op_t vro; vn_reference_op_t vro;
ao_ref r; ao_ref r;
@ -1815,7 +1814,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
vr->operands.truncate (i + 1 + rhs.length ()); vr->operands.truncate (i + 1 + rhs.length ());
FOR_EACH_VEC_ELT (rhs, j, vro) FOR_EACH_VEC_ELT (rhs, j, vro)
vr->operands[i + 1 + j] = *vro; vr->operands[i + 1 + j] = *vro;
rhs.release ();
vr->operands = valueize_refs (vr->operands); vr->operands = valueize_refs (vr->operands);
vr->hashcode = vn_reference_compute_hash (vr); vr->hashcode = vn_reference_compute_hash (vr);
@ -3787,7 +3785,7 @@ process_scc (vec<tree> scc)
static bool static bool
extract_and_process_scc_for_name (tree name) extract_and_process_scc_for_name (tree name)
{ {
vec<tree> scc = vNULL; auto_vec<tree> scc;
tree x; tree x;
/* Found an SCC, pop the components off the SCC stack and /* Found an SCC, pop the components off the SCC stack and
@ -3809,7 +3807,6 @@ extract_and_process_scc_for_name (tree name)
"SCC size %u exceeding %u\n", scc.length (), "SCC size %u exceeding %u\n", scc.length (),
(unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)); (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE));
scc.release ();
return false; return false;
} }
@ -3821,8 +3818,6 @@ extract_and_process_scc_for_name (tree name)
process_scc (scc); process_scc (scc);
scc.release ();
return true; return true;
} }

View File

@ -2573,7 +2573,7 @@ eliminate_indirect_cycles (unsigned int node)
&& !bitmap_empty_p (get_varinfo (node)->solution)) && !bitmap_empty_p (get_varinfo (node)->solution))
{ {
unsigned int i; unsigned int i;
vec<unsigned> queue = vNULL; auto_vec<unsigned> queue;
int queuepos; int queuepos;
unsigned int to = find (graph->indirect_cycles[node]); unsigned int to = find (graph->indirect_cycles[node]);
bitmap_iterator bi; bitmap_iterator bi;
@ -2597,7 +2597,6 @@ eliminate_indirect_cycles (unsigned int node)
{ {
unify_nodes (graph, to, i, true); unify_nodes (graph, to, i, true);
} }
queue.release ();
return true; return true;
} }
return false; return false;
@ -3477,7 +3476,7 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
{ {
unsigned int i; unsigned int i;
tree val; tree val;
vec<ce_s> tmp = vNULL; auto_vec<ce_s> tmp;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val) FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
{ {
struct constraint_expr *rhsp; struct constraint_expr *rhsp;
@ -3487,7 +3486,6 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
results->safe_push (*rhsp); results->safe_push (*rhsp);
tmp.truncate (0); tmp.truncate (0);
} }
tmp.release ();
/* We do not know whether the constructor was complete, /* We do not know whether the constructor was complete,
so technically we have to add &NOTHING or &ANYTHING so technically we have to add &NOTHING or &ANYTHING
like we do for an empty constructor as well. */ like we do for an empty constructor as well. */
@ -3577,8 +3575,8 @@ static void
do_structure_copy (tree lhsop, tree rhsop) do_structure_copy (tree lhsop, tree rhsop)
{ {
struct constraint_expr *lhsp, *rhsp; struct constraint_expr *lhsp, *rhsp;
vec<ce_s> lhsc = vNULL; auto_vec<ce_s> lhsc;
vec<ce_s> rhsc = vNULL; auto_vec<ce_s> rhsc;
unsigned j; unsigned j;
get_constraint_for (lhsop, &lhsc); get_constraint_for (lhsop, &lhsc);
@ -3637,9 +3635,6 @@ do_structure_copy (tree lhsop, tree rhsop)
} }
else else
gcc_unreachable (); gcc_unreachable ();
lhsc.release ();
rhsc.release ();
} }
/* Create constraints ID = { rhsc }. */ /* Create constraints ID = { rhsc }. */
@ -3664,10 +3659,9 @@ make_constraints_to (unsigned id, vec<ce_s> rhsc)
static void static void
make_constraint_to (unsigned id, tree op) make_constraint_to (unsigned id, tree op)
{ {
vec<ce_s> rhsc = vNULL; auto_vec<ce_s> rhsc;
get_constraint_for_rhs (op, &rhsc); get_constraint_for_rhs (op, &rhsc);
make_constraints_to (id, rhsc); make_constraints_to (id, rhsc);
rhsc.release ();
} }
/* Create a constraint ID = &FROM. */ /* Create a constraint ID = &FROM. */
@ -3938,7 +3932,7 @@ handle_rhs_call (gimple stmt, vec<ce_s> *results)
&& gimple_call_lhs (stmt) != NULL_TREE && gimple_call_lhs (stmt) != NULL_TREE
&& TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt)))) && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
{ {
vec<ce_s> tmpc = vNULL; auto_vec<ce_s> tmpc;
struct constraint_expr lhsc, *c; struct constraint_expr lhsc, *c;
get_constraint_for_address_of (gimple_call_lhs (stmt), &tmpc); get_constraint_for_address_of (gimple_call_lhs (stmt), &tmpc);
lhsc.var = escaped_id; lhsc.var = escaped_id;
@ -3946,7 +3940,6 @@ handle_rhs_call (gimple stmt, vec<ce_s> *results)
lhsc.type = SCALAR; lhsc.type = SCALAR;
FOR_EACH_VEC_ELT (tmpc, i, c) FOR_EACH_VEC_ELT (tmpc, i, c)
process_constraint (new_constraint (lhsc, *c)); process_constraint (new_constraint (lhsc, *c));
tmpc.release ();
} }
/* Regular functions return nonlocal memory. */ /* Regular functions return nonlocal memory. */
@ -3964,7 +3957,7 @@ static void
handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc, handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc,
tree fndecl) tree fndecl)
{ {
vec<ce_s> lhsc = vNULL; auto_vec<ce_s> lhsc;
get_constraint_for (lhs, &lhsc); get_constraint_for (lhs, &lhsc);
/* If the store is to a global decl make sure to /* If the store is to a global decl make sure to
@ -4019,8 +4012,6 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc,
} }
else else
process_all_all_constraints (lhsc, rhsc); process_all_all_constraints (lhsc, rhsc);
lhsc.release ();
} }
/* For non-IPA mode, generate constraints necessary for a call of a /* For non-IPA mode, generate constraints necessary for a call of a
@ -4049,13 +4040,12 @@ handle_const_call (gimple stmt, vec<ce_s> *results)
for (k = 0; k < gimple_call_num_args (stmt); ++k) for (k = 0; k < gimple_call_num_args (stmt); ++k)
{ {
tree arg = gimple_call_arg (stmt, k); tree arg = gimple_call_arg (stmt, k);
vec<ce_s> argc = vNULL; auto_vec<ce_s> argc;
unsigned i; unsigned i;
struct constraint_expr *argp; struct constraint_expr *argp;
get_constraint_for_rhs (arg, &argc); get_constraint_for_rhs (arg, &argc);
FOR_EACH_VEC_ELT (argc, i, argp) FOR_EACH_VEC_ELT (argc, i, argp)
results->safe_push (*argp); results->safe_push (*argp);
argc.release ();
} }
/* May return addresses of globals. */ /* May return addresses of globals. */
@ -4854,7 +4844,7 @@ find_func_clobbers (gimple origt)
{ {
gimple t = origt; gimple t = origt;
vec<ce_s> lhsc = vNULL; vec<ce_s> lhsc = vNULL;
vec<ce_s> rhsc = vNULL; auto_vec<ce_s> rhsc;
varinfo_t fi; varinfo_t fi;
/* Add constraints for clobbered/used in IPA mode. /* Add constraints for clobbered/used in IPA mode.
@ -5119,8 +5109,6 @@ find_func_clobbers (gimple origt)
make_constraint_from (first_vi_for_offset (fi, fi_uses), make_constraint_from (first_vi_for_offset (fi, fi_uses),
anything_id); anything_id);
} }
rhsc.release ();
} }
@ -5623,7 +5611,7 @@ create_variable_info_for_1 (tree decl, const char *name)
varinfo_t vi, newvi; varinfo_t vi, newvi;
tree decl_type = TREE_TYPE (decl); tree decl_type = TREE_TYPE (decl);
tree declsize = DECL_P (decl) ? DECL_SIZE (decl) : TYPE_SIZE (decl_type); tree declsize = DECL_P (decl) ? DECL_SIZE (decl) : TYPE_SIZE (decl_type);
vec<fieldoff_s> fieldstack = vNULL; auto_vec<fieldoff_s> fieldstack;
fieldoff_s *fo; fieldoff_s *fo;
unsigned int i; unsigned int i;
@ -5726,8 +5714,6 @@ create_variable_info_for_1 (tree decl, const char *name)
} }
} }
fieldstack.release ();
return vi; return vi;
} }
@ -5778,7 +5764,7 @@ create_variable_info_for (tree decl, const char *name)
if (DECL_INITIAL (decl) if (DECL_INITIAL (decl)
&& vnode->definition) && vnode->definition)
{ {
vec<ce_s> rhsc = vNULL; auto_vec<ce_s> rhsc;
struct constraint_expr lhs, *rhsp; struct constraint_expr lhs, *rhsp;
unsigned i; unsigned i;
get_constraint_for_rhs (DECL_INITIAL (decl), &rhsc); get_constraint_for_rhs (DECL_INITIAL (decl), &rhsc);
@ -5797,7 +5783,6 @@ create_variable_info_for (tree decl, const char *name)
FOR_EACH_VEC_ELT (rhsc, i, rhsp) FOR_EACH_VEC_ELT (rhsc, i, rhsp)
process_constraint (new_constraint (lhs, *rhsp)); process_constraint (new_constraint (lhs, *rhsp));
} }
rhsc.release ();
} }
} }
} }

View File

@ -3802,14 +3802,14 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
bool extract_scalar_result = false; bool extract_scalar_result = false;
gimple use_stmt, orig_stmt, reduction_phi = NULL; gimple use_stmt, orig_stmt, reduction_phi = NULL;
bool nested_in_vect_loop = false; bool nested_in_vect_loop = false;
vec<gimple> new_phis = vNULL; auto_vec<gimple> new_phis;
vec<gimple> inner_phis = vNULL; auto_vec<gimple> inner_phis;
enum vect_def_type dt = vect_unknown_def_type; enum vect_def_type dt = vect_unknown_def_type;
int j, i; int j, i;
vec<tree> scalar_results = vNULL; auto_vec<tree> scalar_results;
unsigned int group_size = 1, k, ratio; unsigned int group_size = 1, k, ratio;
vec<tree> vec_initial_defs = vNULL; auto_vec<tree> vec_initial_defs;
vec<gimple> phis; auto_vec<gimple> phis;
bool slp_reduc = false; bool slp_reduc = false;
tree new_phi_result; tree new_phi_result;
gimple inner_phi = NULL; gimple inner_phi = NULL;
@ -3913,8 +3913,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
} }
} }
vec_initial_defs.release ();
/* 2. Create epilog code. /* 2. Create epilog code.
The reduction epilog code operates across the elements of the vector The reduction epilog code operates across the elements of the vector
of partial results computed by the vectorized loop. of partial results computed by the vectorized loop.
@ -4594,10 +4592,6 @@ vect_finalize_reduction:
phis.release (); phis.release ();
} }
scalar_results.release ();
inner_phis.release ();
new_phis.release ();
} }
@ -4685,10 +4679,10 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
struct loop * def_stmt_loop, *outer_loop = NULL; struct loop * def_stmt_loop, *outer_loop = NULL;
tree def_arg; tree def_arg;
gimple def_arg_stmt; gimple def_arg_stmt;
vec<tree> vec_oprnds0 = vNULL; auto_vec<tree> vec_oprnds0;
vec<tree> vec_oprnds1 = vNULL; auto_vec<tree> vec_oprnds1;
vec<tree> vect_defs = vNULL; auto_vec<tree> vect_defs;
vec<gimple> phis = vNULL; auto_vec<gimple> phis;
int vec_num; int vec_num;
tree def0, def1, tem, op0, op1 = NULL_TREE; tree def0, def1, tem, op0, op1 = NULL_TREE;
@ -5304,11 +5298,6 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
epilog_reduc_code, phis, reduc_index, epilog_reduc_code, phis, reduc_index,
double_reduc, slp_node); double_reduc, slp_node);
phis.release ();
vect_defs.release ();
vec_oprnds0.release ();
vec_oprnds1.release ();
return true; return true;
} }

View File

@ -1580,10 +1580,8 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt,
if (slp_node) if (slp_node)
{ {
int nops = (op1 == NULL_TREE) ? 1 : 2; int nops = (op1 == NULL_TREE) ? 1 : 2;
vec<tree> ops; auto_vec<tree> ops (nops);
ops.create (nops); auto_vec<vec<tree> > vec_defs (nops);
vec<vec<tree> > vec_defs;
vec_defs.create (nops);
ops.quick_push (op0); ops.quick_push (op0);
if (op1) if (op1)
@ -1594,9 +1592,6 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt,
*vec_oprnds0 = vec_defs[0]; *vec_oprnds0 = vec_defs[0];
if (op1) if (op1)
*vec_oprnds1 = vec_defs[1]; *vec_oprnds1 = vec_defs[1];
ops.release ();
vec_defs.release ();
} }
else else
{ {
@ -1907,8 +1902,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (slp_node) if (slp_node)
{ {
vec<vec<tree> > vec_defs; auto_vec<vec<tree> > vec_defs (nargs);
vec_defs.create (nargs);
vec<tree> vec_oprnds0; vec<tree> vec_oprnds0;
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
@ -1937,7 +1931,6 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
vec<tree> vec_oprndsi = vec_defs[i]; vec<tree> vec_oprndsi = vec_defs[i];
vec_oprndsi.release (); vec_oprndsi.release ();
} }
vec_defs.release ();
continue; continue;
} }
@ -2004,8 +1997,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (slp_node) if (slp_node)
{ {
vec<vec<tree> > vec_defs; auto_vec<vec<tree> > vec_defs (nargs);
vec_defs.create (nargs);
vec<tree> vec_oprnds0; vec<tree> vec_oprnds0;
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
@ -2036,7 +2028,6 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
vec<tree> vec_oprndsi = vec_defs[i]; vec<tree> vec_oprndsi = vec_defs[i];
vec_oprndsi.release (); vec_oprndsi.release ();
} }
vec_defs.release ();
continue; continue;
} }

View File

@ -1184,6 +1184,17 @@ public:
}; };
/* auto_vec is a sub class of vec whose storage is released when it is
destroyed. */
template<typename T>
class auto_vec : public vec<T, va_heap>
{
public:
auto_vec () { this->m_vec = NULL; }
auto_vec (size_t n) { this->create (n); }
~auto_vec () { this->release (); }
};
/* stack_vec is a subclass of vec containing N elements of internal storage. /* stack_vec is a subclass of vec containing N elements of internal storage.
You probably only want to allocate this on the stack because if the array You probably only want to allocate this on the stack because if the array
ends up being larger or much smaller than N it will be wasting space. */ ends up being larger or much smaller than N it will be wasting space. */