From 4997014d846a7882f5d4103e24a47ac0eedeab06 Mon Sep 17 00:00:00 2001 From: tbsaunde Date: Fri, 20 Dec 2013 20:34:33 +0000 Subject: merge auto_vec and stack_vec git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206155 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 2 +- gcc/config/i386/i386.c | 2 +- gcc/cp/ChangeLog | 5 +++++ gcc/cp/semantics.c | 2 +- gcc/df-scan.c | 8 ++++---- gcc/function.c | 2 +- gcc/genautomata.c | 6 +++--- gcc/gimplify.c | 2 +- gcc/graphite-clast-to-gimple.c | 2 +- gcc/graphite-dependences.c | 2 +- gcc/graphite-scop-detection.c | 12 ++++++------ gcc/graphite-sese-to-poly.c | 16 ++++++++-------- gcc/hw-doloop.c | 2 +- gcc/trans-mem.c | 2 +- gcc/tree-call-cdce.c | 2 +- gcc/tree-data-ref.c | 4 ++-- gcc/tree-dfa.c | 2 +- gcc/tree-if-conv.c | 2 +- gcc/tree-inline.c | 2 +- gcc/tree-loop-distribution.c | 8 ++++---- gcc/tree-parloops.c | 6 +++--- gcc/tree-predcom.c | 2 +- gcc/tree-ssa-alias.c | 4 ++-- gcc/tree-ssa-loop-ivcanon.c | 2 +- gcc/tree-ssa-phiopt.c | 2 +- gcc/tree-ssa-threadedge.c | 2 +- gcc/tree-ssa-uncprop.c | 2 +- gcc/tree-vect-loop.c | 2 +- gcc/tree-vect-patterns.c | 2 +- gcc/tree-vect-slp.c | 2 +- gcc/tree-vect-stmts.c | 6 +++--- gcc/var-tracking.c | 6 +++--- gcc/vec.h | 41 ++++++++++++++++++++++------------------- 35 files changed, 105 insertions(+), 78 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7a8c254fb8..c6f01720c61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2013-12-20 Trevor saunders + + * vec.h (stack_vec): Convert to a templaate specialization of + auto_vec. + * config/i386/i386.c, df-scan.c, function.c, genautomata.c, + gimplify.c, graphite-clast-to-gimple.c, graphite-dependences.c, + graphite-scop-detection.c, graphite-sese-to-poly.c, hw-doloop.c, + trans-mem.c, tree-call-cdce.c, tree-data-ref.c, tree-dfa.c, + tree-if-conv.c, tree-inline.c, tree-loop-distribution.c, + tree-parloops.c, tree-predcom.c, tree-ssa-alias.c, + tree-ssa-loop-ivcanon.c, tree-ssa-phiopt.c, tree-ssa-threadedge.c, + tree-ssa-uncprop.c, tree-vect-loop.c, tree-vect-patterns.c, + tree-vect-slp.c, tree-vect-stmts.c, var-tracking.c: Adjust. + 2013-12-20 Eric Botcazou * config/arm/arm.c (arm_expand_prologue): In a nested APCS frame with diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 47279366d82..8c5ee48dbf7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-12-20 Trevor saunders + + * gcc-interface/decl.c (components_to_record): Replace stack_vec with + auto_vec. + 2013-12-12 Eric Botcazou * gcc-interface/Makefile.in (ARM linux, GNU eabi): Tweak regexp. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index a80d1a9c0af..ad129c6803c 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7010,7 +7010,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list, tree gnu_union_type, gnu_union_name; tree this_first_free_pos, gnu_variant_list = NULL_TREE; bool union_field_needs_strict_alignment = false; - stack_vec variant_types; + auto_vec variant_types; vinfo_t *gnu_variant; unsigned int variants_align = 0; unsigned int i; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1710e8c8e38..0034d3338df 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -30821,7 +30821,7 @@ ix86_generate_version_dispatcher_body (void *node_p) push_cfun (DECL_STRUCT_FUNCTION (resolver_decl)); - stack_vec fn_ver_vec; + auto_vec fn_ver_vec; for (versn_info = node_version_info->next; versn_info; versn_info = versn_info->next) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 96bc0d9e885..98022633e0f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-20 Trevor saunders + + * semantics.c (build_anon_member_initialization): Replace + stack_vec with auto_vec. + 2013-12-18 Balaji V. Iyer * parser.c (cp_parser_cilk_simd_clause_name): Changed cilk_clause_name diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 63f50fb4705..c08d53f4898 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7439,7 +7439,7 @@ build_anon_member_initialization (tree member, tree init, to build up the initializer from the outside in so that we can reuse previously built CONSTRUCTORs if this is, say, the second field in an anonymous struct. So we use a vec as a stack. */ - stack_vec fields; + auto_vec fields; do { fields.safe_push (TREE_OPERAND (member, 1)); diff --git a/gcc/df-scan.c b/gcc/df-scan.c index a35b12fbebb..a7272ce88c5 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -86,10 +86,10 @@ static HARD_REG_SET elim_reg_set; struct df_collection_rec { - stack_vec def_vec; - stack_vec use_vec; - stack_vec eq_use_vec; - stack_vec mw_vec; + auto_vec def_vec; + auto_vec use_vec; + auto_vec eq_use_vec; + auto_vec mw_vec; }; static df_ref df_null_ref_rec[1]; diff --git a/gcc/function.c b/gcc/function.c index e2d0e233e80..13e98773eb6 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4114,7 +4114,7 @@ reorder_blocks (void) if (block == NULL_TREE) return; - stack_vec block_stack; + auto_vec block_stack; /* Reset the TREE_ASM_WRITTEN bit for all blocks. */ clear_block_marks (block); diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 372ba90efc8..a66a21920a3 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -3349,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; - stack_vec alt_states; + auto_vec alt_states; for (curr_alt_state = alt_states_list; curr_alt_state != NULL; curr_alt_state = curr_alt_state->next_alt_state) @@ -5484,7 +5484,7 @@ form_ainsn_with_same_reservs (automaton_t automaton) { ainsn_t curr_ainsn; size_t i; - stack_vec last_insns; + auto_vec last_insns; for (curr_ainsn = automaton->ainsn_list; curr_ainsn != NULL; @@ -5555,7 +5555,7 @@ make_automaton (automaton_t automaton) state_t state; state_t start_state; state_t state2; - stack_vec state_stack; + auto_vec state_stack; int states_n; reserv_sets_t reservs_matter = form_reservs_matter (automaton); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 1ca847ac759..1ca4ad1bb33 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1846,7 +1846,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Create a stack of the subexpressions so later we can walk them in order from inner to outer. */ - stack_vec expr_stack; + auto_vec expr_stack; /* We can handle anything that get_inner_reference can deal with. */ for (p = expr_p; ; p = &TREE_OPERAND (*p, 0)) diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 038c4f2abb2..2b9e743e730 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -1659,7 +1659,7 @@ debug_generated_program (scop_p scop) bool gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping) { - stack_vec newivs; + auto_vec newivs; loop_p context_loop; sese region = SCOP_REGION (scop); ifsese if_region = NULL; diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index c0d769c7dd6..f16cb938b3d 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -593,7 +593,7 @@ loop_is_parallel_p (loop_p loop, bb_pbb_htab_type bb_pbb_mapping, int depth) scop_p scop; timevar_push (TV_GRAPHITE_DATA_DEPS); - stack_vec body; + auto_vec body; scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body); dependences = loop_level_carries_dependences (scop, body, depth); timevar_pop (TV_GRAPHITE_DATA_DEPS); diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index fea15e55abe..0722ab8bbbf 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -481,7 +481,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop, case GBB_LOOP_SING_EXIT_HEADER: { - stack_vec regions; + auto_vec regions; struct scopdet_info sinfo; edge exit_e = single_exit (loop); @@ -546,7 +546,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop, { /* XXX: For now we just do not join loops with multiple exits. If the exits lead to the same bb it may be possible to join the loop. */ - stack_vec regions; + auto_vec regions; vec exits = get_loop_exit_edges (loop); edge e; int i; @@ -589,7 +589,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop, } case GBB_COND_HEADER: { - stack_vec regions; + auto_vec regions; struct scopdet_info sinfo; vec dominated; int i; @@ -1192,7 +1192,7 @@ print_graphite_statistics (FILE* file, vec scops) static void limit_scops (vec *scops) { - stack_vec regions; + auto_vec regions; int i; scop_p scop; @@ -1404,7 +1404,7 @@ void build_scops (vec *scops) { struct loop *loop = current_loops->tree_root; - stack_vec regions; + auto_vec regions; canonicalize_loop_closed_ssa_form (); build_scops_1 (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), @@ -1595,7 +1595,7 @@ dot_all_scops (vec scops) DEBUG_FUNCTION void dot_scop (scop_p scop) { - stack_vec scops; + auto_vec scops; if (scop) scops.safe_push (scop); diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 66c1b6ef95e..1f54eb9816f 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -1245,7 +1245,7 @@ public: virtual void after_dom_children (basic_block); private: - stack_vec m_conditions, m_cases; + auto_vec m_conditions, m_cases; sese m_region; }; @@ -1890,7 +1890,7 @@ build_scop_drs (scop_p scop) int i, j; poly_bb_p pbb; data_reference_p dr; - stack_vec drs; + auto_vec drs; /* Remove all the PBBs that do not have data references: these basic blocks are not handled in the polyhedral representation. */ @@ -1988,7 +1988,7 @@ insert_stmts (scop_p scop, gimple stmt, gimple_seq stmts, gimple_stmt_iterator insert_gsi) { gimple_stmt_iterator gsi; - stack_vec x; + auto_vec x; gimple_seq_add_stmt (&stmts, stmt); for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -2007,7 +2007,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt) gimple_stmt_iterator gsi; tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); gimple stmt = gimple_build_assign (unshare_expr (res), var); - stack_vec x; + auto_vec x; gimple_seq_add_stmt (&stmts, stmt); for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -2062,7 +2062,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr) tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); gimple stmt = gimple_build_assign (unshare_expr (res), var); basic_block bb; - stack_vec x; + auto_vec x; gimple_seq_add_stmt (&stmts, stmt); for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) @@ -2870,7 +2870,7 @@ remove_phi (gimple phi) tree def; use_operand_p use_p; gimple_stmt_iterator gsi; - stack_vec update; + auto_vec update; unsigned int i; gimple stmt; @@ -3028,8 +3028,8 @@ rewrite_commutative_reductions_out_of_ssa_close_phi (scop_p scop, gimple close_phi) { bool res; - stack_vec in; - stack_vec out; + auto_vec in; + auto_vec out; detect_commutative_reduction (scop, close_phi, &in, &out); res = in.length () > 1; diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c index b6184a26d87..4e67760cb8b 100644 --- a/gcc/hw-doloop.c +++ b/gcc/hw-doloop.c @@ -252,7 +252,7 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg) loop->head = BRANCH_EDGE (tail_bb)->dest; loop->successor = FALLTHRU_EDGE (tail_bb)->dest; - stack_vec works; + auto_vec works; works.safe_push (loop->head); found_tail = false; diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index ba344887d91..941035bc0ba 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -4532,7 +4532,7 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone) calculate_dominance_info (CDI_DOMINATORS); d = get_cg_data (&node, true); - stack_vec queue; + auto_vec queue; new_irr = BITMAP_ALLOC (&tm_obstack); /* Scan each tm region, propagating irrevocable status through the tree. */ diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 32d0d5a93a1..5e59cad9958 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -727,7 +727,7 @@ shrink_wrap_one_built_in_call (gimple bi_call) tree bi_call_label_decl; gimple bi_call_label; - stack_vec conds; + auto_vec conds; gen_shrink_wrap_conditions (bi_call, conds, &nconds); /* This can happen if the condition generator decides diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 94c7917344a..03060201649 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4453,7 +4453,7 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt, vec *datarefs) { unsigned i; - stack_vec references; + auto_vec references; data_ref_loc *ref; bool ret = true; data_reference_p dr; @@ -4483,7 +4483,7 @@ graphite_find_data_references_in_stmt (loop_p nest, loop_p loop, gimple stmt, vec *datarefs) { unsigned i; - stack_vec references; + auto_vec references; data_ref_loc *ref; bool ret = true; data_reference_p dr; diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 302822c1f20..e014a719e5a 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -737,7 +737,7 @@ dump_enumerated_decls (FILE *file, int flags) { basic_block bb; struct walk_stmt_info wi; - stack_vec decl_list; + auto_vec decl_list; memset (&wi, '\0', sizeof (wi)); wi.info = (void *) &decl_list; diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 59404ec14e2..283f476be22 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1314,7 +1314,7 @@ if_convertible_loop_p (struct loop *loop, bool *any_mask_load_store) refs.create (5); ddrs.create (25); - stack_vec loop_nest; + auto_vec loop_nest; res = if_convertible_loop_p_1 (loop, &loop_nest, &refs, &ddrs, any_mask_load_store); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 96a480593d4..4f14e5e10b0 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -5240,7 +5240,7 @@ tree_function_versioning (tree old_decl, tree new_decl, unsigned i; struct ipa_replace_map *replace_info; basic_block old_entry_block, bb; - stack_vec init_stmts; + auto_vec init_stmts; tree vars = NULL_TREE; gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index c16e51fb7c7..c536162b5f9 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -448,7 +448,7 @@ build_rdg (vec loop_nest, control_dependences *cd) vec datarefs; /* Create the RDG vertices from the stmts of the loop nest. */ - stack_vec stmts; + auto_vec stmts; stmts_from_loop (loop_nest[0], &stmts); rdg = new_graph (stmts.length ()); datarefs.create (10); @@ -964,7 +964,7 @@ static partition_t build_rdg_partition_for_vertex (struct graph *rdg, int v) { partition_t partition = partition_alloc (NULL, NULL); - stack_vec nodes; + auto_vec nodes; unsigned i; int x; @@ -1418,7 +1418,7 @@ distribute_loop (struct loop *loop, vec stmts, int num_sccs = 1; *nb_calls = 0; - stack_vec loop_nest; + auto_vec loop_nest; if (!find_loop_nest (loop, &loop_nest)) return 0; @@ -1436,7 +1436,7 @@ distribute_loop (struct loop *loop, vec stmts, if (dump_file && (dump_flags & TDF_DETAILS)) dump_rdg (dump_file, rdg); - stack_vec partitions; + auto_vec partitions; rdg_build_partitions (rdg, stmts, &partitions); any_builtin = false; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index a56145dbebe..368a05e4441 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -424,7 +424,7 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack) /* Check for problems with dependences. If the loop can be reversed, the iterations are independent. */ - stack_vec loop_nest; + auto_vec loop_nest; datarefs.create (10); dependence_relations.create (100); if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs, @@ -752,7 +752,7 @@ static void eliminate_local_variables (edge entry, edge exit) { basic_block bb; - stack_vec body; + auto_vec body; unsigned i; gimple_stmt_iterator gsi; bool has_debug_stmt = false; @@ -1303,7 +1303,7 @@ separate_decls_in_region (edge entry, edge exit, tree type, type_name, nvar; gimple_stmt_iterator gsi; struct clsn_data clsn_data; - stack_vec body; + auto_vec body; basic_block bb; basic_block entry_bb = bb1; basic_block exit_bb = exit->dest; diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index ea31302101f..4814281fd33 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -2398,7 +2398,7 @@ tree_predictive_commoning_loop (struct loop *loop) /* Find the data references and split them into components according to their dependence relations. */ - stack_vec loop_nest; + auto_vec loop_nest; dependences.create (10); datarefs.create (10); if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs, diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e412d72a2c2..0fb4c447ab0 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -768,8 +768,8 @@ aliasing_component_refs_p (tree ref1, static bool nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2) { - stack_vec component_refs1; - stack_vec component_refs2; + auto_vec component_refs1; + auto_vec component_refs2; /* Create the stack of handled components for REF1. */ while (handled_component_p (ref1)) diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index fd4ac70821c..2533971864a 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -1171,7 +1171,7 @@ tree_unroll_loops_completely_1 (bool may_increase_size, bool unroll_outer, unsigned int tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) { - stack_vec father_stack; + auto_vec father_stack; bool changed; int iteration = 0; bool irred_invalidated = false; diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index b6bb7e9d906..390258f666b 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1874,7 +1874,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, } /* Find pairs of stores with equal LHS. */ - stack_vec then_stores, else_stores; + auto_vec then_stores, else_stores; FOR_EACH_VEC_ELT (then_datarefs, i, then_dr) { if (DR_IS_READ (then_dr)) diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index cb6accf08f4..e2eb471cb48 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -690,7 +690,7 @@ propagate_threaded_block_debug_into (basic_block dest, basic_block src) i++; } - stack_vec fewvars; + auto_vec fewvars; pointer_set_t *vars = NULL; /* If we're already starting with 3/4 of alloc_count, go for a diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c index 63a2e10472c..6318ec1911d 100644 --- a/gcc/tree-ssa-uncprop.c +++ b/gcc/tree-ssa-uncprop.c @@ -380,7 +380,7 @@ private: leading to this block. If no such edge equivalency exists, then we record NULL. These equivalences are live until we leave the dominator subtree rooted at the block where we record the equivalency. */ - stack_vec m_equiv_stack; + auto_vec m_equiv_stack; }; /* Main driver for un-cprop. */ diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index fc377477648..d13b1df85f9 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -621,7 +621,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop) { basic_block bb = loop->header; tree init, step; - stack_vec worklist; + auto_vec worklist; gimple_stmt_iterator gsi; bool double_reduc; diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 7823cc3932d..d1f8123c7a5 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -3213,7 +3213,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) gimple_stmt_iterator si; unsigned int i, j; vect_recog_func_ptr vect_recog_func; - stack_vec stmts_to_replace; + auto_vec stmts_to_replace; gimple stmt; if (dump_enabled_p ()) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 2387c0d9dfc..d1e17965165 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2029,7 +2029,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo) /* Calculate scalar cost. */ FOR_EACH_VEC_ELT (slp_instances, i, instance) { - stack_vec life; + auto_vec life; life.safe_grow_cleared (SLP_INSTANCE_GROUP_SIZE (instance)); scalar_cost += vect_bb_slp_scalar_cost (BB_VINFO_BB (bb_vinfo), SLP_INSTANCE_TREE (instance), diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 3056c2ede00..18cf5630ca2 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -629,7 +629,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) dump_printf_loc (MSG_NOTE, vect_location, "=== vect_mark_stmts_to_be_vectorized ===\n"); - stack_vec worklist; + auto_vec worklist; /* 1. Init worklist. */ for (i = 0; i < nbbs; i++) @@ -6605,8 +6605,8 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, { if (slp_node) { - stack_vec ops; - stack_vec, 4> vec_defs; + auto_vec ops; + auto_vec, 4> vec_defs; ops.safe_push (TREE_OPERAND (cond_expr, 0)); ops.safe_push (TREE_OPERAND (cond_expr, 1)); diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 8eb86bf4feb..b0d7922ce82 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -7931,7 +7931,7 @@ struct expand_loc_callback_data /* Stack of values and debug_exprs under expansion, and their children. */ - stack_vec expanding; + auto_vec expanding; /* Stack of values and debug_exprs whose expansion hit recursion cycles. They will have VALUE_RECURSED_INTO marked when added to @@ -7939,7 +7939,7 @@ struct expand_loc_callback_data resolves to a valid location. So, if the flag remains set at the end of the search, we know no valid location for this one can possibly exist. */ - stack_vec pending; + auto_vec pending; /* The maximum depth among the sub-expressions under expansion. Zero indicates no expansion so far. */ @@ -8886,7 +8886,7 @@ process_changed_values (variable_table_type htab) { int i, n; rtx val; - stack_vec changed_values_stack; + auto_vec changed_values_stack; /* Move values from changed_variables to changed_values_stack. */ changed_variables diff --git a/gcc/vec.h b/gcc/vec.h index 03455851b0f..afde351a796 100644 --- a/gcc/vec.h +++ b/gcc/vec.h @@ -1184,25 +1184,17 @@ public: }; -/* auto_vec is a sub class of vec whose storage is released when it is - destroyed. */ -template +/* auto_vec is a subclass of vec that automatically manages creating and + releasing the internal vector. If N is non zero then it has N elements of + internal storage. The default is no internal storage, and you probably only + want to ask for internal storage for vectors on the stack because if the + size of the vector is larger than the internal storage that space is wasted. + */ +template class auto_vec : public vec { 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. */ -template -class stack_vec : public vec -{ -public: - stack_vec () + auto_vec () { m_header.m_alloc = N; m_header.m_has_auto_buf = 1; @@ -1210,7 +1202,7 @@ public: this->m_vec = reinterpret_cast *> (&m_header); } - ~stack_vec () + ~auto_vec () { this->release (); } @@ -1222,6 +1214,17 @@ private: T m_data[N]; }; +/* auto_vec is a sub class of vec whose storage is released when it is + destroyed. */ +template +class auto_vec : public vec +{ +public: + auto_vec () { this->m_vec = NULL; } + auto_vec (size_t n) { this->create (n); } + ~auto_vec () { this->release (); } +}; + /* Allocate heap memory for pointer V and create the internal vector with space for NELEMS elements. If NELEMS is 0, the internal @@ -1421,7 +1424,7 @@ vec::release (void) if (using_auto_storage ()) { - static_cast *> (this)->m_header.m_num = 0; + static_cast *> (this)->m_header.m_num = 0; return; } @@ -1654,7 +1657,7 @@ vec::using_auto_storage () const return false; const vec_prefix *auto_header - = &static_cast *> (this)->m_header; + = &static_cast *> (this)->m_header; return reinterpret_cast (m_vec) == auto_header; } -- cgit v1.2.1