diff options
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index c9a69ab..93a2390c 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -298,7 +298,7 @@ ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc) /* Summary describing a single formal parameter. */ -struct ipa_param_descriptor +struct GTY(()) ipa_param_descriptor { /* In analysis and modification phase, this is the PARAM_DECL of this parameter, in IPA LTO phase, this is the type of the the described @@ -318,25 +318,23 @@ struct ipa_param_descriptor and some other information for interprocedural passes that operate on parameters (such as ipa-cp). */ -struct ipa_node_params +struct GTY((for_user)) ipa_node_params { - ~ipa_node_params (); - /* Information about individual formal parameters that are gathered when summaries are generated. */ - vec<ipa_param_descriptor> descriptors; + vec<ipa_param_descriptor, va_gc> *descriptors; /* Pointer to an array of structures describing individual formal parameters. */ - struct ipcp_param_lattices *lattices; + struct ipcp_param_lattices * GTY((skip)) lattices; /* Only for versioned nodes this field would not be NULL, it points to the node that IPA cp cloned from. */ - struct cgraph_node *ipcp_orig_node; + struct cgraph_node * GTY((skip)) ipcp_orig_node; /* If this node is an ipa-cp clone, these are the known constants that describe what it has been specialized for. */ - vec<tree> known_csts; + vec<tree> GTY((skip)) known_csts; /* If this node is an ipa-cp clone, these are the known polymorphic contexts that describe what it has been specialized for. */ - vec<ipa_polymorphic_call_context> known_contexts; + vec<ipa_polymorphic_call_context> GTY((skip)) known_contexts; /* Whether the param uses analysis and jump function computation has already been performed. */ unsigned analysis_done : 1; @@ -417,7 +415,7 @@ struct ipa_func_body_info static inline int ipa_get_param_count (struct ipa_node_params *info) { - return info->descriptors.length (); + return vec_safe_length (info->descriptors); } /* Return the declaration of Ith formal parameter of the function corresponding @@ -428,8 +426,9 @@ ipa_get_param_count (struct ipa_node_params *info) static inline tree ipa_get_param (struct ipa_node_params *info, int i) { + gcc_checking_assert (info->descriptors); gcc_checking_assert (!flag_wpa); - tree t = info->descriptors[i].decl_or_type; + tree t = (*info->descriptors)[i].decl_or_type; gcc_checking_assert (TREE_CODE (t) == PARM_DECL); return t; } @@ -440,7 +439,8 @@ ipa_get_param (struct ipa_node_params *info, int i) static inline tree ipa_get_type (struct ipa_node_params *info, int i) { - tree t = info->descriptors[i].decl_or_type; + gcc_checking_assert (info->descriptors); + tree t = (*info->descriptors)[i].decl_or_type; if (!t) return NULL; if (TYPE_P (t)) @@ -455,7 +455,8 @@ ipa_get_type (struct ipa_node_params *info, int i) static inline int ipa_get_param_move_cost (struct ipa_node_params *info, int i) { - return info->descriptors[i].move_cost; + gcc_checking_assert (info->descriptors); + return (*info->descriptors)[i].move_cost; } /* Set the used flag corresponding to the Ith formal parameter of the function @@ -464,7 +465,8 @@ ipa_get_param_move_cost (struct ipa_node_params *info, int i) static inline void ipa_set_param_used (struct ipa_node_params *info, int i, bool val) { - info->descriptors[i].used = val; + gcc_checking_assert (info->descriptors); + (*info->descriptors)[i].used = val; } /* Return how many uses described by ipa-prop a parameter has or @@ -473,9 +475,9 @@ ipa_set_param_used (struct ipa_node_params *info, int i, bool val) static inline int ipa_get_controlled_uses (struct ipa_node_params *info, int i) { - /* FIXME: introducing speuclation causes out of bounds access here. */ - if (info->descriptors.length () > (unsigned)i) - return info->descriptors[i].controlled_uses; + /* FIXME: introducing speculation causes out of bounds access here. */ + if (vec_safe_length (info->descriptors) > (unsigned)i) + return (*info->descriptors)[i].controlled_uses; return IPA_UNDESCRIBED_USE; } @@ -484,7 +486,8 @@ ipa_get_controlled_uses (struct ipa_node_params *info, int i) static inline void ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val) { - info->descriptors[i].controlled_uses = val; + gcc_checking_assert (info->descriptors); + (*info->descriptors)[i].controlled_uses = val; } /* Return the used flag corresponding to the Ith formal parameter of the @@ -493,7 +496,8 @@ ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val) static inline bool ipa_is_param_used (struct ipa_node_params *info, int i) { - return info->descriptors[i].used; + gcc_checking_assert (info->descriptors); + return (*info->descriptors)[i].used; } /* Information about replacements done in aggregates for a given node (each @@ -569,12 +573,16 @@ ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i) } /* Function summary for ipa_node_params. */ -class ipa_node_params_t: public function_summary <ipa_node_params *> +class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *> { public: - ipa_node_params_t (symbol_table *table): - function_summary<ipa_node_params *> (table) { } + ipa_node_params_t (symbol_table *table, bool ggc): + function_summary<ipa_node_params *> (table, ggc) { } + /* Hook that is called by summary when a node is deleted. */ + virtual void insert (cgraph_node *, ipa_node_params *info); + /* Hook that is called by summary when a node is deleted. */ + virtual void remove (cgraph_node *, ipa_node_params *info); /* Hook that is called by summary when a node is duplicated. */ virtual void duplicate (cgraph_node *node, cgraph_node *node2, @@ -583,12 +591,14 @@ public: }; /* Function summary where the parameter infos are actually stored. */ -extern ipa_node_params_t *ipa_node_params_sum; +extern GTY(()) ipa_node_params_t * ipa_node_params_sum; + /* Vector of IPA-CP transformation data for each clone. */ extern GTY(()) vec<ipcp_transformation_summary, va_gc> *ipcp_transformations; /* Vector where the parameter infos are actually stored. */ extern GTY(()) vec<ipa_edge_args, va_gc> *ipa_edge_args_vector; + /* Return the associated parameter/argument info corresponding to the given node/edge. */ #define IPA_NODE_REF(NODE) (ipa_node_params_sum->get (NODE)) @@ -616,7 +626,9 @@ static inline void ipa_check_create_node_params (void) { if (!ipa_node_params_sum) - ipa_node_params_sum = new ipa_node_params_t (symtab); + ipa_node_params_sum + = (new (ggc_cleared_alloc <ipa_node_params_t> ()) + ipa_node_params_t (symtab, true)); } /* This function ensures the array of edge arguments infos is big enough to @@ -680,7 +692,7 @@ tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg, tree scalar, HOST_WIDE_INT offset, bool by_ref, bool *from_global_constant = NULL); bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi, - vec<ipa_param_descriptor> descriptors, + vec<ipa_param_descriptor, va_gc> *descriptors, gimple *stmt, tree op, int *index_p, HOST_WIDE_INT *offset_p, HOST_WIDE_INT *size_p, bool *by_ref, bool *guaranteed_unmodified = NULL); |