diff options
author | Diego Novillo <dnovillo@google.com> | 2012-11-17 21:54:30 -0500 |
---|---|---|
committer | Diego Novillo <dnovillo@gcc.gnu.org> | 2012-11-17 21:54:30 -0500 |
commit | 9771b26396c39dfaecd5a76dd359fb65d3be4cb6 (patch) | |
tree | 1b9f930d315fa3e0a5ed7fa6e27ec5bd0a3436a4 /gcc/ipa-inline-analysis.c | |
parent | 0f4119158064e271e48a14ce3f88a67e7baf14e0 (diff) | |
download | gcc-9771b26396c39dfaecd5a76dd359fb65d3be4cb6.zip gcc-9771b26396c39dfaecd5a76dd359fb65d3be4cb6.tar.gz gcc-9771b26396c39dfaecd5a76dd359fb65d3be4cb6.tar.bz2 |
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'.
This patch rewrites the old VEC macro-based interface into a new one
based on the template class 'vec'. The user-visible changes are
described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec.
I have tested the patch pretty extensively:
- Regular bootstraps on x86_64, ppc, ia64, sparc and hppa.
- Bootstraps with --enable-checking=release
- Bootstraps with --enable-checking=gc,gcac
- Basic builds on all targets (using contrib/config-list.mk).
We no longer access the vectors via VEC_* macros. The pattern is
"VEC_operation (T, A, V, args)" becomes "V.operation (args)".
The only thing I could not do is create proper ctors and dtors for the
vec class. Since these vectors are stored in unions, we
have to keep them as PODs (C++03 does not allow non-PODs in unions).
This means that creation and destruction must be explicit. There is a
new method vec<type, allocation, layout>::create() and another vec<type,
allocation, layout>::destroy() to allocate the internal vector.
For vectors that must be pointers, there is a family of free functions
that implement the operations that need to tolerate NULL vectors.
These functions all start with the prefix 'vec_safe_'. See the wiki
page for details.
The gengtype change removes the special handling for VEC() that used
to exist in gengtype. Additionally, it allows gengtype to recognize
templates of more than one argument and introduces the concept of an
undefined type (useful for template arguments that may or may not be
types).
When a TYPE_UNDEFINED is reached, gengtype will ignore it if it
happens inside a type marked with GTY((user)). Otherwise, it will
emit an error.
Finally, gengtype rejects root types marked GTY((user)) that are not
first class pointers.
2012-11-16 Diego Novillo <dnovillo@google.com>
VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec)
* vec.c (register_overhead): Convert it into
member function of vec_prefix.
(release_overhead): Likewise.
(calculate_allocation): Likewise.
(vec_heap_free): Remove.
(vec_gc_o_reserve_1): Remove.
(vec_heap_o_reserve_1): Remove.
(vec_stack_o_reserve_1): Remove.
(vec_stack_o_reserve_exact): Remove.
(register_stack_vec): New.
(stack_vec_register_index): New.
(unregister_stack_vec): New.
(vec_assert_fail): Remove.
* vec.h: Conditionally include ggc.h. Document conditional
hackery.
Update top-level documentation.
(ALONE_VEC_CHECK_INFO): Remove.
(VEC_CHECK_INFO): Remove.
(ALONE_VEC_CHECK_DECL): Remove.
(VEC_CHECK_DECL): Remove.
(ALONE_VEC_CHECK_PASS): Remove.
(VEC_CHECK_PASS): Remove.
(VEC_ASSERT): Remove.
(vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and
va_stack.
Mark fields alloc_ and num_ as protected.
(struct vec_t): Remove. Remove all function members.
(struct vl_embed): Declare.
(struct vl_ptr): Declare.
(free): Remove.
(reserve_exact): Remove.
(reserve): Remove.
(safe_splice): Remove.
(safe_push): Remove.
(safe_grow): Remove.
(safe_grow_cleared): Remove.
(safe_insert): Remove.
(DEF_VEC_I): Remove.
(DEF_VEC_ALLOC_I): Remove.
(DEF_VEC_P): Remove.
(DEF_VEC_ALLOC_P): Remove.
(DEF_VEC_O): Remove.
(DEF_VEC_ALLOC_O): Remove.
(DEF_VEC_ALLOC_P_STACK): Remove.
(DEF_VEC_ALLOC_O_STACK): Remove.
(DEF_VEC_ALLOC_I_STACK): Remove.
(DEF_VEC_A): Remove.
(DEF_VEC_ALLOC_A): Remove.
(vec_stack_p_reserve_exact_1): Remove.
(vec_stack_o_reserve): Remove.
(vec_stack_o_reserve_exact): Remove.
(VEC_length): Remove.
(VEC_empty): Remove.
(VEC_address): Remove.
(vec_address): Remove.
(VEC_last): Remove.
(VEC_index): Remove.
(VEC_iterate): Remove.
(VEC_embedded_size): Remove.
(VEC_embedded_init): Remove.
(VEC_free): Remove.
(VEC_copy): Remove.
(VEC_space): Remove.
(VEC_reserve): Remove.
(VEC_reserve_exact): Remove.
(VEC_splice): Remove.
(VEC_safe_splice): Remove.
(VEC_quick_push): Remove.
(VEC_safe_push): Remove.
(VEC_pop): Remove.
(VEC_truncate): Remove.
(VEC_safe_grow): Remove.
(VEC_replace): Remove.
(VEC_quick_insert): Remove.
(VEC_safe_insert): Remove.
(VEC_ordered_remove): Remove.
(VEC_unordered_remove): Remove.
(VEC_block_remove): Remove.
(VEC_lower_bound): Remove.
(VEC_alloc): Remove.
(VEC_qsort): Remove.
(va_heap): Declare.
(va_heap::default_layout): New typedef to vl_ptr.
(va_heap::reserve): New.
(va_heap::release): New.
(va_gc): Declare.
(va_gc::default_layout): New typedef to vl_embed.
(va_gc::reserve): New.
(va_gc::release): New.
(va_gc_atomic): Declare. Inherit from va_gc.
(va_stack): Declare.
(va_stack::default_layout): New typedef to vl_ptr.
(va_stack::alloc): New.
(va_stack::reserve): New.
(va_stack::release): New.
(register_stack_vec): Declare.
(stack_vec_register_index): Declare.
(unregister_stack_vec): Declare.
(vec<T, A = va_heap, L = typename A::default_layout>): Declare
empty vec template.
(vec<T, A, vl_embed>): Partial specialization for embedded
layout.
(vec<T, A, vl_embed>::allocated): New.
(vec<T, A, vl_embed>::length): New.
(vec<T, A, vl_embed>::is_empty): New.
(vec<T, A, vl_embed>::address): New.
(vec<T, A, vl_embed>::operator[]): New.
(vec<T, A, vl_embed>::last New.
(vec<T, A, vl_embed>::space): New.
(vec<T, A, vl_embed>::iterate): New.
(vec<T, A, vl_embed>::iterate): New.
(vec<T, A, vl_embed>::copy): New.
(vec<T, A, vl_embed>::splice): New.
(vec<T, A, vl_embed>::quick_push New.
(vec<T, A, vl_embed>::pop New.
(vec<T, A, vl_embed>::truncate): New.
(vec<T, A, vl_embed>::quick_insert): New.
(vec<T, A, vl_embed>::ordered_remove): New.
(vec<T, A, vl_embed>::unordered_remove): New.
(vec<T, A, vl_embed>::block_remove): New.
(vec<T, A, vl_embed>::qsort): New.
(vec<T, A, vl_embed>::lower_bound): New.
(vec<T, A, vl_embed>::embedded_size): New.
(vec<T, A, vl_embed>::embedded_init): New.
(vec<T, A, vl_embed>::quick_grow): New.
(vec<T, A, vl_embed>::quick_grow_cleared): New.
(vec_safe_space): New.
(vec_safe_length): New.
(vec_safe_address): New.
(vec_safe_is_empty): New.
(vec_safe_reserve): New.
(vec_safe_reserve_exact): New.
(vec_alloc): New.
(vec_free): New.
(vec_safe_grow): New.
(vec_safe_grow_cleared): New.
(vec_safe_iterate): New.
(vec_safe_push): New.
(vec_safe_insert): New.
(vec_safe_truncate): New.
(vec_safe_copy): New.
(vec_safe_splice): New.
(vec<T, A, vl_ptr>): New partial specialization for the space
efficient layout.
(vec<T, A, vl_ptr>::exists): New.
(vec<T, A, vl_ptr>::is_empty): New.
(vec<T, A, vl_ptr>::length): New.
(vec<T, A, vl_ptr>::address): New.
(vec<T, A, vl_ptr>::operator[]): New.
(vec<T, A, vl_ptr>::operator!=): New.
(vec<T, A, vl_ptr>::operator==): New.
(vec<T, A, vl_ptr>::last): New.
(vec<T, A, vl_ptr>::space): New.
(vec<T, A, vl_ptr>::iterate): New.
(vec<T, A, vl_ptr>::copy): New.
(vec<T, A, vl_ptr>::reserve): New.
(vec<T, A, vl_ptr>::reserve_exact): New.
(vec<T, A, vl_ptr>::splice): New.
(vec<T, A, vl_ptr>::safe_splice): New.
(vec<T, A, vl_ptr>::quick_push): New.
(vec<T, A, vl_ptr>::safe_push): New.
(vec<T, A, vl_ptr>::pop): New.
(vec<T, A, vl_ptr>::truncate): New.
(vec<T, A, vl_ptr>::safe_grow): New.
(vec<T, A, vl_ptr>::safe_grow_cleared): New.
(vec<T, A, vl_ptr>::quick_grow): New.
(vec<T, A, vl_ptr>::quick_grow_cleared): New.
(vec<T, A, vl_ptr>::quick_insert): New.
(vec<T, A, vl_ptr>::safe_insert): New.
(vec<T, A, vl_ptr>::ordered_remove): New.
(vec<T, A, vl_ptr>::unordered_remove): New.
(vec<T, A, vl_ptr>::block_remove): New.
(vec<T, A, vl_ptr>::qsort): New.
(vec<T, A, vl_ptr>::lower_bound): New.
(vec_stack_alloc): Define.
(FOR_EACH_VEC_SAFE_ELT): Define.
* vecir.h: Remove. Update all users.
* vecprim.h: Remove. Update all users.
Move uchar to coretypes.h.
* Makefile.in (VEC_H): Add $(GGC_H).
Remove vecir.h and vecprim.h dependencies everywhere.
2012-11-16 Diego Novillo <dnovillo@google.com>
* gengtype-lex.l (VEC): Remove.
Add characters in the set [\!\>\.-].
* gengtype-parse.c (token_names): Remove "VEC".
(require_template_declaration): Remove handling of VEC_TOKEN.
(type): Likewise.
Call create_user_defined_type when parsing GTY((user)).
* gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED.
(write_state_undefined_type): New.
(write_state_type): Call write_state_undefined_type for
TYPE_UNDEFINED.
(read_state_type): Call read_state_undefined_type for
TYPE_UNDEFINED.
* gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED.
(create_user_defined_type): Make extern.
(type_for_name): Factor out of resolve_typedef.
(create_undefined_type): New
(resolve_typedef): Call it when we cannot find a previous
typedef and the type is not a template.
(find_structure): Accept TYPE_UNDEFINED.
(set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES,
default to false.
Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or
ALLOWED_UNDEFINED_TYPES is set.
Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT.
(filter_type_name): Accept templates with more than one
argument.
(output_mangled_typename): Handle TYPE_UNDEFINED
(walk_type): Likewise.
(write_types_process_field): Likewise.
(write_func_for_structure): If CHAIN_NEXT is set, ORIG_S
should not be a user-defined type.
(write_types_local_user_process_field): Handle TYPE_ARRAY,
TYPE_NONE and TYPE_UNDEFINED.
(write_types_local_process_field): Likewise.
(contains_scalar_p): Return 0 for TYPE_USER_STRUCT.
(write_root): Reject user-defined types that are not pointers.
Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT
and TYPE_PARAM_STRUCT.
(output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and
TYPE_ARRAY.
(dump_typekind): Handle TYPE_UNDEFINED.
* gengtype.h (enum typekind): Add TYPE_UNDEFINED.
(create_user_defined_type): Declare.
(enum gty_token): Remove VEC_TOKEN.
2012-11-16 Diego Novillo <dnovillo@google.com>
Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec)
* coretypes.h (uchar): Define.
* alias.c: Use new vec API in vec.h.
* asan.c: Likewise.
* attribs.c: Likewise.
* basic-block.h: Likewise.
* bb-reorder.c: Likewise.
* builtins.c: Likewise.
* calls.c: Likewise.
* cfg.c: Likewise.
* cfganal.c: Likewise.
* cfgcleanup.c: Likewise.
* cfgexpand.c: Likewise.
* cfghooks.c: Likewise.
* cfghooks.h: Likewise.
* cfgloop.c: Likewise.
* cfgloop.h: Likewise.
* cfgloopanal.c: Likewise.
* cfgloopmanip.c: Likewise.
* cfgrtl.c: Likewise.
* cgraph.c: Likewise.
* cgraph.h: Likewise.
* cgraphclones.c: Likewise.
* cgraphunit.c: Likewise.
* combine.c: Likewise.
* compare-elim.c: Likewise.
* coverage.c: Likewise.
* cprop.c: Likewise.
* data-streamer.h: Likewise.
* dbxout.c: Likewise.
* dce.c: Likewise.
* df-core.c: Likewise.
* df-problems.c: Likewise.
* df-scan.c: Likewise.
* dominance.c: Likewise.
* domwalk.c: Likewise.
* domwalk.h: Likewise.
* dse.c: Likewise.
* dwarf2cfi.c: Likewise.
* dwarf2out.c: Likewise.
* dwarf2out.h: Likewise.
* emit-rtl.c: Likewise.
* except.c: Likewise.
* except.h: Likewise.
* expr.c: Likewise.
* expr.h: Likewise.
* final.c: Likewise.
* fold-const.c: Likewise.
* function.c: Likewise.
* function.h: Likewise.
* fwprop.c: Likewise.
* gcc.c: Likewise.
* gcse.c: Likewise.
* genattr.c: Likewise.
* genattrtab.c: Likewise.
* genautomata.c: Likewise.
* genextract.c: Likewise.
* genopinit.c: Likewise
* ggc-common.c: Likewise.
* ggc.h: Likewise.
* gimple-low.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* gimple-streamer-in.c: Likewise.
* gimple.c: Likewise.
* gimple.h: Likewise.
* gimplify.c: Likewise.
* graph.c: Likewise.
* graphds.c: Likewise.
* graphds.h: Likewise.
* graphite-blocking.c: Likewise.
* graphite-clast-to-gimple.c: Likewise.
* graphite-dependences.c: Likewise.
* graphite-interchange.c: Likewise.
* graphite-optimize-isl.c: Likewise.
* graphite-poly.c: Likewise.
* graphite-poly.h: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-scop-detection.h: Likewise.
* graphite-sese-to-poly.c: Likewise.
* graphite.c: Likewise.
* godump.c: Likewise.
* haifa-sched.c: Likewise.
* hw-doloop.c: Likewise.
* hw-doloop.h: Likewise.
* ifcvt.c: Likewise.
* insn-addr.h: Likewise.
* ipa-cp.c: Likewise.
* ipa-inline-analysis.c: Likewise.
* ipa-inline-transform.c: Likewise.
* ipa-inline.c: Likewise.
* ipa-inline.h: Likewise.
* ipa-prop.c: Likewise.
* ipa-prop.h: Likewise.
* ipa-pure-const.c: Likewise.
* ipa-ref-inline.h: Likewise.
* ipa-ref.c: Likewise.
* ipa-ref.h: Likewise.
* ipa-reference.c: Likewise.
* ipa-split.c: Likewise.
* ipa-utils.c: Likewise.
* ipa-utils.h: Likewise.
* ipa.c: Likewise.
* ira-build.c: Likewise.
* ira-color.c: Likewise.
* ira-emit.c: Likewise.
* ira-int.h: Likewise.
* ira.c: Likewise.
* loop-invariant.c: Likewise.
* loop-unroll.c: Likewise.
* lower-subreg.c: Likewise.
* lra-lives.c: Likewise.
* lra.c: Likewise.
* lto-cgraph.c: Likewise.
* lto-section-out.c: Likewise.
* lto-streamer-in.c: Likewise.
* lto-streamer-out.c: Likewise.
* lto-streamer.h: Likewise.
* lto-symtab.c: Likewise.
* mcf.c: Likewise.
* modulo-sched.c: Likewise.
* omp-low.c: Likewise.
* opts-common.c: Likewise.
* opts-global.c: Likewise.
* opts.c: Likewise.
* opts.h: Likewise.
* passes.c: Likewise.
* predict.c: Likewise.
* print-tree.c: Likewise.
* profile.c: Likewise.
* profile.h: Likewise.
* read-rtl.c: Likewise.
* ree.c: Likewise.
* reg-stack.c: Likewise.
* regrename.c: Likewise.
* regrename.h: Likewise.
* reload.c: Likewise.
* reload.h: Likewise.
* reload1.c: Likewise.
* rtl.h: Likewise.
* sched-deps.c: Likewise.
* sched-int.h: Likewise.
* sdbout.c: Likewise.
* sel-sched-dump.c: Likewise.
* sel-sched-ir.c: Likewise.
* sel-sched-ir.h: Likewise.
* sel-sched.c: Likewise.
* sese.c: Likewise.
* sese.h: Likewise.
* statistics.h: Likewise.
* stmt.c: Likewise.
* stor-layout.c: Likewise.
* store-motion.c: Likewise.
* tlink.c: Likewise.
* toplev.c: Likewise.
* trans-mem.c: Likewise.
* tree-browser.c: Likewise.
* tree-call-cdce.c: Likewise.
* tree-cfg.c: Likewise.
* tree-cfgcleanup.c: Likewise.
* tree-chrec.c: Likewise.
* tree-chrec.h: Likewise.
* tree-complex.c: Likewise.
* tree-data-ref.c: Likewise.
* tree-data-ref.h: Likewise.
* tree-dfa.c: Likewise.
* tree-diagnostic.c: Likewise.
* tree-dump.c: Likewise.
* tree-eh.c: Likewise.
* tree-emutls.c: Likewise.
* tree-flow.h: Likewise.
* tree-if-conv.c: Likewise.
* tree-inline.c: Likewise.
* tree-inline.h: Likewise.
* tree-into-ssa.c: Likewise.
* tree-iterator.c: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-mudflap.c: Likewise.
* tree-optimize.c: Likewise.
* tree-outof-ssa.c: Likewise.
* tree-parloops.c: Likewise.
* tree-phinodes.c: Likewise.
* tree-predcom.c: Likewise.
* tree-pretty-print.c: Likewise.
* tree-scalar-evolution.c: Likewise.
* tree-sra.c: Likewise.
* tree-ssa-address.c: Likewise.
* tree-ssa-alias.c: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-coalesce.c: Likewise.
* tree-ssa-dce.c: Likewise.
* tree-ssa-dom.c: Likewise.
* tree-ssa-forwprop.c: Likewise.
* tree-ssa-live.c: Likewise.
* tree-ssa-live.h: Likewise.
* tree-ssa-loop-im.c: Likewise.
* tree-ssa-loop-ivcanon.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-ssa-loop-prefetch.c: Likewise.
* tree-ssa-math-opts.c: Likewise.
* tree-ssa-operands.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* tree-ssa-reassoc.c: Likewise.
* tree-ssa-sccvn.c: Likewise.
* tree-ssa-sccvn.h: Likewise.
* tree-ssa-strlen.c: Likewise.
* tree-ssa-structalias.c: Likewise.
* tree-ssa-tail-merge.c: Likewise.
* tree-ssa-threadedge.c: Likewise.
* tree-ssa-threadupdate.c: Likewise.
* tree-ssa-uncprop.c: Likewise.
* tree-ssa-uninit.c: Likewise.
* tree-ssa.c: Likewise.
* tree-ssanames.c: Likewise.
* tree-stdarg.c: Likewise.
* tree-streamer-in.c: Likewise.
* tree-streamer-out.c: Likewise.
* tree-streamer.c: Likewise.
* tree-streamer.h: Likewise.
* tree-switch-conversion.c: Likewise.
* tree-vect-data-refs.c: Likewise.
* tree-vect-generic.c: Likewise.
* tree-vect-loop-manip.c: Likewise.
* tree-vect-loop.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-vect-slp.c: Likewise.
* tree-vect-stmts.c: Likewise.
* tree-vectorizer.c: Likewise.
* tree-vectorizer.h: Likewise.
* tree-vrp.c: Likewise.
* tree.c: Likewise.
* tree.h: Likewise.
* value-prof.c: Likewise.
* value-prof.h: Likewise.
* var-tracking.c: Likewise.
* varasm.c: Likewise.
* varpool.c: Likewise.
* vmsdbgout.c: Likewise.
* config/bfin/bfin.c: Likewise.
* config/c6x/c6x.c: Likewise.
* config/darwin.c: Likewise.
* config/i386/i386.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/mep/mep.c: Likewise.
* config/mips/mips.c: Likewise.
* config/pa/pa.c: Likewise.
* config/rs6000/rs6000-c.c: Likewise.
* config/rs6000/rs6000.c: Likewise.
* config/rx/rx.c: Likewise.
* config/spu/spu-c.c: Likewise.
* config/vms/vms.c: Likewise.
* config/vxworks.c: Likewise.
* config/epiphany/resolve-sw-modes.c: Likewise.
From-SVN: r193595
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r-- | gcc/ipa-inline-analysis.c | 512 |
1 files changed, 227 insertions, 285 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index f7b3af1..61fb48d 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -132,12 +132,12 @@ static void inline_edge_duplication_hook (struct cgraph_edge *, /* VECtor holding inline summaries. In GGC memory because conditions might point to constant trees. */ -VEC(inline_summary_t,gc) *inline_summary_vec; -VEC(inline_edge_summary_t,heap) *inline_edge_summary_vec; +vec<inline_summary_t, va_gc> *inline_summary_vec; +vec<inline_edge_summary_t> inline_edge_summary_vec; /* Cached node/edge growths. */ -VEC(int,heap) *node_growth_cache; -VEC(edge_growth_cache_entry,heap) *edge_growth_cache; +vec<int> node_growth_cache; +vec<edge_growth_cache_entry> edge_growth_cache; /* Edge predicates goes here. */ static alloc_pool edge_predicate_pool; @@ -247,7 +247,7 @@ add_condition (struct inline_summary *summary, int operand_num, } gcc_checking_assert (operand_num >= 0); - for (i = 0; VEC_iterate (condition, summary->conds, i, c); i++) + for (i = 0; vec_safe_iterate (summary->conds, i, &c); i++) { if (c->operand_num == operand_num && c->code == code @@ -266,7 +266,7 @@ add_condition (struct inline_summary *summary, int operand_num, new_cond.agg_contents = agg_contents; new_cond.by_ref = by_ref; new_cond.offset = offset; - VEC_safe_push (condition, gc, summary->conds, new_cond); + vec_safe_push (summary->conds, new_cond); return single_cond_predicate (i + predicate_first_dynamic_condition); } @@ -333,9 +333,7 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause) condition *cc1; if (!(clause & (1 << c1))) continue; - cc1 = &VEC_index (condition, - conditions, - c1 - predicate_first_dynamic_condition); + cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition]; /* We have no way to represent !CHANGED and !IS_NOT_CONSTANT and thus there is no point for looking for them. */ if (cc1->code == CHANGED @@ -344,12 +342,8 @@ add_clause (conditions conditions, struct predicate *p, clause_t clause) for (c2 = c1 + 1; c2 <= NUM_CONDITIONS; c2++) if (clause & (1 << c2)) { - condition *cc1 = &VEC_index (condition, - conditions, - c1 - predicate_first_dynamic_condition); - condition *cc2 = &VEC_index (condition, - conditions, - c2 - predicate_first_dynamic_condition); + condition *cc1 = &(*conditions)[c1 - predicate_first_dynamic_condition]; + condition *cc2 = &(*conditions)[c2 - predicate_first_dynamic_condition]; if (cc1->operand_num == cc2->operand_num && cc1->val == cc2->val && cc2->code != IS_NOT_CONSTANT @@ -483,7 +477,7 @@ evaluate_predicate (struct predicate *p, clause_t possible_truths) static int predicate_probability (conditions conds, struct predicate *p, clause_t possible_truths, - VEC (inline_param_summary_t, heap) *inline_param_summary) + vec<inline_param_summary_t> inline_param_summary) { int i; int combined_prob = REG_BR_PROB_BASE; @@ -507,24 +501,19 @@ predicate_probability (conditions conds, { int this_prob = 0; int i2; - if (!inline_param_summary) + if (!inline_param_summary.exists ()) return REG_BR_PROB_BASE; for (i2 = 0; i2 < NUM_CONDITIONS; i2++) if ((p->clause[i] & possible_truths) & (1 << i2)) { if (i2 >= predicate_first_dynamic_condition) { - condition *c = &VEC_index - (condition, conds, - i2 - predicate_first_dynamic_condition); + condition *c = &(*conds)[i2 - predicate_first_dynamic_condition]; if (c->code == CHANGED && (c->operand_num - < (int) VEC_length (inline_param_summary_t, - inline_param_summary))) + < (int) inline_param_summary.length ())) { - int iprob = VEC_index (inline_param_summary_t, - inline_param_summary, - c->operand_num).change_prob; + int iprob = inline_param_summary[c->operand_num].change_prob; this_prob = MAX (this_prob, iprob); } else @@ -554,8 +543,7 @@ dump_condition (FILE *f, conditions conditions, int cond) fprintf (f, "not inlined"); else { - c = &VEC_index (condition, conditions, - cond - predicate_first_dynamic_condition); + c = &(*conditions)[cond - predicate_first_dynamic_condition]; fprintf (f, "op%i", c->operand_num); if (c->agg_contents) fprintf (f, "[%soffset: " HOST_WIDE_INT_PRINT_DEC "]", @@ -691,7 +679,7 @@ account_size_time (struct inline_summary *summary, int size, int time, time = MAX_TIME * INLINE_TIME_SCALE; gcc_assert (time >= 0); - for (i = 0; VEC_iterate (size_time_entry, summary->entry, i, e); i++) + for (i = 0; vec_safe_iterate (summary->entry, i, &e); i++) if (predicates_equal_p (&e->predicate, pred)) { found = true; @@ -701,7 +689,7 @@ account_size_time (struct inline_summary *summary, int size, int time, { i = 0; found = true; - e = &VEC_index (size_time_entry, summary->entry, 0); + e = &(*summary->entry)[0]; gcc_assert (!e->predicate.clause[0]); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "\t\tReached limit on number of entries, ignoring the predicate."); @@ -720,7 +708,7 @@ account_size_time (struct inline_summary *summary, int size, int time, new_entry.size = size; new_entry.time = time; new_entry.predicate = *pred; - VEC_safe_push (size_time_entry, gc, summary->entry, new_entry); + vec_safe_push (summary->entry, new_entry); } else { @@ -782,15 +770,15 @@ set_hint_predicate (struct predicate **p, struct predicate new_predicate) static clause_t evaluate_conditions_for_known_args (struct cgraph_node *node, bool inline_p, - VEC (tree, heap) *known_vals, - VEC (ipa_agg_jump_function_p, heap) *known_aggs) + vec<tree> known_vals, + vec<ipa_agg_jump_function_p> known_aggs) { clause_t clause = inline_p ? 0 : 1 << predicate_not_inlined_condition; struct inline_summary *info = inline_summary (node); int i; struct condition *c; - for (i = 0; VEC_iterate (condition, info->conds, i, c); i++) + for (i = 0; vec_safe_iterate (info->conds, i, &c); i++) { tree val; tree res; @@ -799,11 +787,9 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, (especially for K&R style programs). So bound check here (we assume known_aggs vector, if non-NULL, has the same length as known_vals). */ - gcc_checking_assert (!known_aggs - || (VEC_length (tree, known_vals) - == VEC_length (ipa_agg_jump_function_p, - known_aggs))); - if (c->operand_num >= (int) VEC_length (tree, known_vals)) + gcc_checking_assert (!known_aggs.exists () + || (known_vals.length () == known_aggs.length ())); + if (c->operand_num >= (int) known_vals.length ()) { clause |= 1 << (i + predicate_first_dynamic_condition); continue; @@ -815,14 +801,13 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, if (c->code == CHANGED && !c->by_ref - && (VEC_index (tree, known_vals, c->operand_num) + && (known_vals[c->operand_num] == error_mark_node)) continue; - if (known_aggs) + if (known_aggs.exists ()) { - agg = VEC_index (ipa_agg_jump_function_p, known_aggs, - c->operand_num); + agg = known_aggs[c->operand_num]; val = ipa_find_agg_cst_for_param (agg, c->offset, c->by_ref); } else @@ -830,7 +815,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, } else { - val = VEC_index (tree, known_vals, c->operand_num); + val = known_vals[c->operand_num]; if (val == error_mark_node && c->code != CHANGED) val = NULL_TREE; } @@ -856,26 +841,28 @@ evaluate_conditions_for_known_args (struct cgraph_node *node, static void evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, - clause_t *clause_ptr, - VEC (tree, heap) **known_vals_ptr, - VEC (tree, heap) **known_binfos_ptr, - VEC (ipa_agg_jump_function_p, heap) **known_aggs_ptr) + clause_t *clause_ptr, + vec<tree> *known_vals_ptr, + vec<tree> *known_binfos_ptr, + vec<ipa_agg_jump_function_p> *known_aggs_ptr) { struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL); struct inline_summary *info = inline_summary (callee); - VEC (tree, heap) *known_vals = NULL; - VEC (ipa_agg_jump_function_p, heap) *known_aggs = NULL; + vec<tree> known_vals = vec<tree>(); + vec<ipa_agg_jump_function_p> known_aggs + = vec<ipa_agg_jump_function_p>(); if (clause_ptr) *clause_ptr = inline_p ? 0 : 1 << predicate_not_inlined_condition; if (known_vals_ptr) - *known_vals_ptr = NULL; + known_vals_ptr->create (0); if (known_binfos_ptr) - *known_binfos_ptr = NULL; + known_binfos_ptr->create (0); - if (ipa_node_params_vector + if (ipa_node_params_vector.exists () && !e->call_stmt_cannot_inline_p - && ((clause_ptr && info->conds) || known_vals_ptr || known_binfos_ptr)) + && ((clause_ptr && info->conds) + || known_vals_ptr || known_binfos_ptr)) { struct ipa_node_params *parms_info; struct ipa_edge_args *args = IPA_EDGE_REF (e); @@ -888,12 +875,11 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, parms_info = IPA_NODE_REF (e->caller); if (count && (info->conds || known_vals_ptr)) - VEC_safe_grow_cleared (tree, heap, known_vals, count); + known_vals.safe_grow_cleared (count); if (count && (info->conds || known_aggs_ptr)) - VEC_safe_grow_cleared (ipa_agg_jump_function_p, heap, known_aggs, - count); + known_aggs.safe_grow_cleared (count); if (count && known_binfos_ptr) - VEC_safe_grow_cleared (tree, heap, *known_binfos_ptr, count); + known_binfos_ptr->safe_grow_cleared (count); for (i = 0; i < count; i++) { @@ -901,20 +887,17 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, tree cst = ipa_value_from_jfunc (parms_info, jf); if (cst) { - if (known_vals && TREE_CODE (cst) != TREE_BINFO) - VEC_replace (tree, known_vals, i, cst); + if (known_vals.exists () && TREE_CODE (cst) != TREE_BINFO) + known_vals[i] = cst; else if (known_binfos_ptr != NULL && TREE_CODE (cst) == TREE_BINFO) - VEC_replace (tree, *known_binfos_ptr, i, cst); + (*known_binfos_ptr)[i] = cst; } - else if (inline_p - && !VEC_index (inline_param_summary_t, - es->param, - i).change_prob) - VEC_replace (tree, known_vals, i, error_mark_node); + else if (inline_p && !es->param[i].change_prob) + known_vals[i] = error_mark_node; /* TODO: When IPA-CP starts propagating and merging aggregate jump functions, use its knowledge of the caller too, just like the scalar case above. */ - VEC_replace (ipa_agg_jump_function_p, known_aggs, i, &jf->agg); + known_aggs[i] = &jf->agg; } } @@ -925,12 +908,12 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p, if (known_vals_ptr) *known_vals_ptr = known_vals; else - VEC_free (tree, heap, known_vals); + known_vals.release (); if (known_aggs_ptr) *known_aggs_ptr = known_aggs; else - VEC_free (ipa_agg_jump_function_p, heap, known_aggs); + known_aggs.release (); } @@ -952,14 +935,10 @@ inline_summary_alloc (void) edge_duplication_hook_holder = cgraph_add_edge_duplication_hook (&inline_edge_duplication_hook, NULL); - if (VEC_length (inline_summary_t, inline_summary_vec) - <= (unsigned) cgraph_max_uid) - VEC_safe_grow_cleared (inline_summary_t, gc, - inline_summary_vec, cgraph_max_uid + 1); - if (VEC_length (inline_edge_summary_t, inline_edge_summary_vec) - <= (unsigned) cgraph_edge_max_uid) - VEC_safe_grow_cleared (inline_edge_summary_t, heap, - inline_edge_summary_vec, cgraph_edge_max_uid + 1); + if (vec_safe_length (inline_summary_vec) <= (unsigned) cgraph_max_uid) + vec_safe_grow_cleared (inline_summary_vec, cgraph_max_uid + 1); + if (inline_edge_summary_vec.length () <= (unsigned) cgraph_edge_max_uid) + inline_edge_summary_vec.safe_grow_cleared (cgraph_edge_max_uid + 1); if (!edge_predicate_pool) edge_predicate_pool = create_alloc_pool ("edge predicates", sizeof (struct predicate), @@ -972,8 +951,7 @@ inline_summary_alloc (void) static void reset_inline_edge_summary (struct cgraph_edge *e) { - if (e->uid - < (int)VEC_length (inline_edge_summary_t, inline_edge_summary_vec)) + if (e->uid < (int)inline_edge_summary_vec.length ()) { struct inline_edge_summary *es = inline_edge_summary (e); @@ -981,7 +959,7 @@ reset_inline_edge_summary (struct cgraph_edge *e) if (es->predicate) pool_free (edge_predicate_pool, es->predicate); es->predicate = NULL; - VEC_free (inline_param_summary_t, heap, es->param); + es->param.release (); } } @@ -1017,8 +995,8 @@ reset_inline_summary (struct cgraph_node *node) pool_free (edge_predicate_pool, info->array_index); info->array_index = NULL; } - VEC_free (condition, gc, info->conds); - VEC_free (size_time_entry,gc, info->entry); + vec_free (info->conds); + vec_free (info->entry); for (e = node->callees; e; e = e->next_callee) reset_inline_edge_summary (e); for (e = node->indirect_calls; e; e = e->next_callee) @@ -1031,8 +1009,7 @@ static void inline_node_removal_hook (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) { struct inline_summary *info; - if (VEC_length (inline_summary_t, inline_summary_vec) - <= (unsigned)node->uid) + if (vec_safe_length (inline_summary_vec) <= (unsigned)node->uid) return; info = inline_summary (node); reset_inline_summary (node); @@ -1099,16 +1076,17 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, sizeof (struct inline_summary)); /* TODO: as an optimization, we may avoid copying conditions that are known to be false or true. */ - info->conds = VEC_copy (condition, gc, info->conds); + info->conds = vec_safe_copy (info->conds); /* When there are any replacements in the function body, see if we can figure out that something was optimized out. */ - if (ipa_node_params_vector && dst->clone.tree_map) + if (ipa_node_params_vector.exists () + && dst->clone.tree_map) { - VEC(size_time_entry,gc) *entry = info->entry; + vec<size_time_entry, va_gc> *entry = info->entry; /* Use SRC parm info since it may not be copied yet. */ struct ipa_node_params *parms_info = IPA_NODE_REF (src); - VEC (tree, heap) *known_vals = NULL; + vec<tree> known_vals = vec<tree>(); int count = ipa_get_param_count (parms_info); int i,j; clause_t possible_truths; @@ -1119,28 +1097,27 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, struct cgraph_edge *edge; info->entry = 0; - VEC_safe_grow_cleared (tree, heap, known_vals, count); + known_vals.safe_grow_cleared (count); for (i = 0; i < count; i++) { tree t = ipa_get_param (parms_info, i); struct ipa_replace_map *r; - for (j = 0; - VEC_iterate (ipa_replace_map_p, dst->clone.tree_map, j, r); - j++) + for (j = 0; vec_safe_iterate (dst->clone.tree_map, j, &r); j++) { if (r->old_tree == t && r->replace_p && !r->ref_p) { - VEC_replace (tree, known_vals, i, r->new_tree); + known_vals[i] = r->new_tree; break; } } } possible_truths = evaluate_conditions_for_known_args (dst, false, - known_vals, NULL); - VEC_free (tree, heap, known_vals); + known_vals, + vec<ipa_agg_jump_function_p>()); + known_vals.release (); account_size_time (info, 0, 0, &true_pred); @@ -1149,7 +1126,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, to be false. TODO: as on optimization, we can also eliminate conditions known to be true. */ - for (i = 0; VEC_iterate (size_time_entry, entry, i, e); i++) + for (i = 0; vec_safe_iterate (entry, i, &e); i++) { struct predicate new_predicate; new_predicate = remap_predicate_after_duplication (&e->predicate, @@ -1224,7 +1201,7 @@ inline_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst, } else { - info->entry = VEC_copy (size_time_entry, gc, info->entry); + info->entry = vec_safe_copy (info->entry); if (info->loop_iterations) { predicate p = *info->loop_iterations; @@ -1263,7 +1240,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, sizeof (struct inline_edge_summary)); info->predicate = NULL; edge_set_predicate (dst, srcinfo->predicate); - info->param = VEC_copy (inline_param_summary_t, heap, srcinfo->param); + info->param = srcinfo->param.copy (); } @@ -1272,7 +1249,7 @@ inline_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst, static void inline_edge_removal_hook (struct cgraph_edge *edge, void *data ATTRIBUTE_UNUSED) { - if (edge_growth_cache) + if (edge_growth_cache.exists ()) reset_edge_growth_cache (edge); reset_inline_edge_summary (edge); } @@ -1284,10 +1261,9 @@ void initialize_growth_caches (void) { if (cgraph_edge_max_uid) - VEC_safe_grow_cleared (edge_growth_cache_entry, heap, edge_growth_cache, - cgraph_edge_max_uid); + edge_growth_cache.safe_grow_cleared (cgraph_edge_max_uid); if (cgraph_max_uid) - VEC_safe_grow_cleared (int, heap, node_growth_cache, cgraph_max_uid); + node_growth_cache.safe_grow_cleared (cgraph_max_uid); } @@ -1296,10 +1272,8 @@ initialize_growth_caches (void) void free_growth_caches (void) { - VEC_free (edge_growth_cache_entry, heap, edge_growth_cache); - edge_growth_cache = 0; - VEC_free (int, heap, node_growth_cache); - node_growth_cache = 0; + edge_growth_cache.release (); + node_growth_cache.release (); } @@ -1337,12 +1311,10 @@ dump_inline_edge_summary (FILE * f, int indent, struct cgraph_node *node, } else fprintf (f, "\n"); - if (es->param) - for (i = 0; i < (int)VEC_length (inline_param_summary_t, es->param); - i++) + if (es->param.exists ()) + for (i = 0; i < (int)es->param.length (); i++) { - int prob = VEC_index (inline_param_summary_t, - es->param, i).change_prob; + int prob = es->param[i].change_prob; if (!prob) fprintf (f, "%*s op%i is compile time invariant\n", @@ -1413,9 +1385,7 @@ dump_inline_summary (FILE * f, struct cgraph_node *node) if (s->scc_no) fprintf (f, " In SCC: %i\n", (int) s->scc_no); - for (i = 0; - VEC_iterate (size_time_entry, s->entry, i, e); - i++) + for (i = 0; vec_safe_iterate (s->entry, i, &e); i++) { fprintf (f, " size:%f, time:%f, predicate:", (double) e->size / INLINE_SIZE_SCALE, @@ -1922,8 +1892,6 @@ compute_bb_predicates (struct cgraph_node *node, /* We keep info about constantness of SSA names. */ typedef struct predicate predicate_t; -DEF_VEC_O (predicate_t); -DEF_VEC_ALLOC_O (predicate_t, heap); /* Return predicate specifying when the STMT might have result that is not a compile time constant. */ @@ -1931,7 +1899,7 @@ static struct predicate will_be_nonconstant_expr_predicate (struct ipa_node_params *info, struct inline_summary *summary, tree expr, - VEC (predicate_t, heap) *nonconstant_names) + vec<predicate_t> nonconstant_names) { tree parm; int index; @@ -1946,8 +1914,7 @@ will_be_nonconstant_expr_predicate (struct ipa_node_params *info, if (is_gimple_min_invariant (expr)) return false_predicate (); if (TREE_CODE (expr) == SSA_NAME) - return VEC_index (predicate_t, nonconstant_names, - SSA_NAME_VERSION (expr)); + return nonconstant_names[SSA_NAME_VERSION (expr)]; if (BINARY_CLASS_P (expr) || COMPARISON_CLASS_P (expr)) { @@ -1997,7 +1964,7 @@ static struct predicate will_be_nonconstant_predicate (struct ipa_node_params *info, struct inline_summary *summary, gimple stmt, - VEC (predicate_t, heap) *nonconstant_names) + vec<predicate_t> nonconstant_names) { struct predicate p = true_predicate (); ssa_op_iter iter; @@ -2047,8 +2014,7 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, return p; /* If we know when operand is constant, we still can say something useful. */ - if (!true_predicate_p (&VEC_index (predicate_t, nonconstant_names, - SSA_NAME_VERSION (use)))) + if (!true_predicate_p (&nonconstant_names[SSA_NAME_VERSION (use)])) continue; return p; } @@ -2071,14 +2037,13 @@ will_be_nonconstant_predicate (struct ipa_node_params *info, continue; } else - p = VEC_index (predicate_t, nonconstant_names, - SSA_NAME_VERSION (use)); + p = nonconstant_names[SSA_NAME_VERSION (use)]; op_non_const = or_predicates (summary->conds, &p, &op_non_const); } if (gimple_code (stmt) == GIMPLE_ASSIGN && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME) - VEC_replace (predicate_t, nonconstant_names, - SSA_NAME_VERSION (gimple_assign_lhs (stmt)), op_non_const); + nonconstant_names[SSA_NAME_VERSION (gimple_assign_lhs (stmt))] + = op_non_const; return op_non_const; } @@ -2200,7 +2165,7 @@ static bool phi_result_unknown_predicate (struct ipa_node_params *info, struct inline_summary *summary, basic_block bb, struct predicate *p, - VEC (predicate_t, heap) *nonconstant_names) + vec<predicate_t> nonconstant_names) { edge e; edge_iterator ei; @@ -2259,7 +2224,7 @@ phi_result_unknown_predicate (struct ipa_node_params *info, static void predicate_for_phi_result (struct inline_summary *summary, gimple phi, struct predicate *p, - VEC (predicate_t, heap) *nonconstant_names) + vec<predicate_t> nonconstant_names) { unsigned i; @@ -2270,8 +2235,7 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi, { gcc_assert (TREE_CODE (arg) == SSA_NAME); *p = or_predicates (summary->conds, p, - &VEC_index (predicate_t, nonconstant_names, - SSA_NAME_VERSION (arg))); + &nonconstant_names[SSA_NAME_VERSION (arg)]); if (true_predicate_p (p)) return; } @@ -2282,15 +2246,14 @@ predicate_for_phi_result (struct inline_summary *summary, gimple phi, fprintf (dump_file, "\t\tphi predicate: "); dump_predicate (dump_file, summary->conds, p); } - VEC_replace (predicate_t, nonconstant_names, - SSA_NAME_VERSION (gimple_phi_result (phi)), *p); + nonconstant_names[SSA_NAME_VERSION (gimple_phi_result (phi))] = *p; } /* Return predicate specifying when array index in access OP becomes non-constant. */ static struct predicate array_index_predicate (struct inline_summary *info, - VEC (predicate_t, heap) *nonconstant_names, tree op) + vec<predicate_t> nonconstant_names, tree op) { struct predicate p = false_predicate (); while (handled_component_p (op)) @@ -2300,8 +2263,8 @@ array_index_predicate (struct inline_summary *info, { if (TREE_CODE (TREE_OPERAND (op, 1)) == SSA_NAME) p = or_predicates (info->conds, &p, - &VEC_index (predicate_t, nonconstant_names, - SSA_NAME_VERSION (TREE_OPERAND (op, 1)))); + &nonconstant_names[ + SSA_NAME_VERSION (TREE_OPERAND (op, 1))]); } op = TREE_OPERAND (op, 0); } @@ -2327,24 +2290,23 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) struct inline_summary *info = inline_summary (node); struct predicate bb_predicate; struct ipa_node_params *parms_info = NULL; - VEC (predicate_t, heap) *nonconstant_names = NULL; + vec<predicate_t> nonconstant_names = vec<predicate_t>(); int nblocks, n; int *order; predicate array_index = true_predicate (); - info->conds = 0; - info->entry = 0; + info->conds = NULL; + info->entry = NULL; if (optimize && !early) { calculate_dominance_info (CDI_DOMINATORS); loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS); - if (ipa_node_params_vector) + if (ipa_node_params_vector.exists ()) { parms_info = IPA_NODE_REF (node); - VEC_safe_grow_cleared (predicate_t, heap, nonconstant_names, - VEC_length (tree, SSANAMES (my_function))); + nonconstant_names.safe_grow_cleared(SSANAMES (my_function)->length()); } } @@ -2388,7 +2350,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) dump_predicate (dump_file, info->conds, &bb_predicate); } - if (parms_info && nonconstant_names) + if (parms_info && nonconstant_names.exists ()) { struct predicate phi_predicate; bool first_phi = true; @@ -2427,7 +2389,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) ((double)freq)/CGRAPH_FREQ_BASE, this_size, this_time); } - if (gimple_assign_load_p (stmt) && nonconstant_names) + if (gimple_assign_load_p (stmt) && nonconstant_names.exists ()) { struct predicate this_array_index; this_array_index = array_index_predicate (info, nonconstant_names, @@ -2435,7 +2397,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) if (!false_predicate_p (&this_array_index)) array_index = and_predicates (info->conds, &array_index, &this_array_index); } - if (gimple_store_p (stmt) && nonconstant_names) + if (gimple_store_p (stmt) && nonconstant_names.exists ()) { struct predicate this_array_index; this_array_index = array_index_predicate (info, nonconstant_names, @@ -2453,30 +2415,27 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) /* Special case: results of BUILT_IN_CONSTANT_P will be always resolved as constant. We however don't want to optimize out the cgraph edges. */ - if (nonconstant_names + if (nonconstant_names.exists () && gimple_call_builtin_p (stmt, BUILT_IN_CONSTANT_P) && gimple_call_lhs (stmt) && TREE_CODE (gimple_call_lhs (stmt)) == SSA_NAME) { struct predicate false_p = false_predicate (); - VEC_replace (predicate_t, nonconstant_names, - SSA_NAME_VERSION (gimple_call_lhs (stmt)), - false_p); + nonconstant_names[SSA_NAME_VERSION (gimple_call_lhs (stmt))] + = false_p; } - if (ipa_node_params_vector) + if (ipa_node_params_vector.exists ()) { int count = gimple_call_num_args (stmt); int i; if (count) - VEC_safe_grow_cleared (inline_param_summary_t, heap, - es->param, count); + es->param.safe_grow_cleared (count); for (i = 0; i < count; i++) { int prob = param_change_prob (stmt, i); gcc_assert (prob >= 0 && prob <= REG_BR_PROB_BASE); - VEC_index (inline_param_summary_t, - es->param, i).change_prob = prob; + es->param[i].change_prob = prob; } } @@ -2547,7 +2506,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) time = MAX_TIME; free (order); - if (!early && nonconstant_names) + if (!early && nonconstant_names.exists ()) { struct loop *loop; loop_iterator li; @@ -2559,7 +2518,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) scev_initialize (); FOR_EACH_LOOP (li, loop, 0) { - VEC (edge, heap) *exits; + vec<edge> exits; edge ex; unsigned int j, i; struct tree_niter_desc niter_desc; @@ -2567,7 +2526,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) bb_predicate = *(struct predicate *)loop->header->aux; exits = get_loop_exit_edges (loop); - FOR_EACH_VEC_ELT (edge, exits, j, ex) + FOR_EACH_VEC_ELT (exits, j, ex) if (number_of_iterations_exit (loop, ex, &niter_desc, false) && !is_gimple_min_invariant (niter_desc.niter)) { @@ -2584,7 +2543,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) independent predicate. */ loop_iterations = and_predicates (info->conds, &loop_iterations, &will_be_nonconstant); } - VEC_free (edge, heap, exits); + exits.release (); for (i = 0; i < loop->num_nodes; i++) { @@ -2642,7 +2601,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) } inline_summary (node)->self_time = time; inline_summary (node)->self_size = size; - VEC_free (predicate_t, heap, nonconstant_names); + nonconstant_names.release (); if (optimize && !early) { loop_optimizer_finalize (); @@ -2779,15 +2738,15 @@ struct gimple_opt_pass pass_inline_parameters = static bool estimate_edge_devirt_benefit (struct cgraph_edge *ie, int *size, int *time, - VEC (tree, heap) *known_vals, - VEC (tree, heap) *known_binfos, - VEC (ipa_agg_jump_function_p, heap) *known_aggs) + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs) { tree target; struct cgraph_node *callee; struct inline_summary *isummary; - if (!known_vals && !known_binfos) + if (!known_vals.exists () && !known_binfos.exists ()) return false; if (!flag_indirect_inlining) return false; @@ -2815,9 +2774,9 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie, static inline void estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *time, int prob, - VEC (tree, heap) *known_vals, - VEC (tree, heap) *known_binfos, - VEC (ipa_agg_jump_function_p, heap) *known_aggs, + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs, inline_hints *hints) { @@ -2847,9 +2806,9 @@ static void estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time, inline_hints *hints, clause_t possible_truths, - VEC (tree, heap) *known_vals, - VEC (tree, heap) *known_binfos, - VEC (ipa_agg_jump_function_p, heap) *known_aggs) + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs) { struct cgraph_edge *e; for (e = node->callees; e; e = e->next_callee) @@ -2889,13 +2848,13 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size, int *time, static void estimate_node_size_and_time (struct cgraph_node *node, clause_t possible_truths, - VEC (tree, heap) *known_vals, - VEC (tree, heap) *known_binfos, - VEC (ipa_agg_jump_function_p, heap) *known_aggs, + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs, int *ret_size, int *ret_time, inline_hints *ret_hints, - VEC (inline_param_summary_t, heap) - *inline_param_summary) + vec<inline_param_summary_t> + inline_param_summary) { struct inline_summary *info = inline_summary (node); size_time_entry *e; @@ -2915,7 +2874,7 @@ estimate_node_size_and_time (struct cgraph_node *node, for (i = predicate_not_inlined_condition; i < (predicate_first_dynamic_condition - + (int)VEC_length (condition, info->conds)); i++) + + (int)vec_safe_length (info->conds)); i++) if (!(possible_truths & (1 << i))) { if (found) @@ -2925,13 +2884,13 @@ estimate_node_size_and_time (struct cgraph_node *node, } } - for (i = 0; VEC_iterate (size_time_entry, info->entry, i, e); i++) + for (i = 0; vec_safe_iterate (info->entry, i, &e); i++) if (evaluate_predicate (&e->predicate, possible_truths)) { size += e->size; gcc_checking_assert (e->time >= 0); gcc_checking_assert (time >= 0); - if (!inline_param_summary) + if (!inline_param_summary.exists ()) time += e->time; else { @@ -2992,9 +2951,9 @@ estimate_node_size_and_time (struct cgraph_node *node, void estimate_ipcp_clone_size_and_time (struct cgraph_node *node, - VEC (tree, heap) *known_vals, - VEC (tree, heap) *known_binfos, - VEC (ipa_agg_jump_function_p, heap) *known_aggs, + vec<tree> known_vals, + vec<tree> known_binfos, + vec<ipa_agg_jump_function_p> known_aggs, int *ret_size, int *ret_time, inline_hints *hints) { @@ -3003,7 +2962,8 @@ estimate_ipcp_clone_size_and_time (struct cgraph_node *node, clause = evaluate_conditions_for_known_args (node, false, known_vals, known_aggs); estimate_node_size_and_time (node, clause, known_vals, known_binfos, - known_aggs, ret_size, ret_time, hints, NULL); + known_aggs, ret_size, ret_time, hints, + vec<inline_param_summary_t>()); } /* Translate all conditions from callee representation into caller @@ -3023,8 +2983,8 @@ static struct predicate remap_predicate (struct inline_summary *info, struct inline_summary *callee_info, struct predicate *p, - VEC (int, heap) *operand_map, - VEC (int, heap) *offset_map, + vec<int> operand_map, + vec<int> offset_map, clause_t possible_truths, struct predicate *toplev_predicate) { @@ -3053,26 +3013,25 @@ remap_predicate (struct inline_summary *info, { struct condition *c; - c = &VEC_index (condition, callee_info->conds, - cond - predicate_first_dynamic_condition); + c = &(*callee_info->conds)[cond + - predicate_first_dynamic_condition]; /* See if we can remap condition operand to caller's operand. Otherwise give up. */ - if (!operand_map - || (int)VEC_length (int, operand_map) <= c->operand_num - || VEC_index (int, operand_map, c->operand_num) == -1 + if (!operand_map.exists () + || (int)operand_map.length () <= c->operand_num + || operand_map[c->operand_num] == -1 /* TODO: For non-aggregate conditions, adding an offset is basically an arithmetic jump function processing which we should support in future. */ || ((!c->agg_contents || !c->by_ref) - && VEC_index (int, offset_map, c->operand_num) > 0) + && offset_map[c->operand_num] > 0) || (c->agg_contents && c->by_ref - && VEC_index (int, offset_map, c->operand_num) < 0)) + && offset_map[c->operand_num] < 0)) cond_predicate = true_predicate (); else { struct agg_position_info ap; - HOST_WIDE_INT offset_delta = VEC_index (int, offset_map, - c->operand_num); + HOST_WIDE_INT offset_delta = offset_map[c->operand_num]; if (offset_delta < 0) { gcc_checking_assert (!c->agg_contents || !c->by_ref); @@ -3085,9 +3044,7 @@ remap_predicate (struct inline_summary *info, ap.agg_contents = c->agg_contents; ap.by_ref = c->by_ref; cond_predicate = add_condition (info, - VEC_index (int, - operand_map, - c->operand_num), + operand_map[c->operand_num], &ap, c->code, c->val); } } @@ -3148,7 +3105,7 @@ static void remap_edge_change_prob (struct cgraph_edge *inlined_edge, struct cgraph_edge *edge) { - if (ipa_node_params_vector) + if (ipa_node_params_vector.exists ()) { int i; struct ipa_edge_args *args = IPA_EDGE_REF (edge); @@ -3161,23 +3118,18 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge, struct ipa_jump_func *jfunc = ipa_get_ith_jump_func (args, i); if (jfunc->type == IPA_JF_PASS_THROUGH && (ipa_get_jf_pass_through_formal_id (jfunc) - < (int) VEC_length (inline_param_summary_t, - inlined_es->param))) + < (int) inlined_es->param.length ())) { int jf_formal_id = ipa_get_jf_pass_through_formal_id (jfunc); - int prob1 = VEC_index (inline_param_summary_t, - es->param, i).change_prob; - int prob2 = VEC_index - (inline_param_summary_t, - inlined_es->param, jf_formal_id).change_prob; + int prob1 = es->param[i].change_prob; + int prob2 = inlined_es->param[jf_formal_id].change_prob; int prob = ((prob1 * prob2 + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE); if (prob1 && prob2 && !prob) prob = 1; - VEC_index (inline_param_summary_t, - es->param, i).change_prob = prob; + es->param[i].change_prob = prob; } } } @@ -3195,8 +3147,8 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge, struct cgraph_node *node, struct inline_summary *info, struct inline_summary *callee_info, - VEC (int, heap) *operand_map, - VEC (int, heap) *offset_map, + vec<int> operand_map, + vec<int> offset_map, clause_t possible_truths, struct predicate *toplev_predicate) { @@ -3266,8 +3218,8 @@ static void remap_hint_predicate (struct inline_summary *info, struct inline_summary *callee_info, struct predicate **hint, - VEC (int, heap) *operand_map, - VEC (int, heap) *offset_map, + vec<int> operand_map, + vec<int> offset_map, clause_t possible_truths, struct predicate *toplev_predicate) { @@ -3303,8 +3255,8 @@ inline_merge_summary (struct cgraph_edge *edge) struct inline_summary *info = inline_summary (to); clause_t clause = 0; /* not_inline is known to be false. */ size_time_entry *e; - VEC (int, heap) *operand_map = NULL; - VEC (int, heap) *offset_map = NULL; + vec<int> operand_map = vec<int>(); + vec<int> offset_map = vec<int>(); int i; struct predicate toplev_predicate; struct predicate true_p = true_predicate (); @@ -3315,7 +3267,7 @@ inline_merge_summary (struct cgraph_edge *edge) else toplev_predicate = true_predicate (); - if (ipa_node_params_vector && callee_info->conds) + if (ipa_node_params_vector.exists () && callee_info->conds) { struct ipa_edge_args *args = IPA_EDGE_REF (edge); int count = ipa_get_cs_argument_count (args); @@ -3324,8 +3276,8 @@ inline_merge_summary (struct cgraph_edge *edge) evaluate_properties_for_edge (edge, true, &clause, NULL, NULL, NULL); if (count) { - VEC_safe_grow_cleared (int, heap, operand_map, count); - VEC_safe_grow_cleared (int, heap, offset_map, count); + operand_map.safe_grow_cleared (count); + offset_map.safe_grow_cleared (count); } for (i = 0; i < count; i++) { @@ -3338,7 +3290,7 @@ inline_merge_summary (struct cgraph_edge *edge) if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR) map = ipa_get_jf_pass_through_formal_id (jfunc); if (!ipa_get_jf_pass_through_agg_preserved (jfunc)) - VEC_replace (int, offset_map, i, -1); + offset_map[i] = -1; } else if (jfunc->type == IPA_JF_ANCESTOR) { @@ -3348,14 +3300,14 @@ inline_merge_summary (struct cgraph_edge *edge) map = ipa_get_jf_ancestor_formal_id (jfunc); if (!ipa_get_jf_ancestor_agg_preserved (jfunc)) offset = -1; - VEC_replace (int, offset_map, i, offset); + offset_map[i] = offset; } } - VEC_replace (int, operand_map, i, map); + operand_map[i] = map; gcc_assert (map < ipa_get_param_count (IPA_NODE_REF (to))); } } - for (i = 0; VEC_iterate (size_time_entry, callee_info->entry, i, e); i++) + for (i = 0; vec_safe_iterate (callee_info->entry, i, &e); i++) { struct predicate p = remap_predicate (info, callee_info, &e->predicate, operand_map, @@ -3401,9 +3353,9 @@ inline_merge_summary (struct cgraph_edge *edge) /* We do not maintain predicates of inlined edges, free it. */ edge_set_predicate (edge, &true_p); /* Similarly remove param summaries. */ - VEC_free (inline_param_summary_t, heap, es->param); - VEC_free (int, heap, operand_map); - VEC_free (int, heap, offset_map); + es->param.release (); + operand_map.release (); + offset_map.release (); } /* For performance reasons inline_merge_summary is not updating overall size @@ -3418,7 +3370,7 @@ inline_update_overall_summary (struct cgraph_node *node) info->size = 0; info->time = 0; - for (i = 0; VEC_iterate (size_time_entry, info->entry, i, e); i++) + for (i = 0; vec_safe_iterate (info->entry, i, &e); i++) { info->size += e->size, info->time += e->time; if (info->time > MAX_TIME * INLINE_TIME_SCALE) @@ -3426,7 +3378,9 @@ inline_update_overall_summary (struct cgraph_node *node) } estimate_calls_size_and_time (node, &info->size, &info->time, NULL, ~(clause_t)(1 << predicate_false_condition), - NULL, NULL, NULL); + vec<tree>(), + vec<tree>(), + vec<ipa_agg_jump_function_p>()); info->time = (info->time + INLINE_TIME_SCALE / 2) / INLINE_TIME_SCALE; info->size = (info->size + INLINE_SIZE_SCALE / 2) / INLINE_SIZE_SCALE; } @@ -3466,9 +3420,9 @@ do_estimate_edge_time (struct cgraph_edge *edge) inline_hints hints; struct cgraph_node *callee; clause_t clause; - VEC (tree, heap) *known_vals; - VEC (tree, heap) *known_binfos; - VEC (ipa_agg_jump_function_p, heap) *known_aggs; + vec<tree> known_vals; + vec<tree> known_binfos; + vec<ipa_agg_jump_function_p> known_aggs; struct inline_edge_summary *es = inline_edge_summary (edge); callee = cgraph_function_or_thunk_node (edge->callee, NULL); @@ -3479,27 +3433,22 @@ do_estimate_edge_time (struct cgraph_edge *edge) &known_aggs); estimate_node_size_and_time (callee, clause, known_vals, known_binfos, known_aggs, &size, &time, &hints, es->param); - VEC_free (tree, heap, known_vals); - VEC_free (tree, heap, known_binfos); - VEC_free (ipa_agg_jump_function_p, heap, known_aggs); + known_vals.release (); + known_binfos.release (); + known_aggs.release (); gcc_checking_assert (size >= 0); gcc_checking_assert (time >= 0); /* When caching, update the cache entry. */ - if (edge_growth_cache) + if (edge_growth_cache.exists ()) { - if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) - <= edge->uid) - VEC_safe_grow_cleared (edge_growth_cache_entry, heap, edge_growth_cache, - cgraph_edge_max_uid); - VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).time - = time + (time >= 0); + if ((int)edge_growth_cache.length () <= edge->uid) + edge_growth_cache.safe_grow_cleared (cgraph_edge_max_uid); + edge_growth_cache[edge->uid].time = time + (time >= 0); - VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).size - = size + (size >= 0); + edge_growth_cache[edge->uid].size = size + (size >= 0); hints |= simple_edge_hints (edge); - VEC_index (edge_growth_cache_entry, edge_growth_cache, edge->uid).hints - = hints + 1; + edge_growth_cache[edge->uid].hints = hints + 1; } return time; } @@ -3514,18 +3463,16 @@ do_estimate_edge_size (struct cgraph_edge *edge) int size; struct cgraph_node *callee; clause_t clause; - VEC (tree, heap) *known_vals; - VEC (tree, heap) *known_binfos; - VEC (ipa_agg_jump_function_p, heap) *known_aggs; + vec<tree> known_vals; + vec<tree> known_binfos; + vec<ipa_agg_jump_function_p> known_aggs; /* When we do caching, use do_estimate_edge_time to populate the entry. */ - if (edge_growth_cache) + if (edge_growth_cache.exists ()) { do_estimate_edge_time (edge); - size = VEC_index (edge_growth_cache_entry, - edge_growth_cache, - edge->uid).size; + size = edge_growth_cache[edge->uid].size; gcc_checking_assert (size); return size - (size > 0); } @@ -3538,10 +3485,11 @@ do_estimate_edge_size (struct cgraph_edge *edge) &clause, &known_vals, &known_binfos, &known_aggs); estimate_node_size_and_time (callee, clause, known_vals, known_binfos, - known_aggs, &size, NULL, NULL, NULL); - VEC_free (tree, heap, known_vals); - VEC_free (tree, heap, known_binfos); - VEC_free (ipa_agg_jump_function_p, heap, known_aggs); + known_aggs, &size, NULL, NULL, + vec<inline_param_summary_t>()); + known_vals.release (); + known_binfos.release (); + known_aggs.release (); return size; } @@ -3555,18 +3503,16 @@ do_estimate_edge_hints (struct cgraph_edge *edge) inline_hints hints; struct cgraph_node *callee; clause_t clause; - VEC (tree, heap) *known_vals; - VEC (tree, heap) *known_binfos; - VEC (ipa_agg_jump_function_p, heap) *known_aggs; + vec<tree> known_vals; + vec<tree> known_binfos; + vec<ipa_agg_jump_function_p> known_aggs; /* When we do caching, use do_estimate_edge_time to populate the entry. */ - if (edge_growth_cache) + if (edge_growth_cache.exists ()) { do_estimate_edge_time (edge); - hints = VEC_index (edge_growth_cache_entry, - edge_growth_cache, - edge->uid).hints; + hints = edge_growth_cache[edge->uid].hints; gcc_checking_assert (hints); return hints - 1; } @@ -3579,10 +3525,11 @@ do_estimate_edge_hints (struct cgraph_edge *edge) &clause, &known_vals, &known_binfos, &known_aggs); estimate_node_size_and_time (callee, clause, known_vals, known_binfos, - known_aggs, NULL, NULL, &hints, NULL); - VEC_free (tree, heap, known_vals); - VEC_free (tree, heap, known_binfos); - VEC_free (ipa_agg_jump_function_p, heap, known_aggs); + known_aggs, NULL, NULL, &hints, + vec<inline_param_summary_t>()); + known_vals.release (); + known_binfos.release (); + known_aggs.release (); hints |= simple_edge_hints (edge); return hints; } @@ -3687,12 +3634,11 @@ do_estimate_growth (struct cgraph_node *node) + 50) / 100; } - if (node_growth_cache) + if (node_growth_cache.exists ()) { - if ((int)VEC_length (int, node_growth_cache) <= node->uid) - VEC_safe_grow_cleared (int, heap, node_growth_cache, cgraph_max_uid); - VEC_replace (int, node_growth_cache, node->uid, - d.growth + (d.growth >= 0)); + if ((int)node_growth_cache.length () <= node->uid) + node_growth_cache.safe_grow_cleared (cgraph_max_uid); + node_growth_cache[node->uid] = d.growth + (d.growth >= 0); } return d.growth; } @@ -3800,9 +3746,9 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e) length = streamer_read_uhwi (ib); if (length) { - VEC_safe_grow_cleared (inline_param_summary_t, heap, es->param, length); + es->param.safe_grow_cleared (length); for (i = 0; i < length; i++) - VEC_index (inline_param_summary_t, es->param, i).change_prob + es->param[i].change_prob = streamer_read_uhwi (ib); } } @@ -3829,7 +3775,8 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, data_in = lto_data_in_create (file_data, (const char *) data + string_offset, - header->string_size, NULL); + header->string_size, + vec<ld_plugin_symbol_resolution_t>()); f_count = streamer_read_uhwi (&ib); for (i = 0; i < f_count; i++) { @@ -3867,7 +3814,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, c.by_ref = bp_unpack_value (&bp, 1); if (c.agg_contents) c.offset = streamer_read_uhwi (&ib); - VEC_safe_push (condition, gc, info->conds, c); + vec_safe_push (info->conds, c); } count2 = streamer_read_uhwi (&ib); gcc_assert (!info->entry); @@ -3879,7 +3826,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data, e.time = streamer_read_uhwi (&ib); e.predicate = read_predicate (&ib); - VEC_safe_push (size_time_entry, gc, info->entry, e); + vec_safe_push (info->entry, e); } p = read_predicate (&ib); @@ -3966,10 +3913,9 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e) streamer_write_uhwi (ob, es->call_stmt_time); streamer_write_uhwi (ob, es->loop_depth); write_predicate (ob, es->predicate); - streamer_write_uhwi (ob, VEC_length (inline_param_summary_t, es->param)); - for (i = 0; i < (int)VEC_length (inline_param_summary_t, es->param); i++) - streamer_write_uhwi (ob, VEC_index (inline_param_summary_t, - es->param, i).change_prob); + streamer_write_uhwi (ob, es->param.length ()); + for (i = 0; i < (int)es->param.length (); i++) + streamer_write_uhwi (ob, es->param[i].change_prob); } @@ -4015,8 +3961,8 @@ inline_write_summary (void) bp = bitpack_create (ob->main_stream); bp_pack_value (&bp, info->inlinable, 1); streamer_write_bitpack (&bp); - streamer_write_uhwi (ob, VEC_length (condition, info->conds)); - for (i = 0; VEC_iterate (condition, info->conds, i, c); i++) + streamer_write_uhwi (ob, vec_safe_length (info->conds)); + for (i = 0; vec_safe_iterate (info->conds, i, &c); i++) { streamer_write_uhwi (ob, c->operand_num); streamer_write_uhwi (ob, c->code); @@ -4028,10 +3974,8 @@ inline_write_summary (void) if (c->agg_contents) streamer_write_uhwi (ob, c->offset); } - streamer_write_uhwi (ob, VEC_length (size_time_entry, info->entry)); - for (i = 0; - VEC_iterate (size_time_entry, info->entry, i, e); - i++) + streamer_write_uhwi (ob, vec_safe_length (info->entry)); + for (i = 0; vec_safe_iterate (info->entry, i, &e); i++) { streamer_write_uhwi (ob, e->size); streamer_write_uhwi (ob, e->time); @@ -4061,7 +4005,7 @@ void inline_free_summary (void) { struct cgraph_node *node; - if (inline_edge_summary_vec == NULL) + if (!inline_edge_summary_vec.exists ()) return; FOR_EACH_DEFINED_FUNCTION (node) reset_inline_summary (node); @@ -4080,10 +4024,8 @@ inline_free_summary (void) if (edge_duplication_hook_holder) cgraph_remove_edge_duplication_hook (edge_duplication_hook_holder); edge_duplication_hook_holder = NULL; - VEC_free (inline_summary_t, gc, inline_summary_vec); - inline_summary_vec = NULL; - VEC_free (inline_edge_summary_t, heap, inline_edge_summary_vec); - inline_edge_summary_vec = NULL; + vec_free (inline_summary_vec); + inline_edge_summary_vec.release (); if (edge_predicate_pool) free_alloc_pool (edge_predicate_pool); edge_predicate_pool = 0; |