2018-06-08 Martin Liska <mliska@suse.cz>
+ * ipa-cp.c (ipcp_store_bits_results): Use
+ ipcp_transformation_sum.
+ (ipcp_store_vr_results): Likewise.
+ * ipa-prop.c (ipcp_grow_transformations_if_necessary): Renamed
+ to ...
+ (ipcp_transformation_initialize): ... this.
+ (ipa_set_node_agg_value_chain):
+ (ipa_node_params_t::duplicate): Use ipcp_transformation_sum.
+ (write_ipcp_transformation_info): Likewise.
+ (read_ipcp_transformation_info): Likewise.
+ (ipcp_update_bits): Likewise.
+ (ipcp_update_vr): Likewise.
+ (ipcp_transform_function): Likewise.
+ * ipa-prop.h: Rename ipcp_transformation_summary to
+ ipcp_transformation.
+ (class ipcp_transformation_t): New function summary.
+ (ipcp_get_transformation_summary): Use ipcp_transformation_sum.
+ (ipa_get_agg_replacements_for_node): Likewise.
+
+2018-06-08 Martin Liska <mliska@suse.cz>
+
* ipa-pure-const.c (struct funct_state_d): Do it class instead
of struct.
(class funct_state_summary_t): New function_summary class.
/* Function summary where the parameter infos are actually stored. */
ipa_node_params_t *ipa_node_params_sum = NULL;
-/* Vector of IPA-CP transformation data for each clone. */
-vec<ipcp_transformation_summary, va_gc> *ipcp_transformations;
+
+function_summary <ipcp_transformation *> *ipcp_transformation_sum = NULL;
+
/* Edge summary for IPA-CP edge information. */
ipa_edge_args_sum_t *ipa_edge_args_sum;
ipa_node_params_sum = NULL;
}
-/* Grow ipcp_transformations if necessary. Also allocate any necessary hash
+/* Initialize IPA CP transformation summary and also allocate any necessary hash
tables if they do not already exist. */
void
-ipcp_grow_transformations_if_necessary (void)
+ipcp_transformation_initialize (void)
{
- if (vec_safe_length (ipcp_transformations)
- <= (unsigned) symtab->cgraph_max_uid)
- vec_safe_grow_cleared (ipcp_transformations, symtab->cgraph_max_uid + 1);
if (!ipa_bits_hash_table)
ipa_bits_hash_table = hash_table<ipa_bit_ggc_hash_traits>::create_ggc (37);
if (!ipa_vr_hash_table)
ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
+ if (ipcp_transformation_sum == NULL)
+ ipcp_transformation_sum = ipcp_transformation_t::create_ggc (symtab);
}
/* Set the aggregate replacements of NODE to be AGGVALS. */
ipa_set_node_agg_value_chain (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggvals)
{
- ipcp_grow_transformations_if_necessary ();
- (*ipcp_transformations)[node->uid].agg_values = aggvals;
+ ipcp_transformation_initialize ();
+ ipcp_transformation *s = ipcp_transformation_sum->get_create (node);
+ s->agg_values = aggvals;
}
/* Hook that is called by cgraph.c when an edge is removed. Adjust reference
ipa_set_node_agg_value_chain (dst, new_av);
}
- ipcp_transformation_summary *src_trans
- = ipcp_get_transformation_summary (src);
+ ipcp_transformation *src_trans = ipcp_get_transformation_summary (src);
if (src_trans)
{
- ipcp_grow_transformations_if_necessary ();
- src_trans = ipcp_get_transformation_summary (src);
- ipcp_transformation_summary *dst_trans
- = ipcp_get_transformation_summary (dst);
+ ipcp_transformation_initialize ();
+ src_trans = ipcp_transformation_sum->get_create (src);
+ ipcp_transformation *dst_trans
+ = ipcp_transformation_sum->get_create (dst);
dst_trans->bits = vec_safe_copy (src_trans->bits);
streamer_write_bitpack (&bp);
}
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation *ts = ipcp_get_transformation_summary (node);
if (ts && vec_safe_length (ts->m_vr) > 0)
{
count = ts->m_vr->length ();
count = streamer_read_uhwi (ib);
if (count > 0)
{
- ipcp_grow_transformations_if_necessary ();
-
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation_initialize ();
+ ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
vec_safe_grow_cleared (ts->m_vr, count);
for (i = 0; i < count; i++)
{
count = streamer_read_uhwi (ib);
if (count > 0)
{
- ipcp_grow_transformations_if_necessary ();
-
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation_initialize ();
+ ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
vec_safe_grow_cleared (ts->bits, count);
for (i = 0; i < count; i++)
}
/* Update bits info of formal parameters as described in
- ipcp_transformation_summary. */
+ ipcp_transformation. */
static void
ipcp_update_bits (struct cgraph_node *node)
{
tree parm = DECL_ARGUMENTS (node->decl);
tree next_parm = parm;
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation *ts = ipcp_get_transformation_summary (node);
if (!ts || vec_safe_length (ts->bits) == 0)
return;
}
/* Update value range of formal parameters as described in
- ipcp_transformation_summary. */
+ ipcp_transformation. */
static void
ipcp_update_vr (struct cgraph_node *node)
tree fndecl = node->decl;
tree parm = DECL_ARGUMENTS (fndecl);
tree next_parm = parm;
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation *ts = ipcp_get_transformation_summary (node);
if (!ts || vec_safe_length (ts->m_vr) == 0)
return;
const vec<ipa_vr, va_gc> &vr = *ts->m_vr;
free_ipa_bb_info (bi);
fbi.bb_infos.release ();
free_dominance_info (CDI_DOMINATORS);
- (*ipcp_transformations)[node->uid].agg_values = NULL;
- (*ipcp_transformations)[node->uid].bits = NULL;
- (*ipcp_transformations)[node->uid].m_vr = NULL;
+
+ ipcp_transformation *s = ipcp_transformation_sum->get (node);
+ s->agg_values = NULL;
+ s->bits = NULL;
+ s->m_vr = NULL;
vec_free (descriptors);
/* Structure holding information for the transformation phase of IPA-CP. */
-struct GTY(()) ipcp_transformation_summary
+struct GTY(()) ipcp_transformation
{
/* Linked list of known aggregate values. */
ipa_agg_replacement_value *agg_values;
void ipa_set_node_agg_value_chain (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggvals);
-void ipcp_grow_transformations_if_necessary (void);
+void ipcp_transformation_initialize (void);
/* ipa_edge_args stores information related to a callsite and particularly its
arguments. It can be accessed by the IPA_EDGE_REF macro. */
/* Call summary to store information about edges such as jump functions. */
extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum;
-/* Vector of IPA-CP transformation data for each clone. */
-extern GTY(()) vec<ipcp_transformation_summary, va_gc> *ipcp_transformations;
+/* Function summary for IPA-CP transformation. */
+class ipcp_transformation_t
+: public function_summary<ipcp_transformation *>
+{
+public:
+ ipcp_transformation_t (symbol_table *table, bool ggc):
+ function_summary<ipcp_transformation *> (table, ggc) {}
+
+ ~ipcp_transformation_t () {}
+
+ static ipcp_transformation_t *create_ggc (symbol_table *symtab)
+ {
+ ipcp_transformation_t *summary
+ = new (ggc_cleared_alloc <ipcp_transformation_t> ())
+ ipcp_transformation_t (symtab, true);
+ return summary;
+ }
+};
+
+/* Function summary where the IPA CP transformations are actually stored. */
+extern GTY(()) function_summary <ipcp_transformation *> *ipcp_transformation_sum;
/* Return the associated parameter/argument info corresponding to the given
node/edge. */
return ipa_edge_args_sum->exists (edge);
}
-static inline ipcp_transformation_summary *
+static inline ipcp_transformation *
ipcp_get_transformation_summary (cgraph_node *node)
{
- if ((unsigned) node->uid >= vec_safe_length (ipcp_transformations))
+ if (ipcp_transformation_sum == NULL)
return NULL;
- return &(*ipcp_transformations)[node->uid];
+
+ return ipcp_transformation_sum->get (node);
}
/* Return the aggregate replacements for NODE, if there are any. */
static inline struct ipa_agg_replacement_value *
ipa_get_agg_replacements_for_node (cgraph_node *node)
{
- ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
+ ipcp_transformation *ts = ipcp_get_transformation_summary (node);
return ts ? ts->agg_values : NULL;
}