add auto_vec
authorTrevor Saunders <tsaunders@mozilla.com>
Fri, 22 Nov 2013 05:45:37 +0000 (05:45 +0000)
committerTrevor Saunders <tbsaunde@gcc.gnu.org>
Fri, 22 Nov 2013 05:45:37 +0000 (05:45 +0000)
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

35 files changed:
gcc/ChangeLog
gcc/cfganal.c
gcc/cfgloop.c
gcc/cgraphunit.c
gcc/config/i386/i386.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cp/semantics.c
gcc/dwarf2out.c
gcc/function.c
gcc/genautomata.c
gcc/gimple.c
gcc/haifa-sched.c
gcc/ipa-inline.c
gcc/ira-build.c
gcc/loop-unroll.c
gcc/omp-low.c
gcc/ree.c
gcc/trans-mem.c
gcc/tree-call-cdce.c
gcc/tree-eh.c
gcc/tree-if-conv.c
gcc/tree-into-ssa.c
gcc/tree-loop-distribution.c
gcc/tree-predcom.c
gcc/tree-sra.c
gcc/tree-ssa-forwprop.c
gcc/tree-ssa-loop-manip.c
gcc/tree-ssa-pre.c
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-sccvn.c
gcc/tree-ssa-structalias.c
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c
gcc/vec.h

index 35505f5f1d2dc78f61f449d61fc710e7736d484f..3aa74c0329b5b2ebaccfdcd16a0fd444b32e74a6 100644 (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>
 
        PR target/59233
index 30376b3db4c0c555e0b4ab3163110853a8197c06..ad5928a40b413acba61b71bcefc842223e5cf32a 100644 (file)
@@ -1286,11 +1286,10 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs)
 {
   bitmap_iterator bi;
   unsigned bb_index, i;
-  vec<int> work_stack;
   bitmap phi_insertion_points;
 
   /* 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);
 
   /* 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;
 }
 
index 4b3ad5bd3bdc23d34b97364a140e0cd81934de33..09029c9ac857c1fecb88f6e6abc28fa472a4f594 100644 (file)
@@ -405,7 +405,6 @@ flow_loops_find (struct loops *loops)
   int *rc_order;
   int b;
   unsigned i;
-  vec<loop_p> larray;
 
   /* Ensure that the dominators are computed.  */
   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
      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++)
     {
       basic_block header = BASIC_BLOCK (rc_order[b]);
@@ -510,8 +509,6 @@ flow_loops_find (struct loops *loops)
        }
     }
 
-  larray.release ();
-
   return loops;
 }
 
index f56f7c7abbb6e93428de113c41f0e6f0f1dc5b68..b10d75531b034288b6a99609006659419ec5fd54 100644 (file)
@@ -1525,7 +1525,6 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
       int i;
       tree resdecl;
       tree restmp = NULL;
-      vec<tree> vargs;
 
       gimple call;
       gimple ret;
@@ -1579,7 +1578,7 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
 
       for (arg = a; arg; arg = DECL_CHAIN (arg))
         nargs++;
-      vargs.create (nargs);
+      auto_vec<tree> vargs (nargs);
       if (this_adjusting)
         vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
                                        virtual_offset));
@@ -1591,7 +1590,6 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
          vargs.quick_push (arg);
       call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
       node->callees->call_stmt = call;
-      vargs.release ();
       gimple_call_set_from_thunk (call, true);
       if (restmp)
        {
index 60e1b0f164d575e385887cd74f1293bc73bcb0f5..c818cb9dc4aead6da758fcc8f52354c7e2668a06 100644 (file)
@@ -30708,7 +30708,6 @@ ix86_generate_version_dispatcher_body (void *node_p)
 {
   tree resolver_decl;
   basic_block empty_bb;
-  vec<tree> fn_ver_vec = vNULL;
   tree default_ver_decl;
   struct cgraph_node *versn;
   struct cgraph_node *node;
@@ -30738,7 +30737,7 @@ ix86_generate_version_dispatcher_body (void *node_p)
 
   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;
        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);
-  fn_ver_vec.release ();
   rebuild_cgraph_edges (); 
   pop_cfun ();
   return resolver_decl;
index 1c0d9b7c12116cce46db7e09cf961a7c3f532d73..5e769c30eecf32369bf590a50c610b1a6d85a9e3 100644 (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>
 
        * decl.c (reshape_init_array_1): Use tree_to_uhwi rather than
index 977adf6b79163ab21db608ce521a129fad56eddd..bc86697793c37ea96fd171e91d783ffb480292ab 100644 (file)
@@ -30345,7 +30345,7 @@ static void
 cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
                                 enum pragma_context)
 {
-  vec<tree> types = vNULL;
+  auto_vec<tree> types;
   enum tree_code reduc_code = ERROR_MARK;
   tree reduc_id = NULL_TREE, orig_reduc_id = NULL_TREE, type;
   unsigned int i;
@@ -30460,7 +30460,6 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
     {
      fail:
       cp_parser_skip_to_pragma_eol (parser, pragma_tok);
-      types.release ();
       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);
-  types.release ();
 }
 
 /* OpenMP 4.0
index 11f781288e90f47aa5791c110c848303093bc71b..cd5a91d2c60c3ed8f90d1d820a496e2820205e9f 100644 (file)
@@ -4376,24 +4376,17 @@ handle_omp_array_sections (tree c)
 {
   bool maybe_zero_len = false;
   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,
                                            maybe_zero_len, first_non_one);
   if (first == error_mark_node)
-    {
-      types.release ();
-      return true;
-    }
+    return true;
   if (first == NULL_TREE)
-    {
-      types.release ();
-      return false;
-    }
+    return false;
   if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEPEND)
     {
       tree t = OMP_CLAUSE_DECL (c);
       tree tem = NULL_TREE;
-      types.release ();
       if (processing_template_decl)
        return false;
       /* 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)
        maybe_zero_len = true;
       if (processing_template_decl && maybe_zero_len)
-       {
-         types.release ();
-         return false;
-       }
+       return false;
 
       for (i = num, t = OMP_CLAUSE_DECL (c); i > 0;
           t = TREE_CHAIN (t))
@@ -4469,7 +4459,6 @@ handle_omp_array_sections (tree c)
                                "array section is not contiguous in %qs "
                                "clause",
                                omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
-                     types.release ();
                      return true;
                    }
                }
@@ -4525,7 +4514,6 @@ handle_omp_array_sections (tree c)
                size = size_binop (MULT_EXPR, size, l);
            }
        }
-      types.release ();
       if (!processing_template_decl)
        {
          if (side_effects)
index 1c0effd6c263b5e099243a7e24605ddb0d3cf086..bd372b733a7289a180979c80d24cc5c5b3e03937 100644 (file)
@@ -19111,7 +19111,7 @@ static char *
 gen_producer_string (void)
 {
   size_t j;
-  vec<dchar_p> switches = vNULL;
+  auto_vec<dchar_p> switches;
   const char *language_string = lang_hooks.name;
   char *producer, *tail;
   const char *p;
@@ -19192,7 +19192,6 @@ gen_producer_string (void)
     }
 
   *tail = '\0';
-  switches.release ();
   return producer;
 }
 
index 5b33c46559b103925fa47fbbe920b7bfd57acaf1..3789352a7dc6a9487e55d27b4eba84f67d2c30a8 100644 (file)
@@ -5722,9 +5722,8 @@ convert_jumps_to_returns (basic_block last_bb, bool simple_p,
   rtx label;
   edge_iterator ei;
   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)
     if (e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
       src_bbs.quick_push (e->src);
index 3ab480428aa917cff9aabddf6ec8ddd73d2db446..5580c69a352dd87ffa685d873aba427c0206b098 100644 (file)
@@ -3340,7 +3340,6 @@ static alt_state_t
 uniq_sort_alt_states (alt_state_t alt_states_list)
 {
   alt_state_t curr_alt_state;
-  vec<alt_state_t> alt_states;
   size_t i;
   size_t prev_unique_state_ind;
   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)
     return alt_states_list;
 
-  alt_states.create (150);
+  stack_vec<alt_state_t, 150> alt_states;
   for (curr_alt_state = alt_states_list;
        curr_alt_state != NULL;
        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];
 
-  alt_states.release ();
   return result;
 }
 
@@ -5148,7 +5146,6 @@ check_regexp_units_distribution (const char *insn_reserv_name,
   bool annotation_reservation_message_reported_p;
   regexp_t seq, allof, unit;
   struct unit_usage *unit_usage_ptr;
-  vec<int> marked;
 
   if (regexp == NULL || regexp->mode != rm_oneof)
     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_decl->last_distribution_check_cycle = -1;
   n_alts = REGEXP_ONEOF (regexp)->regexps_num;
-  marked.create (n_alts);
+  auto_vec<int> marked (n_alts);
   for (i = 0; i < n_alts; i++)
     marked.safe_push (0);
   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 ();
   obstack_free (&unit_usages, NULL);
 }
@@ -5488,8 +5484,7 @@ form_ainsn_with_same_reservs (automaton_t automaton)
 {
   ainsn_t curr_ainsn;
   size_t i;
-  vec<ainsn_t> last_insns;
-  last_insns.create (150);
+  stack_vec<ainsn_t, 150> last_insns;
 
   for (curr_ainsn = automaton->ainsn_list;
        curr_ainsn != NULL;
@@ -5519,7 +5514,6 @@ form_ainsn_with_same_reservs (automaton_t automaton)
             curr_ainsn->first_insn_with_same_reservs = 1;
           }
       }
-  last_insns.release ();
 }
 
 /* Forming unit reservations which can affect creating the automaton
@@ -5561,8 +5555,7 @@ make_automaton (automaton_t automaton)
   state_t state;
   state_t start_state;
   state_t state2;
-  vec<state_t> state_stack;
-  state_stack.create (150);
+  stack_vec<state_t, 150> state_stack;
   int states_n;
   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);
     }
-  state_stack.release ();
 }
 
 /* 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 state;
   decl_t decl;
-  vec<state_t> state_stack;
+  auto_vec<state_t> state_stack;
   int i;
   int states_n;
 
-  state_stack.create (0);
-
   /* Create the start state (empty state).  */
   start_state = automaton->start_state;
   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);
        }
     }
-  state_stack.release ();
 }
 
 /* The following variable value is current number (1, 2, ...) of passing
@@ -6258,13 +6247,11 @@ set_new_cycle_flags (state_t state)
 static void
 minimize_DFA (automaton_t automaton)
 {
-  vec<state_t> equiv_classes = vNULL;
+  auto_vec<state_t> equiv_classes;
 
   evaluate_equiv_classes (automaton, &equiv_classes);
   merge_states (automaton, equiv_classes);
   pass_states (automaton, set_new_cycle_flags);
-
-  equiv_classes.release ();
 }
 
 /* Values of two variables are counted number of states and arcs in an
index d48ca6bcd10bb007a2b8fd413eea2777853fc554..67730bc6dbdc031f357e143510e04258e39c0340 100644 (file)
@@ -2051,8 +2051,7 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
 {
   int i;
   int nargs = gimple_call_num_args (stmt);
-  vec<tree> vargs;
-  vargs.create (nargs);
+  auto_vec<tree> vargs (nargs);
   gimple new_stmt;
 
   for (i = 0; i < nargs; i++)
@@ -2064,7 +2063,7 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip)
                                               vargs);
   else
     new_stmt = gimple_build_call_vec (gimple_call_fn (stmt), vargs);
-  vargs.release ();
+
   if (gimple_call_lhs (stmt))
     gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
 
index c98b36c1ab6be723ba2664213073ad792e53f6cf..380244094fb899e13a3c444edb3f5fc3aca6189c 100644 (file)
@@ -4223,7 +4223,7 @@ undo_replacements_for_backtrack (struct haifa_saved_data *save)
 static void
 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
      dependencies and other trivial bookkeeping.  */
@@ -4281,7 +4281,6 @@ unschedule_insns_until (rtx insn)
       else if (QUEUE_INDEX (con) != QUEUE_SCHEDULED)
        TODO_SPEC (con) = recompute_todo_spec (con, true);
     }
-  recompute_vec.release ();
 }
 
 /* Restore scheduler state from the topmost entry on the backtracking queue.
index fbb63da7dc83beab8c68fb25721f1a3654f67785..54ec74ee19155884df672b687f5ef85de780448e 100644 (file)
@@ -1524,7 +1524,7 @@ inline_small_functions (void)
   fibheap_t edge_heap = fibheap_new ();
   bitmap updated_nodes = BITMAP_ALLOC (NULL);
   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;
   struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
   struct cgraph_edge_hook_list *edge_removal_hook_holder;
@@ -1815,7 +1815,6 @@ inline_small_functions (void)
     }
 
   free_growth_caches ();
-  new_indirect_edges.release ();
   fibheap_delete (edge_heap);
   if (dump_file)
     fprintf (dump_file,
index e249ba0dcff2696d8c29cef53db0ff94f6a1be61..09e22d74f6bd1101c4e0f7f6bee6b53b7b8dfb71 100644 (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;
       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
         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
-      dfs_stack.release ();
     }
 
   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)
     {
-      vec<ira_loop_tree_node_t>
-         loop_preorder = vNULL;
+      auto_vec<ira_loop_tree_node_t> loop_preorder;
       unsigned int i;
 
       /* 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);
          loop_rev_postorder.release ();
        }
-
-      loop_preorder.release ();
     }
 
   for (subloop_node = loop_node->subloops;
index 1240f7ce024f29c7630e724ca940c4b2a5fa63ef..9c871678f6b74dc7b958d9ae8a5119e3f159bc5a 100644 (file)
@@ -578,7 +578,6 @@ peel_loop_completely (struct loop *loop)
   sbitmap wont_exit;
   unsigned HOST_WIDE_INT npeel;
   unsigned i;
-  vec<edge> remove_edges;
   edge ein;
   struct niter_desc *desc = get_simple_loop_desc (loop);
   struct opt_info *opt_info = NULL;
@@ -595,8 +594,7 @@ peel_loop_completely (struct loop *loop)
       if (desc->noloop_assumptions)
        bitmap_clear_bit (wont_exit, 1);
 
-      remove_edges.create (0);
-
+      auto_vec<edge> remove_edges;
       if (flag_split_ivs_in_unroller)
         opt_info = analyze_insns_in_loop (loop);
 
@@ -622,7 +620,6 @@ peel_loop_completely (struct loop *loop)
       /* Remove the exit edges.  */
       FOR_EACH_VEC_ELT (remove_edges, i, ein)
        remove_path (ein);
-      remove_edges.release ();
     }
 
   ein = desc->in_edge;
@@ -760,7 +757,6 @@ unroll_loop_constant_iterations (struct loop *loop)
   unsigned exit_mod;
   sbitmap wont_exit;
   unsigned i;
-  vec<edge> remove_edges;
   edge e;
   unsigned max_unroll = loop->lpt_decision.times;
   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);
   bitmap_ones (wont_exit);
 
-  remove_edges.create (0);
+  auto_vec<edge> remove_edges;
   if (flag_split_ivs_in_unroller
       || flag_variable_expansion_in_unroller)
     opt_info = analyze_insns_in_loop (loop);
@@ -928,7 +924,6 @@ unroll_loop_constant_iterations (struct loop *loop)
   /* Remove the edges.  */
   FOR_EACH_VEC_ELT (remove_edges, i, e)
     remove_path (e);
-  remove_edges.release ();
 
   if (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;
   unsigned i, j, p;
   basic_block preheader, *body, swtch, ezc_swtch;
-  vec<basic_block> dom_bbs;
   sbitmap wont_exit;
   int may_exit_copy;
   unsigned n_peel;
-  vec<edge> remove_edges;
   edge e;
   bool extra_zero_check, last_may_exit;
   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);
 
   /* Remember blocks whose dominators will have to be updated.  */
-  dom_bbs.create (0);
+  auto_vec<basic_block> dom_bbs;
 
   body = get_loop_body (loop);
   for (i = 0; i < loop->num_nodes; i++)
@@ -1174,7 +1167,7 @@ unroll_loop_runtime_iterations (struct loop *loop)
   /* Precondition the loop.  */
   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);
 
@@ -1298,7 +1291,6 @@ unroll_loop_runtime_iterations (struct loop *loop)
   /* Remove the edges.  */
   FOR_EACH_VEC_ELT (remove_edges, i, e)
     remove_path (e);
-  remove_edges.release ();
 
   /* We must be careful when updating the number of iterations due to
      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 "
             "in runtime, %i insns\n",
             max_unroll, num_loop_insns (loop));
-
-  dom_bbs.release ();
 }
 
 /* Decide whether to simply peel LOOP and how much.  */
index 67221556f69ef434870303b01c6666dde24ec243..29950608b9f61bcd0f2655a2ce0eac3a4af4a6c0 100644 (file)
@@ -6901,7 +6901,6 @@ static void
 expand_omp_sections (struct omp_region *region)
 {
   tree t, u, vin = NULL, vmain, vnext, l2;
-  vec<tree> label_vec;
   unsigned len;
   basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
   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
      in advance.  */
-  label_vec.create (len);
+  auto_vec<tree> label_vec (len);
 
   /* The call to GOMP_sections_start goes in ENTRY_BB, replacing the
      GIMPLE_OMP_SECTIONS statement.  */
@@ -7050,7 +7049,6 @@ expand_omp_sections (struct omp_region *region)
   stmt = gimple_build_switch (vmain, u, label_vec);
   gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT);
   gsi_remove (&switch_si, true);
-  label_vec.release ();
 
   si = gsi_start_bb (default_bb);
   stmt = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0);
index fa05feed7491cf9af20ae062b0fba35d0e79eec8..87427fdb00ec2817ac5cbf7bf9112914dbe39d71 100644 (file)
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -862,7 +862,7 @@ find_and_remove_re (void)
   rtx curr_insn = NULL_RTX;
   int num_re_opportunities = 0, num_realized = 0, i;
   vec<ext_cand> reinsn_list;
-  vec<rtx> reinsn_del_list;
+  auto_vec<rtx> reinsn_del_list;
   ext_state state;
 
   /* 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);
 
   max_insn_uid = get_max_uid ();
-  reinsn_del_list.create (0);
   reinsn_list = find_removable_extensions ();
   state.defs_list.create (0);
   state.copies_list.create (0);
@@ -910,7 +909,6 @@ find_and_remove_re (void)
     delete_insn (curr_insn);
 
   reinsn_list.release ();
-  reinsn_del_list.release ();
   state.defs_list.release ();
   state.copies_list.release ();
   state.modified_list.release ();
index 271f600323b14517abd1a75a4d4cec8a7098f4ce..9e6f4d9cec7b26f61154ee97b5ef86623b48fdc0 100644 (file)
@@ -1944,10 +1944,10 @@ tm_region_init (struct tm_region *region)
   edge_iterator ei;
   edge e;
   basic_block bb;
-  vec<basic_block> queue = vNULL;
+  auto_vec<basic_block> queue;
   bitmap visited_blocks = BITMAP_ALLOC (NULL);
   struct tm_region *old_region;
-  vec<tm_region_p> bb_regions = vNULL;
+  auto_vec<tm_region_p> bb_regions;
 
   all_tm_regions = region;
   bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
@@ -1991,9 +1991,7 @@ tm_region_init (struct tm_region *region)
          }
     }
   while (!queue.is_empty ());
-  queue.release ();
   BITMAP_FREE (visited_blocks);
-  bb_regions.release ();
 }
 
 /* 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;
   bitmap new_irr, old_irr;
-  vec<basic_block> queue;
   bool ret = false;
 
   /* 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);
 
   d = get_cg_data (&node, true);
-  queue.create (10);
+  stack_vec<basic_block, 10> queue;
   new_irr = BITMAP_ALLOC (&tm_obstack);
 
   /* 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
     BITMAP_FREE (new_irr);
 
-  queue.release ();
   pop_cfun ();
 
   return ret;
@@ -5207,7 +5203,7 @@ ipa_tm_transform_calls (struct cgraph_node *node, struct tm_region *region,
   bool need_ssa_rename = false;
   edge e;
   edge_iterator ei;
-  vec<basic_block> queue = vNULL;
+  auto_vec<basic_block> queue;
   bitmap visited_blocks = BITMAP_ALLOC (NULL);
 
   queue.safe_push (bb);
@@ -5233,7 +5229,6 @@ ipa_tm_transform_calls (struct cgraph_node *node, struct tm_region *region,
     }
   while (!queue.is_empty ());
 
-  queue.release ();
   BITMAP_FREE (visited_blocks);
 
   return need_ssa_rename;
index 6f6b1171b92380dd4e9204ee543f23a964706e39..c0dcf484b2d6607e05d9a3f17fc9487587f35c19 100644 (file)
@@ -871,7 +871,7 @@ tree_call_cdce (void)
   basic_block bb;
   gimple_stmt_iterator i;
   bool something_changed = false;
-  vec<gimple> cond_dead_built_in_calls = vNULL;
+  auto_vec<gimple> cond_dead_built_in_calls;
   FOR_EACH_BB (bb)
     {
       /* Collect dead call candidates.  */
@@ -900,8 +900,6 @@ tree_call_cdce (void)
   something_changed
     = shrink_wrap_conditional_dead_built_in_calls (cond_dead_built_in_calls);
 
-  cond_dead_built_in_calls.release ();
-
   if (something_changed)
     {
       free_dominance_info (CDI_DOMINATORS);
index 7778678758583eadf2a647b6c04ce0e8e6b7f278..778c0a798b1a1b86c692edd7fba214c20ef95e48 100644 (file)
@@ -3569,7 +3569,7 @@ lower_eh_dispatch (basic_block src, gimple stmt)
     {
     case ERT_TRY:
       {
-       vec<tree> labels = vNULL;
+       auto_vec<tree> labels;
        tree default_label = NULL;
        eh_catch c;
        edge_iterator ei;
@@ -3657,8 +3657,6 @@ lower_eh_dispatch (basic_block src, gimple stmt)
 
            x = gimple_build_switch (filter, default_label, labels);
            gsi_insert_before (&gsi, x, GSI_SAME_STMT);
-
-           labels.release ();
          }
        pointer_set_destroy (seen_values);
       }
index 907b403e43c147d77bf61518cb3eeaba391cfcfa..cf08386ed3c2e737decba7973494e955dbe92b1e 100644 (file)
@@ -1215,7 +1215,6 @@ if_convertible_loop_p (struct loop *loop)
        free (dr->aux);
     }
 
-  loop_nest.release ();
   free_data_refs (refs);
   free_dependence_relations (ddrs);
   return res;
index 6cae27e34b7f40ffb13845a134c4cf8b0f60063f..41c0896b97c0b0f61f125c2ab7035dafafc9ac78 100644 (file)
@@ -764,7 +764,6 @@ find_dfsnum_interval (struct dom_dfsnum *defs, unsigned n, unsigned s)
 static void
 prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
 {
-  vec<int> worklist;
   bitmap_iterator bi;
   unsigned i, b, p, u, top;
   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
      to the start of the following interval, not to the end of the current
      one).  We use WORKLIST as a stack.  */
-  worklist.create (n_defs + 1);
+  auto_vec<int> worklist (n_defs + 1);
   worklist.quick_push (1);
   top = 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_FREE (live_phis);
   free (defs);
@@ -1084,11 +1082,10 @@ insert_phi_nodes (bitmap_head *dfs)
   hash_table <var_info_hasher>::iterator hi;
   unsigned i;
   var_info_p info;
-  vec<var_info_p> vars;
 
   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)
     if (info->info.need_phi_state != NEED_PHI_STATE_NO)
       vars.quick_push (info);
@@ -1104,8 +1101,6 @@ insert_phi_nodes (bitmap_head *dfs)
       BITMAP_FREE (idf);
     }
 
-  vars.release ();
-
   timevar_pop (TV_TREE_INSERT_PHI_NODES);
 }
 
index b4ca2119d1e82b1aac3e50fd123f26be96d7a8b0..6121236f99b03967bccba139724e35352c82f54a 100644 (file)
@@ -1406,7 +1406,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
                 control_dependences *cd, int *nb_calls)
 {
   struct graph *rdg;
-  vec<partition_t> partitions;
   partition_t partition;
   bool any_builtin;
   int i, nbp;
@@ -1432,7 +1431,7 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
   if (dump_file && (dump_flags & TDF_DETAILS))
     dump_rdg (dump_file, rdg);
 
-  partitions.create (3);
+  stack_vec<partition_t, 3> partitions;
   rdg_build_partitions (rdg, stmts, &partitions);
 
   any_builtin = false;
@@ -1658,7 +1657,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
 
   FOR_EACH_VEC_ELT (partitions, i, partition)
     partition_free (partition);
-  partitions.release ();
 
   free_rdg (rdg);
   return nbp - *nb_calls;
@@ -1687,7 +1685,7 @@ tree_loop_distribution (void)
      walking to innermost loops.  */
   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
     {
-      vec<gimple> work_list = vNULL;
+      auto_vec<gimple> work_list;
       basic_block *bbs;
       int num = loop->num;
       unsigned int i;
@@ -1769,8 +1767,6 @@ out:
        }
       else if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "Loop %d is the same.\n", num);
-
-      work_list.release ();
     }
 
   if (cd)
index 6d141842f1cec642bba843dbcc582984c7adaa37..0d3c66cc877f633e1fe4ef81eb67fb8472cee7f3 100644 (file)
@@ -1538,7 +1538,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
 static void
 execute_load_motion (struct loop *loop, chain_p chain, bitmap tmp_vars)
 {
-  vec<tree> vars;
+  auto_vec<tree> vars;
   dref a;
   unsigned n_writes = 0, ridx, i;
   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],
                        !is_read, !is_read);
     }
-
-  vars.release ();
 }
 
 /* Returns the single statement in that NAME is used, excepting
@@ -2272,7 +2270,7 @@ try_combine_chains (vec<chain_p> *chains)
 {
   unsigned i, j;
   chain_p ch1, ch2, cch;
-  vec<chain_p> worklist = vNULL;
+  auto_vec<chain_p> worklist;
 
   FOR_EACH_VEC_ELT (*chains, i, 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
index 0102f3fe986e0fd6ed4d512e074d9fb198f4097e..60b633f34e11896254833b2217f647619851d0b0 100644 (file)
@@ -3784,10 +3784,9 @@ analyze_modified_params (vec<access_p> representatives)
 static void
 propagate_dereference_distances (void)
 {
-  vec<basic_block> queue;
   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));
   FOR_EACH_BB (bb)
     {
@@ -3847,8 +3846,6 @@ propagate_dereference_distances (void)
            queue.quick_push (e->src);
          }
     }
-
-  queue.release ();
 }
 
 /* Dump a dereferences TABLE with heading STR to file F.  */
index 0c9a79f6092fcb5d2c2cf7a28c9651d63dd5daa2..0fe3afe3fdfe44ba2df3c061d9ebda3ac2d8ba52 100644 (file)
@@ -1281,8 +1281,7 @@ static void
 simplify_gimple_switch_label_vec (gimple stmt, tree index_type)
 {
   unsigned int branch_num = gimple_switch_num_labels (stmt);
-  vec<tree> labels;
-  labels.create (branch_num);
+  auto_vec<tree> labels (branch_num);
   unsigned int i, len;
 
   /* 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);
     }
-
-  labels.release ();
 }
 
 /* STMT is a SWITCH_EXPR for which we attempt to find equivalent forms of
index 67291670418b72517930999d76250b7114b28d9f..031b7c757e62b93134894e7277c8f0cbe515237b 100644 (file)
@@ -187,7 +187,6 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
 {
   unsigned i;
   bitmap_iterator bi;
-  vec<basic_block> worklist;
   struct loop *def_loop = def_bb->loop_father;
   unsigned def_loop_depth = loop_depth (def_loop);
   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
      blocks in the largest loop.  We don't know this number, but we
      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)
     {
@@ -258,7 +257,6 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,
          worklist.quick_push (pred);
        }
     }
-  worklist.release ();
 
   def_loop_exits = BITMAP_ALLOC (&loop_renamer_obstack);
   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 irr = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
   sbitmap wont_exit;
-  vec<edge> to_remove = vNULL;
+  auto_vec<edge> to_remove;
 
   est_niter = expected_loop_iterations (loop);
   determine_exit_conditions (loop, desc, factor,
@@ -1194,7 +1192,6 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
       ok = remove_path (e);
       gcc_assert (ok);
     }
-  to_remove.release ();
   update_ssa (TODO_update_ssa);
 
   /* Ensure that the frequencies in the loop match the new estimated
index 29d56b1c660330f7942722dd3e7ef0abdc69eaad..79eb0fbd914d4f68d45423ee9733bc1844e9f6b2 100644 (file)
@@ -2182,11 +2182,10 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
      phis to translate through.  */
   else
     {
-      vec<basic_block> worklist;
       size_t i;
       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)
        {
          if (!first
@@ -2224,7 +2223,6 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge)
          else
            bitmap_set_and (ANTIC_OUT, ANTIC_IN (bprime));
        }
-      worklist.release ();
     }
 
   /* Prune expressions that are clobbered in block and thus become
@@ -2346,11 +2344,10 @@ compute_partial_antic_aux (basic_block block,
      them.  */
   else
     {
-      vec<basic_block> worklist;
       size_t i;
       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)
        {
          if (e->flags & EDGE_DFS_BACK)
@@ -2382,7 +2379,6 @@ compute_partial_antic_aux (basic_block block,
                                                expression_for_id (i));
            }
        }
-      worklist.release ();
     }
 
   /* 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 ();
-  avail.release ();
   return new_stuff;
 }
 
@@ -3480,7 +3475,7 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
   bool new_stuff = false;
   vec<pre_expr> exprs;
   pre_expr expr;
-  vec<pre_expr> avail = vNULL;
+  auto_vec<pre_expr> avail;
   int i;
 
   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 ();
-  avail.release ();
   return new_stuff;
 }
 
@@ -3826,7 +3820,7 @@ compute_avail (void)
              {
                vn_reference_t ref;
                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.  */
                if (gimple_call_internal_p (stmt))
@@ -3836,7 +3830,6 @@ compute_avail (void)
                vn_reference_lookup_pieces (gimple_vuse (stmt), 0,
                                            gimple_expr_type (stmt),
                                            ops, &ref, VN_NOWALK);
-               ops.release ();
                if (!ref)
                  continue;
 
index a67720139e96cd88ee4dcce38c06d302ef839c25..e8f56cf7099d8cfe2e52a96d7ba7a1ef26c4c685 100644 (file)
@@ -2660,8 +2660,8 @@ maybe_optimize_range_tests (gimple stmt)
   basic_block bb;
   edge_iterator ei;
   edge e;
-  vec<operand_entry_t> ops = vNULL;
-  vec<inter_bb_range_test_entry> bbinfo = vNULL;
+  auto_vec<operand_entry_t> ops;
+  auto_vec<inter_bb_range_test_entry> bbinfo;
   bool any_changes = false;
 
   /* Consider only basic blocks that end with GIMPLE_COND or
@@ -2975,8 +2975,6 @@ maybe_optimize_range_tests (gimple stmt)
            break;
        }
     }
-  bbinfo.release ();
-  ops.release ();
 }
 
 /* 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))
            {
-             vec<operand_entry_t> ops = vNULL;
+             auto_vec<operand_entry_t> ops;
              tree powi_result = NULL_TREE;
 
              /* 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);
                    }
                }
-
-             ops.release ();
            }
        }
     }
index 1b9514e2108896d71be9231f84c4470d99b5fcc5..925fcf1850328efa720a1e4678bb075e937b19b8 100644 (file)
@@ -1751,8 +1751,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
       tree base2;
       HOST_WIDE_INT offset2, size2, maxsize2;
       int i, j;
-      vec<vn_reference_op_s>
-         rhs = vNULL;
+      auto_vec<vn_reference_op_s> rhs;
       vn_reference_op_t vro;
       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 ());
       FOR_EACH_VEC_ELT (rhs, j, vro)
        vr->operands[i + 1 + j] = *vro;
-      rhs.release ();
       vr->operands = valueize_refs (vr->operands);
       vr->hashcode = vn_reference_compute_hash (vr);
 
@@ -3787,7 +3785,7 @@ process_scc (vec<tree> scc)
 static bool
 extract_and_process_scc_for_name (tree name)
 {
-  vec<tree> scc = vNULL;
+  auto_vec<tree> scc;
   tree x;
 
   /* 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 (),
                 (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE));
 
-      scc.release ();
       return false;
     }
 
@@ -3821,8 +3818,6 @@ extract_and_process_scc_for_name (tree name)
 
   process_scc (scc);
 
-  scc.release ();
-
   return true;
 }
 
index 6174dcf8ecf7231d6a382c62fd2d23a7fe20ae26..b8e79fabc2a7555e7f41cf379301cd19a6efb0eb 100644 (file)
@@ -2573,7 +2573,7 @@ eliminate_indirect_cycles (unsigned int node)
       && !bitmap_empty_p (get_varinfo (node)->solution))
     {
       unsigned int i;
-      vec<unsigned> queue = vNULL;
+      auto_vec<unsigned> queue;
       int queuepos;
       unsigned int to = find (graph->indirect_cycles[node]);
       bitmap_iterator bi;
@@ -2597,7 +2597,6 @@ eliminate_indirect_cycles (unsigned int node)
        {
          unify_nodes (graph, to, i, true);
        }
-      queue.release ();
       return true;
     }
   return false;
@@ -3477,7 +3476,7 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
            {
              unsigned int i;
              tree val;
-             vec<ce_s> tmp = vNULL;
+             auto_vec<ce_s> tmp;
              FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
                {
                  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);
                  tmp.truncate (0);
                }
-             tmp.release ();
              /* 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.  */
@@ -3577,8 +3575,8 @@ static void
 do_structure_copy (tree lhsop, tree rhsop)
 {
   struct constraint_expr *lhsp, *rhsp;
-  vec<ce_s> lhsc = vNULL;
-  vec<ce_s> rhsc = vNULL;
+  auto_vec<ce_s> lhsc;
+  auto_vec<ce_s> rhsc;
   unsigned j;
 
   get_constraint_for (lhsop, &lhsc);
@@ -3637,9 +3635,6 @@ do_structure_copy (tree lhsop, tree rhsop)
     }
   else
     gcc_unreachable ();
-
-  lhsc.release ();
-  rhsc.release ();
 }
 
 /* Create constraints ID = { rhsc }.  */
@@ -3664,10 +3659,9 @@ make_constraints_to (unsigned id, vec<ce_s> rhsc)
 static void
 make_constraint_to (unsigned id, tree op)
 {
-  vec<ce_s> rhsc = vNULL;
+  auto_vec<ce_s> rhsc;
   get_constraint_for_rhs (op, &rhsc);
   make_constraints_to (id, rhsc);
-  rhsc.release ();
 }
 
 /* Create a constraint ID = &FROM.  */
@@ -3938,7 +3932,7 @@ handle_rhs_call (gimple stmt, vec<ce_s> *results)
       && gimple_call_lhs (stmt) != NULL_TREE
       && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
     {
-      vec<ce_s> tmpc = vNULL;
+      auto_vec<ce_s> tmpc;
       struct constraint_expr lhsc, *c;
       get_constraint_for_address_of (gimple_call_lhs (stmt), &tmpc);
       lhsc.var = escaped_id;
@@ -3946,7 +3940,6 @@ handle_rhs_call (gimple stmt, vec<ce_s> *results)
       lhsc.type = SCALAR;
       FOR_EACH_VEC_ELT (tmpc, i, c)
        process_constraint (new_constraint (lhsc, *c));
-      tmpc.release ();
     }
 
   /* Regular functions return nonlocal memory.  */
@@ -3964,7 +3957,7 @@ static void
 handle_lhs_call (gimple stmt, tree lhs, int flags, vec<ce_s> rhsc,
                 tree fndecl)
 {
-  vec<ce_s> lhsc = vNULL;
+  auto_vec<ce_s> lhsc;
 
   get_constraint_for (lhs, &lhsc);
   /* 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
     process_all_all_constraints (lhsc, rhsc);
-
-  lhsc.release ();
 }
 
 /* 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)
     {
       tree arg = gimple_call_arg (stmt, k);
-      vec<ce_s> argc = vNULL;
+      auto_vec<ce_s> argc;
       unsigned i;
       struct constraint_expr *argp;
       get_constraint_for_rhs (arg, &argc);
       FOR_EACH_VEC_ELT (argc, i, argp)
        results->safe_push (*argp);
-      argc.release ();
     }
 
   /* May return addresses of globals.  */
@@ -4854,7 +4844,7 @@ find_func_clobbers (gimple origt)
 {
   gimple t = origt;
   vec<ce_s> lhsc = vNULL;
-  vec<ce_s> rhsc = vNULL;
+  auto_vec<ce_s> rhsc;
   varinfo_t fi;
 
   /* 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),
                            anything_id);
     }
-
-  rhsc.release ();
 }
 
 
@@ -5623,7 +5611,7 @@ create_variable_info_for_1 (tree decl, const char *name)
   varinfo_t vi, newvi;
   tree decl_type = TREE_TYPE (decl);
   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;
   unsigned int i;
 
@@ -5726,8 +5714,6 @@ create_variable_info_for_1 (tree decl, const char *name)
        }
     }
 
-  fieldstack.release ();
-
   return vi;
 }
 
@@ -5778,7 +5764,7 @@ create_variable_info_for (tree decl, const char *name)
          if (DECL_INITIAL (decl)
              && vnode->definition)
            {
-             vec<ce_s> rhsc = vNULL;
+             auto_vec<ce_s> rhsc;
              struct constraint_expr lhs, *rhsp;
              unsigned i;
              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)
                    process_constraint (new_constraint (lhs, *rhsp));
                }
-             rhsc.release ();
            }
        }
     }
index 02aa090b51a9614d7585821b026ff587d7415907..bcd351621c9a58edc2051b480aac139be849755f 100644 (file)
@@ -3802,14 +3802,14 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
   bool extract_scalar_result = false;
   gimple use_stmt, orig_stmt, reduction_phi = NULL;
   bool nested_in_vect_loop = false;
-  vec<gimple> new_phis = vNULL;
-  vec<gimple> inner_phis = vNULL;
+  auto_vec<gimple> new_phis;
+  auto_vec<gimple> inner_phis;
   enum vect_def_type dt = vect_unknown_def_type;
   int j, i;
-  vec<tree> scalar_results = vNULL;
+  auto_vec<tree> scalar_results;
   unsigned int group_size = 1, k, ratio;
-  vec<tree> vec_initial_defs = vNULL;
-  vec<gimple> phis;
+  auto_vec<tree> vec_initial_defs;
+  auto_vec<gimple> phis;
   bool slp_reduc = false;
   tree new_phi_result;
   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.
         The reduction epilog code operates across the elements of the vector
         of partial results computed by the vectorized loop.
@@ -4594,10 +4592,6 @@ vect_finalize_reduction:
 
       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;
   tree def_arg;
   gimple def_arg_stmt;
-  vec<tree> vec_oprnds0 = vNULL;
-  vec<tree> vec_oprnds1 = vNULL;
-  vec<tree> vect_defs = vNULL;
-  vec<gimple> phis = vNULL;
+  auto_vec<tree> vec_oprnds0;
+  auto_vec<tree> vec_oprnds1;
+  auto_vec<tree> vect_defs;
+  auto_vec<gimple> phis;
   int vec_num;
   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,
                                     double_reduc, slp_node);
 
-  phis.release ();
-  vect_defs.release ();
-  vec_oprnds0.release ();
-  vec_oprnds1.release ();
-
   return true;
 }
 
index 2116cec3cf9d8135ce23a430d409b9cd50d47fe6..1aede48dc77547eed9df3c708ad1f7e947a8e8b7 100644 (file)
@@ -1580,10 +1580,8 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt,
   if (slp_node)
     {
       int nops = (op1 == NULL_TREE) ? 1 : 2;
-      vec<tree> ops;
-      ops.create (nops);
-      vec<vec<tree> > vec_defs;
-      vec_defs.create (nops);
+      auto_vec<tree> ops (nops);
+      auto_vec<vec<tree> > vec_defs (nops);
 
       ops.quick_push (op0);
       if (op1)
@@ -1594,9 +1592,6 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt,
       *vec_oprnds0 = vec_defs[0];
       if (op1)
        *vec_oprnds1 = vec_defs[1];
-
-      ops.release ();
-      vec_defs.release ();
     }
   else
     {
@@ -1907,8 +1902,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
 
          if (slp_node)
            {
-             vec<vec<tree> > vec_defs;
-             vec_defs.create (nargs);
+             auto_vec<vec<tree> > vec_defs (nargs);
              vec<tree> vec_oprnds0;
 
              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_oprndsi.release ();
                }
-             vec_defs.release ();
              continue;
            }
 
@@ -2004,8 +1997,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
 
          if (slp_node)
            {
-             vec<vec<tree> > vec_defs;
-             vec_defs.create (nargs);
+             auto_vec<vec<tree> > vec_defs (nargs);
              vec<tree> vec_oprnds0;
 
              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_oprndsi.release ();
                }
-             vec_defs.release ();
              continue;
            }
 
index b1ebda44f5e17049d9f27da7f4523191a3b86f5c..03455851b0fd64f9de9048c01c06adf4b679470e 100644 (file)
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -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.
   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. */