aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2012-11-18 02:54:30 +0000
committerDiego Novillo <dnovillo@google.com>2012-11-18 02:54:30 +0000
commit85943a92f41f04a401d537cbf56857d68ec51033 (patch)
tree1b9f930d315fa3e0a5ed7fa6e27ec5bd0a3436a4 /gcc/ipa-prop.c
parent5b4a7ac01f066ea476ad7b58e0aa7cf08c526dac (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@193595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r--gcc/ipa-prop.c254
1 files changed, 115 insertions, 139 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index b78dc65dbc7..3150bd6db15 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -50,11 +50,11 @@ struct param_analysis_info
};
/* Vector where the parameter infos are actually stored. */
-VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
+vec<ipa_node_params_t> ipa_node_params_vector;
/* Vector of known aggregate values in cloned nodes. */
-VEC (ipa_agg_replacement_value_p, gc) *ipa_node_agg_replacements;
+vec<ipa_agg_replacement_value_p, va_gc> *ipa_node_agg_replacements;
/* Vector where the parameter infos are actually stored. */
-VEC (ipa_edge_args_t, gc) *ipa_edge_args_vector;
+vec<ipa_edge_args_t, va_gc> *ipa_edge_args_vector;
/* Holders of ipa cgraph hooks: */
static struct cgraph_edge_hook_list *edge_removal_hook_holder;
@@ -67,14 +67,13 @@ static struct cgraph_node_hook_list *function_insertion_hook_holder;
to INFO. */
static int
-ipa_get_param_decl_index_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
- tree ptree)
+ipa_get_param_decl_index_1 (vec<ipa_param_descriptor_t> descriptors, tree ptree)
{
int i, count;
- count = VEC_length (ipa_param_descriptor_t, descriptors);
+ count = descriptors.length ();
for (i = 0; i < count; i++)
- if (VEC_index (ipa_param_descriptor_t, descriptors, i).decl == ptree)
+ if (descriptors[i].decl == ptree)
return i;
return -1;
@@ -94,7 +93,7 @@ ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
static void
ipa_populate_param_decls (struct cgraph_node *node,
- VEC (ipa_param_descriptor_t, heap) *descriptors)
+ vec<ipa_param_descriptor_t> &descriptors)
{
tree fndecl;
tree fnargs;
@@ -106,7 +105,7 @@ ipa_populate_param_decls (struct cgraph_node *node,
param_num = 0;
for (parm = fnargs; parm; parm = DECL_CHAIN (parm))
{
- VEC_index (ipa_param_descriptor_t, descriptors, param_num).decl = parm;
+ descriptors[param_num].decl = parm;
param_num++;
}
}
@@ -134,15 +133,14 @@ ipa_initialize_node_params (struct cgraph_node *node)
{
struct ipa_node_params *info = IPA_NODE_REF (node);
- if (!info->descriptors)
+ if (!info->descriptors.exists ())
{
int param_count;
param_count = count_formal_params (node->symbol.decl);
if (param_count)
{
- VEC_safe_grow_cleared (ipa_param_descriptor_t, heap,
- info->descriptors, param_count);
+ info->descriptors.safe_grow_cleared (param_count);
ipa_populate_param_decls (node, info->descriptors);
}
}
@@ -226,8 +224,7 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
fprintf (f, " Aggregate passed by %s:\n",
jump_func->agg.by_ref ? "reference" : "value");
- FOR_EACH_VEC_ELT (ipa_agg_jf_item_t, jump_func->agg.items,
- j, item)
+ FOR_EACH_VEC_SAFE_ELT (jump_func->agg.items, j, item)
{
fprintf (f, " offset: " HOST_WIDE_INT_PRINT_DEC ", ",
item->offset);
@@ -672,7 +669,7 @@ parm_preserved_before_stmt_p (struct param_analysis_info *parm_ainfo,
modified. Otherwise return -1. */
static int
-load_from_unmodified_param (VEC (ipa_param_descriptor_t, heap) *descriptors,
+load_from_unmodified_param (vec<ipa_param_descriptor_t> descriptors,
struct param_analysis_info *parms_ainfo,
gimple stmt)
{
@@ -760,7 +757,7 @@ parm_ref_data_pass_through_p (struct param_analysis_info *parm_ainfo,
reference respectively. */
static bool
-ipa_load_from_parm_agg_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
+ipa_load_from_parm_agg_1 (vec<ipa_param_descriptor_t> descriptors,
struct param_analysis_info *parms_ainfo, gimple stmt,
tree op, int *index_p, HOST_WIDE_INT *offset_p,
bool *by_ref_p)
@@ -1381,7 +1378,7 @@ determine_known_aggregate_parts (gimple call, tree arg,
if (const_count)
{
jfunc->agg.by_ref = by_ref;
- jfunc->agg.items = VEC_alloc (ipa_agg_jf_item_t, gc, const_count);
+ vec_alloc (jfunc->agg.items, const_count);
while (list)
{
if (list->constant)
@@ -1389,7 +1386,7 @@ determine_known_aggregate_parts (gimple call, tree arg,
struct ipa_agg_jf_item item;
item.offset = list->offset - arg_offset;
item.value = prune_expression_for_jf (list->constant);
- VEC_quick_push (ipa_agg_jf_item_t, jfunc->agg.items, item);
+ jfunc->agg.items->quick_push (item);
}
list = list->next;
}
@@ -1411,7 +1408,7 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo,
if (arg_num == 0 || args->jump_functions)
return;
- VEC_safe_grow_cleared (ipa_jump_func_t, gc, args->jump_functions, arg_num);
+ vec_safe_grow_cleared (args->jump_functions, arg_num);
for (n = 0; n < arg_num; n++)
{
@@ -2050,9 +2047,9 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
replace with merging when we do. */
gcc_assert (!dst->agg.items);
- dst->agg.items = VEC_copy (ipa_agg_jf_item_t, gc, src->agg.items);
+ dst->agg.items = vec_safe_copy (src->agg.items);
dst->agg.by_ref = src->agg.by_ref;
- FOR_EACH_VEC_ELT (ipa_agg_jf_item_t, dst->agg.items, j, item)
+ FOR_EACH_VEC_SAFE_ELT (dst->agg.items, j, item)
item->offset -= dst->value.ancestor.offset;
}
@@ -2100,8 +2097,7 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
gcc_assert (!dst->agg.items);
dst->agg.by_ref = src->agg.by_ref;
- dst->agg.items = VEC_copy (ipa_agg_jf_item_t, gc,
- src->agg.items);
+ dst->agg.items = vec_safe_copy (src->agg.items);
}
if (!agg_p)
@@ -2177,7 +2173,7 @@ ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg,
if (by_ref != agg->by_ref)
return NULL;
- FOR_EACH_VEC_ELT (ipa_agg_jf_item_t, agg->items, i, item)
+ FOR_EACH_VEC_SAFE_ELT (agg->items, i, item)
if (item->offset == offset)
{
/* Currently we do not have clobber values, return NULL for them once
@@ -2256,7 +2252,7 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
static bool
update_indirect_edges_after_inlining (struct cgraph_edge *cs,
struct cgraph_node *node,
- VEC (cgraph_edge_p, heap) **new_edges)
+ vec<cgraph_edge_p> *new_edges)
{
struct ipa_edge_args *top;
struct cgraph_edge *ie, *next_ie, *new_direct_edge;
@@ -2326,8 +2322,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
new_direct_edge->callee->symbol.decl);
if (new_edges)
{
- VEC_safe_push (cgraph_edge_p, heap, *new_edges,
- new_direct_edge);
+ new_edges->safe_push (new_direct_edge);
top = IPA_EDGE_REF (cs);
res = true;
}
@@ -2348,7 +2343,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
static bool
propagate_info_to_inlined_callees (struct cgraph_edge *cs,
struct cgraph_node *node,
- VEC (cgraph_edge_p, heap) **new_edges)
+ vec<cgraph_edge_p> *new_edges)
{
struct cgraph_edge *e;
bool res;
@@ -2374,12 +2369,12 @@ propagate_info_to_inlined_callees (struct cgraph_edge *cs,
bool
ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
- VEC (cgraph_edge_p, heap) **new_edges)
+ vec<cgraph_edge_p> *new_edges)
{
bool changed;
/* Do nothing if the preparation phase has not been carried out yet
(i.e. during early inlining). */
- if (!ipa_node_params_vector)
+ if (!ipa_node_params_vector.exists ())
return false;
gcc_assert (ipa_edge_args_vector);
@@ -2397,9 +2392,7 @@ ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
void
ipa_free_edge_args_substructures (struct ipa_edge_args *args)
{
- if (args->jump_functions)
- ggc_free (args->jump_functions);
-
+ vec_free (args->jump_functions);
memset (args, 0, sizeof (*args));
}
@@ -2411,11 +2404,13 @@ ipa_free_all_edge_args (void)
int i;
struct ipa_edge_args *args;
- FOR_EACH_VEC_ELT (ipa_edge_args_t, ipa_edge_args_vector, i, args)
+ if (!ipa_edge_args_vector)
+ return;
+
+ FOR_EACH_VEC_ELT (*ipa_edge_args_vector, i, args)
ipa_free_edge_args_substructures (args);
- VEC_free (ipa_edge_args_t, gc, ipa_edge_args_vector);
- ipa_edge_args_vector = NULL;
+ vec_free (ipa_edge_args_vector);
}
/* Frees all dynamically allocated structures that the param info points
@@ -2424,11 +2419,11 @@ ipa_free_all_edge_args (void)
void
ipa_free_node_params_substructures (struct ipa_node_params *info)
{
- VEC_free (ipa_param_descriptor_t, heap, info->descriptors);
+ info->descriptors.release ();
free (info->lattices);
/* Lattice values and their sources are deallocated with their alocation
pool. */
- VEC_free (tree, heap, info->known_vals);
+ info->known_vals.release ();
memset (info, 0, sizeof (*info));
}
@@ -2440,11 +2435,10 @@ ipa_free_all_node_params (void)
int i;
struct ipa_node_params *info;
- FOR_EACH_VEC_ELT (ipa_node_params_t, ipa_node_params_vector, i, info)
+ FOR_EACH_VEC_ELT (ipa_node_params_vector, i, info)
ipa_free_node_params_substructures (info);
- VEC_free (ipa_node_params_t, heap, ipa_node_params_vector);
- ipa_node_params_vector = NULL;
+ ipa_node_params_vector.release ();
}
/* Set the aggregate replacements of NODE to be AGGVALS. */
@@ -2453,13 +2447,10 @@ void
ipa_set_node_agg_value_chain (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggvals)
{
- if (VEC_length (ipa_agg_replacement_value_p, ipa_node_agg_replacements)
- <= (unsigned) cgraph_max_uid)
- VEC_safe_grow_cleared (ipa_agg_replacement_value_p, gc,
- ipa_node_agg_replacements, cgraph_max_uid + 1);
+ if (vec_safe_length (ipa_node_agg_replacements) <= (unsigned) cgraph_max_uid)
+ vec_safe_grow_cleared (ipa_node_agg_replacements, cgraph_max_uid + 1);
- VEC_replace (ipa_agg_replacement_value_p, ipa_node_agg_replacements,
- node->uid, aggvals);
+ (*ipa_node_agg_replacements)[node->uid] = aggvals;
}
/* Hook that is called by cgraph.c when an edge is removed. */
@@ -2468,8 +2459,7 @@ static void
ipa_edge_removal_hook (struct cgraph_edge *cs, void *data ATTRIBUTE_UNUSED)
{
/* During IPA-CP updating we can be called on not-yet analyze clones. */
- if (VEC_length (ipa_edge_args_t, ipa_edge_args_vector)
- <= (unsigned)cs->uid)
+ if (vec_safe_length (ipa_edge_args_vector) <= (unsigned)cs->uid)
return;
ipa_free_edge_args_substructures (IPA_EDGE_REF (cs));
}
@@ -2480,13 +2470,10 @@ static void
ipa_node_removal_hook (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
{
/* During IPA-CP updating we can be called on not-yet analyze clones. */
- if (VEC_length (ipa_node_params_t, ipa_node_params_vector)
- > (unsigned)node->uid)
+ if (ipa_node_params_vector.length () > (unsigned)node->uid)
ipa_free_node_params_substructures (IPA_NODE_REF (node));
- if (VEC_length (ipa_agg_replacement_value_p, ipa_node_agg_replacements)
- > (unsigned)node->uid)
- VEC_replace (ipa_agg_replacement_value_p, ipa_node_agg_replacements,
- (unsigned)node->uid, NULL);
+ if (vec_safe_length (ipa_node_agg_replacements) > (unsigned)node->uid)
+ (*ipa_node_agg_replacements)[(unsigned)node->uid] = NULL;
}
/* Hook that is called by cgraph.c when an edge is duplicated. */
@@ -2503,14 +2490,11 @@ ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
old_args = IPA_EDGE_REF (src);
new_args = IPA_EDGE_REF (dst);
- new_args->jump_functions = VEC_copy (ipa_jump_func_t, gc,
- old_args->jump_functions);
+ new_args->jump_functions = vec_safe_copy (old_args->jump_functions);
- for (i = 0; i < VEC_length (ipa_jump_func_t, old_args->jump_functions); i++)
- VEC_index (ipa_jump_func_t, new_args->jump_functions, i).agg.items
- = VEC_copy (ipa_agg_jf_item_t, gc,
- VEC_index (ipa_jump_func_t,
- old_args->jump_functions, i).agg.items);
+ for (i = 0; i < vec_safe_length (old_args->jump_functions); i++)
+ (*new_args->jump_functions)[i].agg.items
+ = vec_safe_copy ((*old_args->jump_functions)[i].agg.items);
}
/* Hook that is called by cgraph.c when a node is duplicated. */
@@ -2526,8 +2510,7 @@ ipa_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
old_info = IPA_NODE_REF (src);
new_info = IPA_NODE_REF (dst);
- new_info->descriptors = VEC_copy (ipa_param_descriptor_t, heap,
- old_info->descriptors);
+ new_info->descriptors = old_info->descriptors.copy ();
new_info->lattices = NULL;
new_info->ipcp_orig_node = old_info->ipcp_orig_node;
@@ -2678,17 +2661,17 @@ ipa_print_all_params (FILE * f)
/* Return a heap allocated vector containing formal parameters of FNDECL. */
-VEC(tree, heap) *
+vec<tree>
ipa_get_vector_of_formal_parms (tree fndecl)
{
- VEC(tree, heap) *args;
+ vec<tree> args;
int count;
tree parm;
count = count_formal_params (fndecl);
- args = VEC_alloc (tree, heap, count);
+ args.create (count);
for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm))
- VEC_quick_push (tree, args, parm);
+ args.quick_push (parm);
return args;
}
@@ -2696,19 +2679,19 @@ ipa_get_vector_of_formal_parms (tree fndecl)
/* Return a heap allocated vector containing types of formal parameters of
function type FNTYPE. */
-static inline VEC(tree, heap) *
+static inline vec<tree>
get_vector_of_formal_parm_types (tree fntype)
{
- VEC(tree, heap) *types;
+ vec<tree> types;
int count = 0;
tree t;
for (t = TYPE_ARG_TYPES (fntype); t; t = TREE_CHAIN (t))
count++;
- types = VEC_alloc (tree, heap, count);
+ types.create (count);
for (t = TYPE_ARG_TYPES (fntype); t; t = TREE_CHAIN (t))
- VEC_quick_push (tree, types, TREE_VALUE (t));
+ types.quick_push (TREE_VALUE (t));
return types;
}
@@ -2722,11 +2705,11 @@ void
ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
const char *synth_parm_prefix)
{
- VEC(tree, heap) *oparms, *otypes;
+ vec<tree> oparms, otypes;
tree orig_type, new_type = NULL;
tree old_arg_types, t, new_arg_types = NULL;
tree parm, *link = &DECL_ARGUMENTS (fndecl);
- int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ int i, len = adjustments.length ();
tree new_reversed = NULL;
bool care_for_types, last_parm_void;
@@ -2746,14 +2729,14 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
== void_type_node);
otypes = get_vector_of_formal_parm_types (orig_type);
if (last_parm_void)
- gcc_assert (VEC_length (tree, oparms) + 1 == VEC_length (tree, otypes));
+ gcc_assert (oparms.length () + 1 == otypes.length ());
else
- gcc_assert (VEC_length (tree, oparms) == VEC_length (tree, otypes));
+ gcc_assert (oparms.length () == otypes.length ());
}
else
{
last_parm_void = false;
- otypes = NULL;
+ otypes.create (0);
}
for (i = 0; i < len; i++)
@@ -2761,15 +2744,14 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
struct ipa_parm_adjustment *adj;
gcc_assert (link);
- adj = &VEC_index (ipa_parm_adjustment_t, adjustments, i);
- parm = VEC_index (tree, oparms, adj->base_index);
+ adj = &adjustments[i];
+ parm = oparms[adj->base_index];
adj->base = parm;
if (adj->copy_param)
{
if (care_for_types)
- new_arg_types = tree_cons (NULL_TREE, VEC_index (tree, otypes,
- adj->base_index),
+ new_arg_types = tree_cons (NULL_TREE, otypes[adj->base_index],
new_arg_types);
*link = parm;
link = &DECL_CHAIN (parm);
@@ -2827,8 +2809,8 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
When we are asked to remove it, we need to build new FUNCTION_TYPE
instead. */
if (TREE_CODE (orig_type) != METHOD_TYPE
- || (VEC_index (ipa_parm_adjustment_t, adjustments, 0).copy_param
- && VEC_index (ipa_parm_adjustment_t, adjustments, 0).base_index == 0))
+ || (adjustments[0].copy_param
+ && adjustments[0].base_index == 0))
{
new_type = build_distinct_type_copy (orig_type);
TYPE_ARG_TYPES (new_type) = new_reversed;
@@ -2866,9 +2848,8 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
TREE_TYPE (fndecl) = new_type;
DECL_VIRTUAL_P (fndecl) = 0;
- if (otypes)
- VEC_free (tree, heap, otypes);
- VEC_free (tree, heap, oparms);
+ otypes.release ();
+ oparms.release ();
}
/* Modify actual arguments of a function call CS as indicated in ADJUSTMENTS.
@@ -2879,15 +2860,15 @@ void
ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
ipa_parm_adjustment_vec adjustments)
{
- VEC(tree, heap) *vargs;
- VEC(tree, gc) **debug_args = NULL;
+ vec<tree> vargs;
+ vec<tree, va_gc> **debug_args = NULL;
gimple new_stmt;
gimple_stmt_iterator gsi;
tree callee_decl;
int i, len;
- len = VEC_length (ipa_parm_adjustment_t, adjustments);
- vargs = VEC_alloc (tree, heap, len);
+ len = adjustments.length ();
+ vargs.create (len);
callee_decl = !cs ? gimple_call_fndecl (stmt) : cs->callee->symbol.decl;
gsi = gsi_for_stmt (stmt);
@@ -2895,13 +2876,13 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
{
struct ipa_parm_adjustment *adj;
- adj = &VEC_index (ipa_parm_adjustment_t, adjustments, i);
+ adj = &adjustments[i];
if (adj->copy_param)
{
tree arg = gimple_call_arg (stmt, adj->base_index);
- VEC_quick_push (tree, vargs, arg);
+ vargs.quick_push (arg);
}
else if (!adj->remove_param)
{
@@ -2996,7 +2977,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
adj->by_ref
|| is_gimple_reg_type (adj->type),
NULL, true, GSI_SAME_STMT);
- VEC_quick_push (tree, vargs, expr);
+ vargs.quick_push (expr);
}
if (!adj->copy_param && MAY_HAVE_DEBUG_STMTS)
{
@@ -3014,10 +2995,10 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
}
if (debug_args == NULL)
debug_args = decl_debug_args_insert (callee_decl);
- for (ix = 0; VEC_iterate (tree, *debug_args, ix, ddecl); ix += 2)
+ for (ix = 0; vec_safe_iterate (*debug_args, ix, &ddecl); ix += 2)
if (ddecl == origin)
{
- ddecl = VEC_index (tree, *debug_args, ix + 1);
+ ddecl = (**debug_args)[ix + 1];
break;
}
if (ddecl == NULL)
@@ -3027,11 +3008,10 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
TREE_TYPE (ddecl) = TREE_TYPE (origin);
DECL_MODE (ddecl) = DECL_MODE (origin);
- VEC_safe_push (tree, gc, *debug_args, origin);
- VEC_safe_push (tree, gc, *debug_args, ddecl);
+ vec_safe_push (*debug_args, origin);
+ vec_safe_push (*debug_args, ddecl);
}
- def_temp = gimple_build_debug_bind (ddecl, unshare_expr (arg),
- stmt);
+ def_temp = gimple_build_debug_bind (ddecl, unshare_expr (arg), stmt);
gsi_insert_before (&gsi, def_temp, GSI_SAME_STMT);
}
}
@@ -3043,7 +3023,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
}
new_stmt = gimple_build_call_vec (callee_decl, vargs);
- VEC_free (tree, heap, vargs);
+ vargs.release ();
if (gimple_call_lhs (stmt))
gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
@@ -3072,13 +3052,13 @@ static bool
index_in_adjustments_multiple_times_p (int base_index,
ipa_parm_adjustment_vec adjustments)
{
- int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ int i, len = adjustments.length ();
bool one = false;
for (i = 0; i < len; i++)
{
struct ipa_parm_adjustment *adj;
- adj = &VEC_index (ipa_parm_adjustment_t, adjustments, i);
+ adj = &adjustments[i];
if (adj->base_index == base_index)
{
@@ -3100,31 +3080,29 @@ ipa_parm_adjustment_vec
ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
ipa_parm_adjustment_vec outer)
{
- int i, outlen = VEC_length (ipa_parm_adjustment_t, outer);
- int inlen = VEC_length (ipa_parm_adjustment_t, inner);
+ int i, outlen = outer.length ();
+ int inlen = inner.length ();
int removals = 0;
ipa_parm_adjustment_vec adjustments, tmp;
- tmp = VEC_alloc (ipa_parm_adjustment_t, heap, inlen);
+ tmp.create (inlen);
for (i = 0; i < inlen; i++)
{
struct ipa_parm_adjustment *n;
- n = &VEC_index (ipa_parm_adjustment_t, inner, i);
+ n = &inner[i];
if (n->remove_param)
removals++;
else
- VEC_quick_push (ipa_parm_adjustment_t, tmp, *n);
+ tmp.quick_push (*n);
}
- adjustments = VEC_alloc (ipa_parm_adjustment_t, heap, outlen + removals);
+ adjustments.create (outlen + removals);
for (i = 0; i < outlen; i++)
{
struct ipa_parm_adjustment r;
- struct ipa_parm_adjustment *out = &VEC_index (ipa_parm_adjustment_t,
- outer, i);
- struct ipa_parm_adjustment *in = &VEC_index (ipa_parm_adjustment_t, tmp,
- out->base_index);
+ struct ipa_parm_adjustment *out = &outer[i];
+ struct ipa_parm_adjustment *in = &tmp[out->base_index];
memset (&r, 0, sizeof (r));
gcc_assert (!in->remove_param);
@@ -3133,7 +3111,7 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
{
r.remove_param = true;
- VEC_quick_push (ipa_parm_adjustment_t, adjustments, r);
+ adjustments.quick_push (r);
}
continue;
}
@@ -3151,19 +3129,18 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
r.offset = in->offset;
else
r.offset = in->offset + out->offset;
- VEC_quick_push (ipa_parm_adjustment_t, adjustments, r);
+ adjustments.quick_push (r);
}
for (i = 0; i < inlen; i++)
{
- struct ipa_parm_adjustment *n = &VEC_index (ipa_parm_adjustment_t,
- inner, i);
+ struct ipa_parm_adjustment *n = &inner[i];
if (n->remove_param)
- VEC_quick_push (ipa_parm_adjustment_t, adjustments, *n);
+ adjustments.quick_push (*n);
}
- VEC_free (ipa_parm_adjustment_t, heap, tmp);
+ tmp.release ();
return adjustments;
}
@@ -3174,15 +3151,15 @@ void
ipa_dump_param_adjustments (FILE *file, ipa_parm_adjustment_vec adjustments,
tree fndecl)
{
- int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ int i, len = adjustments.length ();
bool first = true;
- VEC(tree, heap) *parms = ipa_get_vector_of_formal_parms (fndecl);
+ vec<tree> parms = ipa_get_vector_of_formal_parms (fndecl);
fprintf (file, "IPA param adjustments: ");
for (i = 0; i < len; i++)
{
struct ipa_parm_adjustment *adj;
- adj = &VEC_index (ipa_parm_adjustment_t, adjustments, i);
+ adj = &adjustments[i];
if (!first)
fprintf (file, " ");
@@ -3190,7 +3167,7 @@ ipa_dump_param_adjustments (FILE *file, ipa_parm_adjustment_vec adjustments,
first = false;
fprintf (file, "%i. base_index: %i - ", i, adj->base_index);
- print_generic_expr (file, VEC_index (tree, parms, adj->base_index), 0);
+ print_generic_expr (file, parms[adj->base_index], 0);
if (adj->base)
{
fprintf (file, ", base: ");
@@ -3218,7 +3195,7 @@ ipa_dump_param_adjustments (FILE *file, ipa_parm_adjustment_vec adjustments,
print_node_brief (file, ", type: ", adj->type, 0);
fprintf (file, "\n");
}
- VEC_free (tree, heap, parms);
+ parms.release ();
}
/* Dump the AV linked list. */
@@ -3281,7 +3258,7 @@ ipa_write_jump_function (struct output_block *ob,
break;
}
- count = VEC_length (ipa_agg_jf_item_t, jump_func->agg.items);
+ count = vec_safe_length (jump_func->agg.items);
streamer_write_uhwi (ob, count);
if (count)
{
@@ -3290,7 +3267,7 @@ ipa_write_jump_function (struct output_block *ob,
streamer_write_bitpack (&bp);
}
- FOR_EACH_VEC_ELT (ipa_agg_jf_item_t, jump_func->agg.items, i, item)
+ FOR_EACH_VEC_SAFE_ELT (jump_func->agg.items, i, item)
{
streamer_write_uhwi (ob, item->offset);
stream_write_tree (ob, item->value, true);
@@ -3339,7 +3316,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
}
count = streamer_read_uhwi (ib);
- jump_func->agg.items = VEC_alloc (ipa_agg_jf_item_t, gc, count);
+ vec_alloc (jump_func->agg.items, count);
if (count)
{
bp = streamer_read_bitpack (ib);
@@ -3350,7 +3327,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
struct ipa_agg_jf_item item;
item.offset = streamer_read_uhwi (ib);
item.value = stream_read_tree (ib, data_in);
- VEC_quick_push (ipa_agg_jf_item_t, jump_func->agg.items, item);
+ jump_func->agg.items->quick_push (item);
}
}
@@ -3472,7 +3449,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
if (!count)
continue;
- VEC_safe_grow_cleared (ipa_jump_func_t, gc, args->jump_functions, count);
+ vec_safe_grow_cleared (args->jump_functions, count);
for (k = 0; k < ipa_get_cs_argument_count (args); k++)
ipa_read_jump_function (ib, ipa_get_ith_jump_func (args, k), data_in);
@@ -3484,8 +3461,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
if (count)
{
- VEC_safe_grow_cleared (ipa_jump_func_t, gc, args->jump_functions,
- count);
+ vec_safe_grow_cleared (args->jump_functions, count);
for (k = 0; k < ipa_get_cs_argument_count (args); k++)
ipa_read_jump_function (ib, ipa_get_ith_jump_func (args, k),
data_in);
@@ -3506,7 +3482,7 @@ ipa_prop_write_jump_functions (void)
lto_symtab_encoder_t encoder;
- if (!ipa_node_params_vector)
+ if (!ipa_node_params_vector.exists ())
return;
ob = create_output_block (LTO_section_jump_functions);
@@ -3558,7 +3534,8 @@ ipa_prop_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>());
count = streamer_read_uhwi (&ib_main);
for (i = 0; i < count; i++)
@@ -3731,7 +3708,8 @@ read_replacements_section (struct lto_file_decl_data *file_data,
header->main_size);
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>());
count = streamer_read_uhwi (&ib_main);
for (i = 0; i < count; i++)
@@ -3812,7 +3790,7 @@ adjust_agg_replacement_values (struct cgraph_node *node,
unsigned int
ipcp_transform_function (struct cgraph_node *node)
{
- VEC (ipa_param_descriptor_t, heap) *descriptors = NULL;
+ vec<ipa_param_descriptor_t> descriptors = vec<ipa_param_descriptor_t>();
struct param_analysis_info *parms_ainfo;
struct ipa_agg_replacement_value *aggval;
gimple_stmt_iterator gsi;
@@ -3838,8 +3816,7 @@ ipcp_transform_function (struct cgraph_node *node)
ipa_dump_agg_replacement_values (dump_file, aggval);
parms_ainfo = XALLOCAVEC (struct param_analysis_info, param_count);
memset (parms_ainfo, 0, sizeof (struct param_analysis_info) * param_count);
- VEC_safe_grow_cleared (ipa_param_descriptor_t, heap,
- descriptors, param_count);
+ descriptors.safe_grow_cleared (param_count);
ipa_populate_param_decls (node, descriptors);
FOR_EACH_BB (bb)
@@ -3929,10 +3906,9 @@ ipcp_transform_function (struct cgraph_node *node)
cfg_changed = true;
}
- VEC_replace (ipa_agg_replacement_value_p, ipa_node_agg_replacements,
- node->uid, NULL);
+ (*ipa_node_agg_replacements)[node->uid] = NULL;
free_parms_ainfo (parms_ainfo, param_count);
- VEC_free (ipa_param_descriptor_t, heap, descriptors);
+ descriptors.release ();
if (!something_changed)
return 0;