Commit 9d3e0adc by Martin Liska Committed by Martin Liska

Convert IPA CP to symbol_summary.

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.

From-SVN: r261314
parent 36330f82
2018-06-08 Martin Liska <mliska@suse.cz> 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 * ipa-pure-const.c (struct funct_state_d): Do it class instead
of struct. of struct.
(class funct_state_summary_t): New function_summary class. (class funct_state_summary_t): New function_summary class.
......
...@@ -4949,8 +4949,8 @@ ipcp_store_bits_results (void) ...@@ -4949,8 +4949,8 @@ ipcp_store_bits_results (void)
if (!found_useful_result) if (!found_useful_result)
continue; continue;
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
vec_safe_reserve_exact (ts->bits, count); vec_safe_reserve_exact (ts->bits, count);
for (unsigned i = 0; i < count; i++) for (unsigned i = 0; i < count; i++)
...@@ -5022,8 +5022,8 @@ ipcp_store_vr_results (void) ...@@ -5022,8 +5022,8 @@ ipcp_store_vr_results (void)
if (!found_useful_result) if (!found_useful_result)
continue; continue;
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
vec_safe_reserve_exact (ts->m_vr, count); vec_safe_reserve_exact (ts->m_vr, count);
for (unsigned i = 0; i < count; i++) for (unsigned i = 0; i < count; i++)
......
...@@ -55,8 +55,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -55,8 +55,9 @@ along with GCC; see the file COPYING3. If not see
/* Function summary where the parameter infos are actually stored. */ /* Function summary where the parameter infos are actually stored. */
ipa_node_params_t *ipa_node_params_sum = NULL; 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. */ /* Edge summary for IPA-CP edge information. */
ipa_edge_args_sum_t *ipa_edge_args_sum; ipa_edge_args_sum_t *ipa_edge_args_sum;
...@@ -3729,19 +3730,18 @@ ipa_free_all_node_params (void) ...@@ -3729,19 +3730,18 @@ ipa_free_all_node_params (void)
ipa_node_params_sum = NULL; 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. */ tables if they do not already exist. */
void 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) if (!ipa_bits_hash_table)
ipa_bits_hash_table = hash_table<ipa_bit_ggc_hash_traits>::create_ggc (37); ipa_bits_hash_table = hash_table<ipa_bit_ggc_hash_traits>::create_ggc (37);
if (!ipa_vr_hash_table) if (!ipa_vr_hash_table)
ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37); 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. */ /* Set the aggregate replacements of NODE to be AGGVALS. */
...@@ -3750,8 +3750,9 @@ void ...@@ -3750,8 +3750,9 @@ void
ipa_set_node_agg_value_chain (struct cgraph_node *node, ipa_set_node_agg_value_chain (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggvals) struct ipa_agg_replacement_value *aggvals)
{ {
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
(*ipcp_transformations)[node->uid].agg_values = aggvals; 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 /* Hook that is called by cgraph.c when an edge is removed. Adjust reference
...@@ -3915,15 +3916,14 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst, ...@@ -3915,15 +3916,14 @@ ipa_node_params_t::duplicate(cgraph_node *src, cgraph_node *dst,
ipa_set_node_agg_value_chain (dst, new_av); ipa_set_node_agg_value_chain (dst, new_av);
} }
ipcp_transformation_summary *src_trans ipcp_transformation *src_trans = ipcp_get_transformation_summary (src);
= ipcp_get_transformation_summary (src);
if (src_trans) if (src_trans)
{ {
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
src_trans = ipcp_get_transformation_summary (src); src_trans = ipcp_transformation_sum->get_create (src);
ipcp_transformation_summary *dst_trans ipcp_transformation *dst_trans
= ipcp_get_transformation_summary (dst); = ipcp_transformation_sum->get_create (dst);
dst_trans->bits = vec_safe_copy (src_trans->bits); dst_trans->bits = vec_safe_copy (src_trans->bits);
...@@ -4565,7 +4565,7 @@ write_ipcp_transformation_info (output_block *ob, cgraph_node *node) ...@@ -4565,7 +4565,7 @@ write_ipcp_transformation_info (output_block *ob, cgraph_node *node)
streamer_write_bitpack (&bp); 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) if (ts && vec_safe_length (ts->m_vr) > 0)
{ {
count = ts->m_vr->length (); count = ts->m_vr->length ();
...@@ -4640,9 +4640,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, ...@@ -4640,9 +4640,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
count = streamer_read_uhwi (ib); count = streamer_read_uhwi (ib);
if (count > 0) if (count > 0)
{ {
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
vec_safe_grow_cleared (ts->m_vr, count); vec_safe_grow_cleared (ts->m_vr, count);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
...@@ -4663,9 +4662,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, ...@@ -4663,9 +4662,8 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
count = streamer_read_uhwi (ib); count = streamer_read_uhwi (ib);
if (count > 0) if (count > 0)
{ {
ipcp_grow_transformations_if_necessary (); ipcp_transformation_initialize ();
ipcp_transformation *ts = ipcp_transformation_sum->get_create (node);
ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node);
vec_safe_grow_cleared (ts->bits, count); vec_safe_grow_cleared (ts->bits, count);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
...@@ -4932,14 +4930,14 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb) ...@@ -4932,14 +4930,14 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb)
} }
/* Update bits info of formal parameters as described in /* Update bits info of formal parameters as described in
ipcp_transformation_summary. */ ipcp_transformation. */
static void static void
ipcp_update_bits (struct cgraph_node *node) ipcp_update_bits (struct cgraph_node *node)
{ {
tree parm = DECL_ARGUMENTS (node->decl); tree parm = DECL_ARGUMENTS (node->decl);
tree next_parm = parm; 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) if (!ts || vec_safe_length (ts->bits) == 0)
return; return;
...@@ -5024,7 +5022,7 @@ ipcp_update_bits (struct cgraph_node *node) ...@@ -5024,7 +5022,7 @@ ipcp_update_bits (struct cgraph_node *node)
} }
/* Update value range of formal parameters as described in /* Update value range of formal parameters as described in
ipcp_transformation_summary. */ ipcp_transformation. */
static void static void
ipcp_update_vr (struct cgraph_node *node) ipcp_update_vr (struct cgraph_node *node)
...@@ -5032,7 +5030,7 @@ ipcp_update_vr (struct cgraph_node *node) ...@@ -5032,7 +5030,7 @@ ipcp_update_vr (struct cgraph_node *node)
tree fndecl = node->decl; tree fndecl = node->decl;
tree parm = DECL_ARGUMENTS (fndecl); tree parm = DECL_ARGUMENTS (fndecl);
tree next_parm = parm; 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) if (!ts || vec_safe_length (ts->m_vr) == 0)
return; return;
const vec<ipa_vr, va_gc> &vr = *ts->m_vr; const vec<ipa_vr, va_gc> &vr = *ts->m_vr;
...@@ -5135,9 +5133,11 @@ ipcp_transform_function (struct cgraph_node *node) ...@@ -5135,9 +5133,11 @@ ipcp_transform_function (struct cgraph_node *node)
free_ipa_bb_info (bi); free_ipa_bb_info (bi);
fbi.bb_infos.release (); fbi.bb_infos.release ();
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);
(*ipcp_transformations)[node->uid].agg_values = NULL;
(*ipcp_transformations)[node->uid].bits = NULL; ipcp_transformation *s = ipcp_transformation_sum->get (node);
(*ipcp_transformations)[node->uid].m_vr = NULL; s->agg_values = NULL;
s->bits = NULL;
s->m_vr = NULL;
vec_free (descriptors); vec_free (descriptors);
......
...@@ -544,7 +544,7 @@ struct GTY(()) ipa_agg_replacement_value ...@@ -544,7 +544,7 @@ struct GTY(()) ipa_agg_replacement_value
/* Structure holding information for the transformation phase of IPA-CP. */ /* 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. */ /* Linked list of known aggregate values. */
ipa_agg_replacement_value *agg_values; ipa_agg_replacement_value *agg_values;
...@@ -556,7 +556,7 @@ struct GTY(()) ipcp_transformation_summary ...@@ -556,7 +556,7 @@ struct GTY(()) ipcp_transformation_summary
void ipa_set_node_agg_value_chain (struct cgraph_node *node, void ipa_set_node_agg_value_chain (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggvals); 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 /* ipa_edge_args stores information related to a callsite and particularly its
arguments. It can be accessed by the IPA_EDGE_REF macro. */ arguments. It can be accessed by the IPA_EDGE_REF macro. */
...@@ -649,8 +649,27 @@ extern GTY(()) ipa_node_params_t * ipa_node_params_sum; ...@@ -649,8 +649,27 @@ extern GTY(()) ipa_node_params_t * ipa_node_params_sum;
/* Call summary to store information about edges such as jump functions. */ /* Call summary to store information about edges such as jump functions. */
extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum; extern GTY(()) ipa_edge_args_sum_t *ipa_edge_args_sum;
/* Vector of IPA-CP transformation data for each clone. */ /* Function summary for IPA-CP transformation. */
extern GTY(()) vec<ipcp_transformation_summary, va_gc> *ipcp_transformations; 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 /* Return the associated parameter/argument info corresponding to the given
node/edge. */ node/edge. */
...@@ -694,12 +713,13 @@ ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge) ...@@ -694,12 +713,13 @@ ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge)
return ipa_edge_args_sum->exists (edge); return ipa_edge_args_sum->exists (edge);
} }
static inline ipcp_transformation_summary * static inline ipcp_transformation *
ipcp_get_transformation_summary (cgraph_node *node) ipcp_get_transformation_summary (cgraph_node *node)
{ {
if ((unsigned) node->uid >= vec_safe_length (ipcp_transformations)) if (ipcp_transformation_sum == NULL)
return NULL; return NULL;
return &(*ipcp_transformations)[node->uid];
return ipcp_transformation_sum->get (node);
} }
/* Return the aggregate replacements for NODE, if there are any. */ /* Return the aggregate replacements for NODE, if there are any. */
...@@ -707,7 +727,7 @@ ipcp_get_transformation_summary (cgraph_node *node) ...@@ -707,7 +727,7 @@ ipcp_get_transformation_summary (cgraph_node *node)
static inline struct ipa_agg_replacement_value * static inline struct ipa_agg_replacement_value *
ipa_get_agg_replacements_for_node (cgraph_node *node) 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; return ts ? ts->agg_values : NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment