tree-pass.h (write_summary, [...]): Remove set and vset arguments.
* tree-pass.h (write_summary, write_optimization_summary): Remove set and vset arguments. * ipa-cp.c (ipcp_write_summary): Remove set and vset arugments. (write_node_summary_p): Likewise; use the encoder. (ipa_reference_write_optimization_summary): Likewise. * lto-cgraph.c (output_cgraph_opt_summary): Use encoder. (lto_symtab_encoder_new): Initialize in_partition field. (lto_symtab_encoder_delete): Destroy in_partition field. (LCC_NOT_FOUND): Move to lto-streamer.h (lto_symtab_encoder_deref): Likewise. (lto_symtab_encoder_in_partition_p, lto_set_symtab_encoder_in_partition): New functions. (referenced_from_other_partition_p): Rewrite to use encoder. (reachable_from_other_partition_p): Likewise. (referenced_from_this_partition_p): Likewise. (reachable_from_this_partition_p): Likewise. (lto_output_node): Likewise. (lto_output_varpool_node): Likewise. (output_refs): Likewise. (compute_ltrans_boundary): Initialize in_partition fileds of the encoder. (output_symtab): Likewise. (input_refs): Match the changes in output_refs. (output_cgraph_opt_summary_p): Remove set argument. (output_node_opt_summary): Replace set by encoder. (output_cgraph_opt_summary): Remove set argument; use the encoder. * ipa-pure-const.c (pure_const_write_summary): Remove set and vset arguments; use the encoder. * lto-streamer-out.c (lto_output): Remove set and vset argument; use the encoder. (produce_symtab): Likewise. * ipa-inline.h (inline_write_summary): Remove set and vset arguments. * ipa-inline-analysis.c (inline_write_summary): Likewise. * ipa-prop.c (ipa_prop_write_jump_functions): Remove set argument; use encoder. * ipa-prop.h (ipa_prop_write_jump_functions): Likewise. * passes.c (ipa_write_summaries_2): Remove set and vset arguments. (ipa_write_summaries_1): Update. (ipa_write_optimization_summaries_1): Likewise. (ipa_write_optimization_summaries): Likewise. * lto-streamer.h (lto_symtab_encoder_t): Add in_partition. (lto_symtab_encoder_iterator): New type. (lto_symtab_encoder_deref): Make inline. (output_symtab, referenced_from_other_partition_p, reachable_from_other_partition_p, referenced_from_this_partition_p, reachable_from_this_partition_p): Update. (lsei_end_p, lsei_next, lsei_node, lsei_cgraph_node, lsei_varpool_node): New inline functions. (LCC_NOT_FOUND): New macro. (lto_symtab_encoder_deref, lsei_start, lsei_next_in_partition, lsei_start_in_partition, lsei_next_function_in_partition, lsei_start_function_in_partition, lsei_next_variable_in_partition, lsei_start_variable_in_partition): New inline functions. * lto-partition.c (set_referenced_from_other_partition_p, set_reachable_from_other_partition_p, set_referenced_from_this_partition_p): New functions. (lto_promote_cross_file_statics): Use them. From-SVN: r190336
This commit is contained in:
parent
56142d02b3
commit
f27c186710
15 changed files with 422 additions and 189 deletions
|
@ -1,3 +1,60 @@
|
|||
2012-08-12 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* tree-pass.h (write_summary, write_optimization_summary): Remove
|
||||
set and vset arguments.
|
||||
* ipa-cp.c (ipcp_write_summary): Remove set and vset arugments.
|
||||
(write_node_summary_p): Likewise; use the encoder.
|
||||
(ipa_reference_write_optimization_summary): Likewise.
|
||||
* lto-cgraph.c (output_cgraph_opt_summary): Use encoder.
|
||||
(lto_symtab_encoder_new): Initialize in_partition field.
|
||||
(lto_symtab_encoder_delete): Destroy in_partition field.
|
||||
(LCC_NOT_FOUND): Move to lto-streamer.h
|
||||
(lto_symtab_encoder_deref): Likewise.
|
||||
(lto_symtab_encoder_in_partition_p,
|
||||
lto_set_symtab_encoder_in_partition): New functions.
|
||||
(referenced_from_other_partition_p): Rewrite to use encoder.
|
||||
(reachable_from_other_partition_p): Likewise.
|
||||
(referenced_from_this_partition_p): Likewise.
|
||||
(reachable_from_this_partition_p): Likewise.
|
||||
(lto_output_node): Likewise.
|
||||
(lto_output_varpool_node): Likewise.
|
||||
(output_refs): Likewise.
|
||||
(compute_ltrans_boundary): Initialize in_partition fileds of
|
||||
the encoder.
|
||||
(output_symtab): Likewise.
|
||||
(input_refs): Match the changes in output_refs.
|
||||
(output_cgraph_opt_summary_p): Remove set argument.
|
||||
(output_node_opt_summary): Replace set by encoder.
|
||||
(output_cgraph_opt_summary): Remove set argument; use
|
||||
the encoder.
|
||||
* ipa-pure-const.c (pure_const_write_summary): Remove set and vset
|
||||
arguments; use the encoder.
|
||||
* lto-streamer-out.c (lto_output): Remove set and vset argument; use
|
||||
the encoder.
|
||||
(produce_symtab): Likewise.
|
||||
* ipa-inline.h (inline_write_summary): Remove set and vset arguments.
|
||||
* ipa-inline-analysis.c (inline_write_summary): Likewise.
|
||||
* ipa-prop.c (ipa_prop_write_jump_functions): Remove set argument;
|
||||
use encoder.
|
||||
* ipa-prop.h (ipa_prop_write_jump_functions): Likewise.
|
||||
* passes.c (ipa_write_summaries_2): Remove set and vset arguments.
|
||||
(ipa_write_summaries_1): Update.
|
||||
(ipa_write_optimization_summaries_1): Likewise.
|
||||
(ipa_write_optimization_summaries): Likewise.
|
||||
* lto-streamer.h (lto_symtab_encoder_t): Add in_partition.
|
||||
(lto_symtab_encoder_iterator): New type.
|
||||
(lto_symtab_encoder_deref): Make inline.
|
||||
(output_symtab, referenced_from_other_partition_p,
|
||||
reachable_from_other_partition_p, referenced_from_this_partition_p,
|
||||
reachable_from_this_partition_p): Update.
|
||||
(lsei_end_p, lsei_next, lsei_node, lsei_cgraph_node, lsei_varpool_node): New
|
||||
inline functions.
|
||||
(LCC_NOT_FOUND): New macro.
|
||||
(lto_symtab_encoder_deref, lsei_start, lsei_next_in_partition,
|
||||
lsei_start_in_partition, lsei_next_function_in_partition,
|
||||
lsei_start_function_in_partition, lsei_next_variable_in_partition,
|
||||
lsei_start_variable_in_partition): New inline functions.
|
||||
|
||||
2012-08-12 Oleg Endo <olegendo@gcc.gnu.org>
|
||||
|
||||
* config/sh/sh.md (prefetch): Simplify expander. Fix condition to
|
||||
|
|
|
@ -2508,10 +2508,9 @@ ipcp_generate_summary (void)
|
|||
/* Write ipcp summary for nodes in SET. */
|
||||
|
||||
static void
|
||||
ipcp_write_summary (cgraph_node_set set,
|
||||
varpool_node_set vset ATTRIBUTE_UNUSED)
|
||||
ipcp_write_summary (void)
|
||||
{
|
||||
ipa_prop_write_jump_functions (set);
|
||||
ipa_prop_write_jump_functions ();
|
||||
}
|
||||
|
||||
/* Read ipcp summary. */
|
||||
|
|
|
@ -3358,8 +3358,7 @@ write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
|
|||
active, we don't need to write them twice. */
|
||||
|
||||
void
|
||||
inline_write_summary (cgraph_node_set set,
|
||||
varpool_node_set vset ATTRIBUTE_UNUSED)
|
||||
inline_write_summary (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
symtab_node snode;
|
||||
|
@ -3426,7 +3425,7 @@ inline_write_summary (cgraph_node_set set,
|
|||
destroy_output_block (ob);
|
||||
|
||||
if (optimize && !flag_ipa_cp)
|
||||
ipa_prop_write_jump_functions (set);
|
||||
ipa_prop_write_jump_functions ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ void dump_inline_summaries (FILE *f);
|
|||
void dump_inline_summary (FILE * f, struct cgraph_node *node);
|
||||
void inline_generate_summary (void);
|
||||
void inline_read_summary (void);
|
||||
void inline_write_summary (cgraph_node_set, varpool_node_set);
|
||||
void inline_write_summary (void);
|
||||
void inline_free_summary (void);
|
||||
void initialize_inline_failed (struct cgraph_edge *);
|
||||
int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *);
|
||||
|
|
|
@ -3391,21 +3391,25 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
|
|||
/* Write jump functions for nodes in SET. */
|
||||
|
||||
void
|
||||
ipa_prop_write_jump_functions (cgraph_node_set set)
|
||||
ipa_prop_write_jump_functions (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
struct output_block *ob;
|
||||
unsigned int count = 0;
|
||||
cgraph_node_set_iterator csi;
|
||||
lto_symtab_encoder_iterator lsei;
|
||||
lto_symtab_encoder_t encoder;
|
||||
|
||||
|
||||
if (!ipa_node_params_vector)
|
||||
return;
|
||||
|
||||
ob = create_output_block (LTO_section_jump_functions);
|
||||
encoder = ob->decl_state->symtab_node_encoder;
|
||||
ob->cgraph_node = NULL;
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_function_in_partition (&lsei))
|
||||
{
|
||||
node = csi_node (csi);
|
||||
node = lsei_cgraph_node (lsei);
|
||||
if (cgraph_function_with_gimple_body_p (node)
|
||||
&& IPA_NODE_REF (node) != NULL)
|
||||
count++;
|
||||
|
@ -3414,9 +3418,10 @@ ipa_prop_write_jump_functions (cgraph_node_set set)
|
|||
streamer_write_uhwi (ob, count);
|
||||
|
||||
/* Process all of the functions. */
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_function_in_partition (&lsei))
|
||||
{
|
||||
node = csi_node (csi);
|
||||
node = lsei_cgraph_node (lsei);
|
||||
if (cgraph_function_with_gimple_body_p (node)
|
||||
&& IPA_NODE_REF (node) != NULL)
|
||||
ipa_write_node_info (ob, node);
|
||||
|
|
|
@ -590,7 +590,7 @@ ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
|
|||
ipa_parm_adjustment_vec);
|
||||
void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
|
||||
|
||||
void ipa_prop_write_jump_functions (cgraph_node_set set);
|
||||
void ipa_prop_write_jump_functions (void);
|
||||
void ipa_prop_read_jump_functions (void);
|
||||
void ipa_update_after_lto_read (void);
|
||||
int ipa_get_param_decl_index (struct ipa_node_params *, tree);
|
||||
|
|
|
@ -935,18 +935,21 @@ generate_summary (void)
|
|||
/* Serialize the ipa info for lto. */
|
||||
|
||||
static void
|
||||
pure_const_write_summary (cgraph_node_set set,
|
||||
varpool_node_set vset ATTRIBUTE_UNUSED)
|
||||
pure_const_write_summary (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
struct lto_simple_output_block *ob
|
||||
= lto_create_simple_output_block (LTO_section_ipa_pure_const);
|
||||
unsigned int count = 0;
|
||||
cgraph_node_set_iterator csi;
|
||||
lto_symtab_encoder_iterator lsei;
|
||||
lto_symtab_encoder_t encoder;
|
||||
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
encoder = lto_get_out_decl_state ()->symtab_node_encoder;
|
||||
|
||||
for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_function_in_partition (&lsei))
|
||||
{
|
||||
node = csi_node (csi);
|
||||
node = lsei_cgraph_node (lsei);
|
||||
if (node->analyzed && has_function_state (node))
|
||||
count++;
|
||||
}
|
||||
|
@ -954,9 +957,10 @@ pure_const_write_summary (cgraph_node_set set,
|
|||
streamer_write_uhwi_stream (ob->main_stream, count);
|
||||
|
||||
/* Process all of the functions. */
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_function_in_partition (&lsei))
|
||||
{
|
||||
node = csi_node (csi);
|
||||
node = lsei_cgraph_node (lsei);
|
||||
if (node->analyzed && has_function_state (node))
|
||||
{
|
||||
struct bitpack_d bp;
|
||||
|
|
|
@ -956,8 +956,7 @@ propagate (void)
|
|||
|
||||
static bool
|
||||
write_node_summary_p (struct cgraph_node *node,
|
||||
cgraph_node_set set,
|
||||
varpool_node_set vset,
|
||||
lto_symtab_encoder_t encoder,
|
||||
bitmap ltrans_statics)
|
||||
{
|
||||
ipa_reference_optimization_summary_t info;
|
||||
|
@ -976,8 +975,8 @@ write_node_summary_p (struct cgraph_node *node,
|
|||
|
||||
In future we might also want to include summaries of functions references
|
||||
by initializers of constant variables references in current unit. */
|
||||
if (!reachable_from_this_partition_p (node, set)
|
||||
&& !referenced_from_this_partition_p (&node->symbol.ref_list, set, vset))
|
||||
if (!reachable_from_this_partition_p (node, encoder)
|
||||
&& !referenced_from_this_partition_p (&node->symbol.ref_list, encoder))
|
||||
return false;
|
||||
|
||||
/* See if the info has non-empty intersections with vars we want to encode. */
|
||||
|
@ -1025,8 +1024,7 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
|
|||
/* Serialize the ipa info for lto. */
|
||||
|
||||
static void
|
||||
ipa_reference_write_optimization_summary (cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
ipa_reference_write_optimization_summary (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
symtab_node snode;
|
||||
|
@ -1049,7 +1047,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
|
|||
continue;
|
||||
vnode = varpool (snode);
|
||||
if (bitmap_bit_p (all_module_statics, DECL_UID (vnode->symbol.decl))
|
||||
&& referenced_from_this_partition_p (&vnode->symbol.ref_list, set, vset))
|
||||
&& referenced_from_this_partition_p (&vnode->symbol.ref_list, encoder))
|
||||
{
|
||||
tree decl = vnode->symbol.decl;
|
||||
bitmap_set_bit (ltrans_statics, DECL_UID (decl));
|
||||
|
@ -1064,7 +1062,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
|
|||
for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
|
||||
if (symtab_function_p (snode = lto_symtab_encoder_deref (encoder, i))
|
||||
&& write_node_summary_p (cgraph (snode),
|
||||
set, vset, ltrans_statics))
|
||||
encoder, ltrans_statics))
|
||||
count++;
|
||||
|
||||
streamer_write_uhwi_stream (ob->main_stream, count);
|
||||
|
@ -1080,7 +1078,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
|
|||
if (!symtab_function_p (snode))
|
||||
continue;
|
||||
node = cgraph (snode);
|
||||
if (write_node_summary_p (node, set, vset, ltrans_statics))
|
||||
if (write_node_summary_p (node, encoder, ltrans_statics))
|
||||
{
|
||||
ipa_reference_optimization_summary_t info;
|
||||
int node_ref;
|
||||
|
|
188
gcc/lto-cgraph.c
188
gcc/lto-cgraph.c
|
@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-streamer.h"
|
||||
#include "gcov-io.h"
|
||||
|
||||
static void output_cgraph_opt_summary (cgraph_node_set set);
|
||||
static void output_cgraph_opt_summary (void);
|
||||
static void input_cgraph_opt_summary (VEC (symtab_node, heap) * nodes);
|
||||
|
||||
/* Number of LDPR values known to GCC. */
|
||||
|
@ -82,6 +82,7 @@ lto_symtab_encoder_new (void)
|
|||
encoder->nodes = NULL;
|
||||
encoder->body = pointer_set_create ();
|
||||
encoder->initializer = pointer_set_create ();
|
||||
encoder->in_partition = pointer_set_create ();
|
||||
return encoder;
|
||||
}
|
||||
|
||||
|
@ -95,6 +96,7 @@ lto_symtab_encoder_delete (lto_symtab_encoder_t encoder)
|
|||
pointer_map_destroy (encoder->map);
|
||||
pointer_set_destroy (encoder->body);
|
||||
pointer_set_destroy (encoder->initializer);
|
||||
pointer_set_destroy (encoder->in_partition);
|
||||
free (encoder);
|
||||
}
|
||||
|
||||
|
@ -124,7 +126,6 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder,
|
|||
return ref;
|
||||
}
|
||||
|
||||
#define LCC_NOT_FOUND (-1)
|
||||
|
||||
/* Look up NODE in encoder. Return NODE's reference if it has been encoded
|
||||
or LCC_NOT_FOUND if it is not there. */
|
||||
|
@ -138,18 +139,6 @@ lto_symtab_encoder_lookup (lto_symtab_encoder_t encoder,
|
|||
}
|
||||
|
||||
|
||||
/* Return the cgraph node corresponding to REF using ENCODER. */
|
||||
|
||||
symtab_node
|
||||
lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref)
|
||||
{
|
||||
if (ref == LCC_NOT_FOUND)
|
||||
return NULL;
|
||||
|
||||
return VEC_index (symtab_node, encoder->nodes, ref);
|
||||
}
|
||||
|
||||
|
||||
/* Return TRUE if we should encode initializer of NODE (if any). */
|
||||
|
||||
bool
|
||||
|
@ -186,6 +175,25 @@ lto_set_symtab_encoder_encode_initializer (lto_symtab_encoder_t encoder,
|
|||
pointer_set_insert (encoder->initializer, node);
|
||||
}
|
||||
|
||||
/* Return TRUE if we should encode initializer of NODE (if any). */
|
||||
|
||||
bool
|
||||
lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t encoder,
|
||||
symtab_node node)
|
||||
{
|
||||
return pointer_set_contains (encoder->in_partition, node);
|
||||
}
|
||||
|
||||
/* Return TRUE if we should encode body of NODE (if any). */
|
||||
|
||||
void
|
||||
lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t encoder,
|
||||
symtab_node node)
|
||||
{
|
||||
lto_symtab_encoder_encode (encoder, (symtab_node)node);
|
||||
pointer_set_insert (encoder->in_partition, node);
|
||||
}
|
||||
|
||||
/* Output the cgraph EDGE to OB using ENCODER. */
|
||||
|
||||
static void
|
||||
|
@ -248,26 +256,15 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
|
|||
/* Return if LIST contain references from other partitions. */
|
||||
|
||||
bool
|
||||
referenced_from_other_partition_p (struct ipa_ref_list *list, cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
referenced_from_other_partition_p (struct ipa_ref_list *list, lto_symtab_encoder_t encoder)
|
||||
{
|
||||
int i;
|
||||
struct ipa_ref *ref;
|
||||
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
|
||||
{
|
||||
if (symtab_function_p (ref->referring))
|
||||
{
|
||||
if (ipa_ref_referring_node (ref)->symbol.in_other_partition
|
||||
|| !cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ipa_ref_referring_varpool_node (ref)->symbol.in_other_partition
|
||||
|| !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
|
||||
vset))
|
||||
return true;
|
||||
}
|
||||
if (ref->referring->symbol.in_other_partition
|
||||
|| !lto_symtab_encoder_in_partition_p (encoder, ref->referring))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -275,7 +272,7 @@ referenced_from_other_partition_p (struct ipa_ref_list *list, cgraph_node_set se
|
|||
/* Return true when node is reachable from other partition. */
|
||||
|
||||
bool
|
||||
reachable_from_other_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
||||
reachable_from_other_partition_p (struct cgraph_node *node, lto_symtab_encoder_t encoder)
|
||||
{
|
||||
struct cgraph_edge *e;
|
||||
if (!node->analyzed)
|
||||
|
@ -284,7 +281,7 @@ reachable_from_other_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
|||
return false;
|
||||
for (e = node->callers; e; e = e->next_caller)
|
||||
if (e->caller->symbol.in_other_partition
|
||||
|| !cgraph_node_in_set_p (e->caller, set))
|
||||
|| !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)e->caller))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -292,36 +289,25 @@ reachable_from_other_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
|||
/* Return if LIST contain references from other partitions. */
|
||||
|
||||
bool
|
||||
referenced_from_this_partition_p (struct ipa_ref_list *list, cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
referenced_from_this_partition_p (struct ipa_ref_list *list,
|
||||
lto_symtab_encoder_t encoder)
|
||||
{
|
||||
int i;
|
||||
struct ipa_ref *ref;
|
||||
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
|
||||
{
|
||||
if (symtab_function_p (ref->referring))
|
||||
{
|
||||
if (cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
|
||||
vset))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (lto_symtab_encoder_in_partition_p (encoder, ref->referring))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true when node is reachable from other partition. */
|
||||
|
||||
bool
|
||||
reachable_from_this_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
||||
reachable_from_this_partition_p (struct cgraph_node *node, lto_symtab_encoder_t encoder)
|
||||
{
|
||||
struct cgraph_edge *e;
|
||||
for (e = node->callers; e; e = e->next_caller)
|
||||
if (cgraph_node_in_set_p (e->caller, set))
|
||||
if (lto_symtab_encoder_in_partition_p (encoder, (symtab_node)e->caller))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -336,8 +322,7 @@ reachable_from_this_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
|||
|
||||
static void
|
||||
lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
|
||||
lto_symtab_encoder_t encoder, cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
lto_symtab_encoder_t encoder)
|
||||
{
|
||||
unsigned int tag;
|
||||
struct bitpack_d bp;
|
||||
|
@ -346,7 +331,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
|
|||
bool in_other_partition = false;
|
||||
struct cgraph_node *clone_of;
|
||||
|
||||
boundary_p = !cgraph_node_in_set_p (node, set);
|
||||
boundary_p = !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node);
|
||||
|
||||
if (node->analyzed && !boundary_p)
|
||||
tag = LTO_symtab_analyzed_node;
|
||||
|
@ -436,9 +421,9 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
|
|||
bp_pack_value (&bp, tag == LTO_symtab_analyzed_node
|
||||
&& !DECL_EXTERNAL (node->symbol.decl)
|
||||
&& !DECL_COMDAT (node->symbol.decl)
|
||||
&& (reachable_from_other_partition_p (node, set)
|
||||
&& (reachable_from_other_partition_p (node, encoder)
|
||||
|| referenced_from_other_partition_p (&node->symbol.ref_list,
|
||||
set, vset)), 1);
|
||||
encoder)), 1);
|
||||
bp_pack_value (&bp, node->lowered, 1);
|
||||
bp_pack_value (&bp, in_other_partition, 1);
|
||||
/* Real aliases in a boundary become non-aliases. However we still stream
|
||||
|
@ -482,10 +467,10 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
|
|||
|
||||
static void
|
||||
lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node *node,
|
||||
lto_symtab_encoder_t encoder,
|
||||
cgraph_node_set set, varpool_node_set vset)
|
||||
lto_symtab_encoder_t encoder)
|
||||
{
|
||||
bool boundary_p = !varpool_node_in_set_p (node, vset) && node->analyzed;
|
||||
bool boundary_p = (node->analyzed
|
||||
&& !lto_symtab_encoder_in_partition_p (encoder, (symtab_node)node));
|
||||
struct bitpack_d bp;
|
||||
int ref;
|
||||
|
||||
|
@ -514,7 +499,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
|
|||
{
|
||||
bp_pack_value (&bp, node->analyzed
|
||||
&& referenced_from_other_partition_p (&node->symbol.ref_list,
|
||||
set, vset), 1);
|
||||
encoder), 1);
|
||||
bp_pack_value (&bp, boundary_p && !DECL_EXTERNAL (node->symbol.decl), 1);
|
||||
/* in_other_partition. */
|
||||
}
|
||||
|
@ -624,11 +609,9 @@ output_outgoing_cgraph_edges (struct cgraph_edge *edge,
|
|||
/* Output the part of the cgraph in SET. */
|
||||
|
||||
static void
|
||||
output_refs (cgraph_node_set set, varpool_node_set vset,
|
||||
lto_symtab_encoder_t encoder)
|
||||
output_refs (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
cgraph_node_set_iterator csi;
|
||||
varpool_node_set_iterator vsi;
|
||||
lto_symtab_encoder_iterator lsei;
|
||||
struct lto_simple_output_block *ob;
|
||||
int count;
|
||||
struct ipa_ref *ref;
|
||||
|
@ -636,36 +619,17 @@ output_refs (cgraph_node_set set, varpool_node_set vset,
|
|||
|
||||
ob = lto_create_simple_output_block (LTO_section_refs);
|
||||
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
for (lsei = lsei_start_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_in_partition (&lsei))
|
||||
{
|
||||
struct cgraph_node *node = csi_node (csi);
|
||||
symtab_node node = lsei_node (lsei);
|
||||
|
||||
count = ipa_ref_list_nreferences (&node->symbol.ref_list);
|
||||
if (count)
|
||||
{
|
||||
streamer_write_uhwi_stream (ob->main_stream, count);
|
||||
streamer_write_uhwi_stream (ob->main_stream,
|
||||
lto_symtab_encoder_lookup (encoder,
|
||||
(symtab_node)node));
|
||||
for (i = 0; ipa_ref_list_reference_iterate (&node->symbol.ref_list,
|
||||
i, ref); i++)
|
||||
lto_output_ref (ob, ref, encoder);
|
||||
}
|
||||
}
|
||||
|
||||
streamer_write_uhwi_stream (ob->main_stream, 0);
|
||||
|
||||
for (vsi = vsi_start (vset); !vsi_end_p (vsi); vsi_next (&vsi))
|
||||
{
|
||||
struct varpool_node *node = vsi_node (vsi);
|
||||
|
||||
count = ipa_ref_list_nreferences (&node->symbol.ref_list);
|
||||
if (count)
|
||||
{
|
||||
streamer_write_uhwi_stream (ob->main_stream, count);
|
||||
streamer_write_uhwi_stream (ob->main_stream,
|
||||
lto_symtab_encoder_lookup (encoder,
|
||||
(symtab_node)node));
|
||||
lto_symtab_encoder_lookup (encoder, node));
|
||||
for (i = 0; ipa_ref_list_reference_iterate (&node->symbol.ref_list,
|
||||
i, ref); i++)
|
||||
lto_output_ref (ob, ref, encoder);
|
||||
|
@ -697,13 +661,14 @@ compute_ltrans_boundary (struct lto_out_decl_state *state,
|
|||
{
|
||||
node = csi_node (csi);
|
||||
add_node_to (encoder, node, true);
|
||||
lto_set_symtab_encoder_in_partition (encoder, (symtab_node)node);
|
||||
add_references (encoder, &node->symbol.ref_list);
|
||||
}
|
||||
for (vsi = vsi_start (vset); !vsi_end_p (vsi); vsi_next (&vsi))
|
||||
{
|
||||
struct varpool_node *vnode = vsi_node (vsi);
|
||||
gcc_assert (!vnode->alias || vnode->alias_of);
|
||||
lto_symtab_encoder_encode (encoder, (symtab_node)vnode);
|
||||
lto_set_symtab_encoder_in_partition (encoder, (symtab_node)vnode);
|
||||
lto_set_symtab_encoder_encode_initializer (encoder, vnode);
|
||||
add_references (encoder, &vnode->symbol.ref_list);
|
||||
}
|
||||
|
@ -750,17 +715,17 @@ compute_ltrans_boundary (struct lto_out_decl_state *state,
|
|||
/* Output the part of the symtab in SET and VSET. */
|
||||
|
||||
void
|
||||
output_symtab (cgraph_node_set set, varpool_node_set vset)
|
||||
output_symtab (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
struct lto_simple_output_block *ob;
|
||||
cgraph_node_set_iterator csi;
|
||||
lto_symtab_encoder_iterator lsei;
|
||||
int i, n_nodes;
|
||||
lto_symtab_encoder_t encoder;
|
||||
static bool asm_nodes_output = false;
|
||||
|
||||
if (flag_wpa)
|
||||
output_cgraph_opt_summary (set);
|
||||
output_cgraph_opt_summary ();
|
||||
|
||||
ob = lto_create_simple_output_block (LTO_section_symtab_nodes);
|
||||
|
||||
|
@ -779,17 +744,17 @@ output_symtab (cgraph_node_set set, varpool_node_set vset)
|
|||
{
|
||||
symtab_node node = lto_symtab_encoder_deref (encoder, i);
|
||||
if (symtab_function_p (node))
|
||||
lto_output_node (ob, cgraph (node), encoder, set, vset);
|
||||
lto_output_node (ob, cgraph (node), encoder);
|
||||
else
|
||||
lto_output_varpool_node (ob, varpool (node), encoder,
|
||||
set, vset);
|
||||
lto_output_varpool_node (ob, varpool (node), encoder);
|
||||
|
||||
}
|
||||
|
||||
/* Go over the nodes in SET again to write edges. */
|
||||
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
|
||||
for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei);
|
||||
lsei_next_function_in_partition (&lsei))
|
||||
{
|
||||
node = csi_node (csi);
|
||||
node = lsei_cgraph_node (lsei);
|
||||
output_outgoing_cgraph_edges (node->callees, ob, encoder);
|
||||
output_outgoing_cgraph_edges (node->indirect_calls, ob, encoder);
|
||||
}
|
||||
|
@ -808,7 +773,7 @@ output_symtab (cgraph_node_set set, varpool_node_set vset)
|
|||
lto_output_toplevel_asms ();
|
||||
}
|
||||
|
||||
output_refs (set, vset, encoder);
|
||||
output_refs (encoder);
|
||||
}
|
||||
|
||||
/* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS,
|
||||
|
@ -1170,29 +1135,15 @@ input_refs (struct lto_input_block *ib,
|
|||
int idx;
|
||||
while (true)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
symtab_node node;
|
||||
count = streamer_read_uhwi (ib);
|
||||
if (!count)
|
||||
break;
|
||||
idx = streamer_read_uhwi (ib);
|
||||
node = cgraph (VEC_index (symtab_node, nodes, idx));
|
||||
node = VEC_index (symtab_node, nodes, idx);
|
||||
while (count)
|
||||
{
|
||||
input_ref (ib, (symtab_node) node, nodes);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
struct varpool_node *node;
|
||||
count = streamer_read_uhwi (ib);
|
||||
if (!count)
|
||||
break;
|
||||
node = varpool (VEC_index (symtab_node, nodes,
|
||||
streamer_read_uhwi (ib)));
|
||||
while (count)
|
||||
{
|
||||
input_ref (ib, (symtab_node) node, nodes);
|
||||
input_ref (ib, node, nodes);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
@ -1362,8 +1313,7 @@ input_symtab (void)
|
|||
/* True when we need optimization summary for NODE. */
|
||||
|
||||
static int
|
||||
output_cgraph_opt_summary_p (struct cgraph_node *node,
|
||||
cgraph_node_set set ATTRIBUTE_UNUSED)
|
||||
output_cgraph_opt_summary_p (struct cgraph_node *node)
|
||||
{
|
||||
return (node->clone_of
|
||||
&& (node->clone.tree_map
|
||||
|
@ -1383,7 +1333,7 @@ output_edge_opt_summary (struct output_block *ob ATTRIBUTE_UNUSED,
|
|||
static void
|
||||
output_node_opt_summary (struct output_block *ob,
|
||||
struct cgraph_node *node,
|
||||
cgraph_node_set set)
|
||||
lto_symtab_encoder_t encoder)
|
||||
{
|
||||
unsigned int index;
|
||||
bitmap_iterator bi;
|
||||
|
@ -1430,7 +1380,7 @@ output_node_opt_summary (struct output_block *ob,
|
|||
streamer_write_bitpack (&bp);
|
||||
}
|
||||
|
||||
if (cgraph_node_in_set_p (node, set))
|
||||
if (lto_symtab_encoder_in_partition_p (encoder, (symtab_node) node))
|
||||
{
|
||||
for (e = node->callees; e; e = e->next_callee)
|
||||
output_edge_opt_summary (ob, e);
|
||||
|
@ -1443,7 +1393,7 @@ output_node_opt_summary (struct output_block *ob,
|
|||
At the moment it is the clone info structure. */
|
||||
|
||||
static void
|
||||
output_cgraph_opt_summary (cgraph_node_set set)
|
||||
output_cgraph_opt_summary (void)
|
||||
{
|
||||
symtab_node node;
|
||||
int i, n_nodes;
|
||||
|
@ -1456,17 +1406,17 @@ output_cgraph_opt_summary (cgraph_node_set set)
|
|||
n_nodes = lto_symtab_encoder_size (encoder);
|
||||
for (i = 0; i < n_nodes; i++)
|
||||
if (symtab_function_p (node = lto_symtab_encoder_deref (encoder, i))
|
||||
&& output_cgraph_opt_summary_p (cgraph (node), set))
|
||||
&& output_cgraph_opt_summary_p (cgraph (node)))
|
||||
count++;
|
||||
streamer_write_uhwi (ob, count);
|
||||
for (i = 0; i < n_nodes; i++)
|
||||
{
|
||||
node = lto_symtab_encoder_deref (encoder, i);
|
||||
if (symtab_function_p (node)
|
||||
&& output_cgraph_opt_summary_p (cgraph (node), set))
|
||||
&& output_cgraph_opt_summary_p (cgraph (node)))
|
||||
{
|
||||
streamer_write_uhwi (ob, i);
|
||||
output_node_opt_summary (ob, cgraph (node), set);
|
||||
output_node_opt_summary (ob, cgraph (node), encoder);
|
||||
}
|
||||
}
|
||||
produce_asm (ob, NULL);
|
||||
|
|
|
@ -973,7 +973,7 @@ copy_function (struct cgraph_node *node)
|
|||
/* Main entry point from the pass manager. */
|
||||
|
||||
static void
|
||||
lto_output (cgraph_node_set set, varpool_node_set vset)
|
||||
lto_output (void)
|
||||
{
|
||||
struct cgraph_node *node;
|
||||
struct lto_out_decl_state *decl_state;
|
||||
|
@ -1018,7 +1018,7 @@ lto_output (cgraph_node_set set, varpool_node_set vset)
|
|||
be done now to make sure that all the statements in every function
|
||||
have been renumbered so that edges can be associated with call
|
||||
statements using the statement UIDs. */
|
||||
output_symtab (set, vset);
|
||||
output_symtab ();
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
lto_bitmap_free (output);
|
||||
|
@ -1388,8 +1388,7 @@ produce_symtab (struct output_block *ob)
|
|||
recover these on other side. */
|
||||
|
||||
static void
|
||||
produce_asm_for_decls (cgraph_node_set set ATTRIBUTE_UNUSED,
|
||||
varpool_node_set vset ATTRIBUTE_UNUSED)
|
||||
produce_asm_for_decls (void)
|
||||
{
|
||||
struct lto_out_decl_state *out_state;
|
||||
struct lto_out_decl_state *fn_out_state;
|
||||
|
|
|
@ -433,17 +433,21 @@ struct lto_symtab_encoder_d
|
|||
struct pointer_set_t *body;
|
||||
/* Map of nodes where we want to output initializer. */
|
||||
struct pointer_set_t *initializer;
|
||||
/* Map of nodes in this partition. */
|
||||
struct pointer_set_t *in_partition;
|
||||
};
|
||||
|
||||
typedef struct lto_symtab_encoder_d *lto_symtab_encoder_t;
|
||||
|
||||
/* Return number of encoded nodes in ENCODER. */
|
||||
|
||||
static inline int
|
||||
lto_symtab_encoder_size (lto_symtab_encoder_t encoder)
|
||||
/* Iterator structure for cgraph node sets. */
|
||||
typedef struct
|
||||
{
|
||||
return VEC_length (symtab_node, encoder->nodes);
|
||||
}
|
||||
lto_symtab_encoder_t encoder;
|
||||
unsigned index;
|
||||
} lto_symtab_encoder_iterator;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Mapping from indices to trees. */
|
||||
struct GTY(()) lto_tree_ref_table
|
||||
|
@ -808,28 +812,29 @@ void lto_output_location (struct output_block *, location_t);
|
|||
|
||||
|
||||
/* In lto-cgraph.c */
|
||||
symtab_node lto_symtab_encoder_deref (lto_symtab_encoder_t, int);
|
||||
int lto_symtab_encoder_lookup (lto_symtab_encoder_t, symtab_node);
|
||||
lto_symtab_encoder_t lto_symtab_encoder_new (void);
|
||||
int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node);
|
||||
void lto_symtab_encoder_delete (lto_symtab_encoder_t);
|
||||
bool lto_symtab_encoder_encode_body_p (lto_symtab_encoder_t,
|
||||
struct cgraph_node *);
|
||||
bool lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t,
|
||||
symtab_node);
|
||||
void lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t,
|
||||
symtab_node);
|
||||
|
||||
bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t,
|
||||
struct varpool_node *);
|
||||
void output_symtab (cgraph_node_set, varpool_node_set);
|
||||
void output_symtab (void);
|
||||
void input_symtab (void);
|
||||
bool referenced_from_other_partition_p (struct ipa_ref_list *,
|
||||
cgraph_node_set,
|
||||
varpool_node_set vset);
|
||||
lto_symtab_encoder_t);
|
||||
bool reachable_from_other_partition_p (struct cgraph_node *,
|
||||
cgraph_node_set);
|
||||
lto_symtab_encoder_t);
|
||||
bool referenced_from_this_partition_p (struct ipa_ref_list *,
|
||||
cgraph_node_set,
|
||||
varpool_node_set vset);
|
||||
lto_symtab_encoder_t);
|
||||
bool reachable_from_this_partition_p (struct cgraph_node *,
|
||||
cgraph_node_set);
|
||||
lto_symtab_encoder_t);
|
||||
void compute_ltrans_boundary (struct lto_out_decl_state *state,
|
||||
cgraph_node_set, varpool_node_set);
|
||||
|
||||
|
@ -985,6 +990,149 @@ emit_label_in_global_context_p (tree label)
|
|||
return DECL_NONLOCAL (label) || FORCED_LABEL (label);
|
||||
}
|
||||
|
||||
/* Return number of encoded nodes in ENCODER. */
|
||||
static inline int
|
||||
lto_symtab_encoder_size (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
return VEC_length (symtab_node, encoder->nodes);
|
||||
}
|
||||
|
||||
/* Return true if iterator LSE points to nothing. */
|
||||
static inline bool
|
||||
lsei_end_p (lto_symtab_encoder_iterator lsei)
|
||||
{
|
||||
return lsei.index >= (unsigned)lto_symtab_encoder_size (lsei.encoder);
|
||||
}
|
||||
|
||||
/* Advance iterator LSE. */
|
||||
static inline void
|
||||
lsei_next (lto_symtab_encoder_iterator *lsei)
|
||||
{
|
||||
lsei->index++;
|
||||
}
|
||||
|
||||
/* Return the node pointed to by LSI. */
|
||||
static inline symtab_node
|
||||
lsei_node (lto_symtab_encoder_iterator lsei)
|
||||
{
|
||||
return VEC_index (symtab_node, lsei.encoder->nodes, lsei.index);
|
||||
}
|
||||
|
||||
/* Return the node pointed to by LSI. */
|
||||
static inline struct cgraph_node *
|
||||
lsei_cgraph_node (lto_symtab_encoder_iterator lsei)
|
||||
{
|
||||
return cgraph (VEC_index (symtab_node, lsei.encoder->nodes, lsei.index));
|
||||
}
|
||||
|
||||
/* Return the node pointed to by LSI. */
|
||||
static inline struct varpool_node *
|
||||
lsei_varpool_node (lto_symtab_encoder_iterator lsei)
|
||||
{
|
||||
return varpool (VEC_index (symtab_node, lsei.encoder->nodes, lsei.index));
|
||||
}
|
||||
|
||||
/* Value used to represent failure of lto_symtab_encoder_lookup. */
|
||||
#define LCC_NOT_FOUND (-1)
|
||||
|
||||
/* Return the cgraph node corresponding to REF using ENCODER. */
|
||||
|
||||
static inline symtab_node
|
||||
lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref)
|
||||
{
|
||||
if (ref == LCC_NOT_FOUND)
|
||||
return NULL;
|
||||
|
||||
return VEC_index (symtab_node, encoder->nodes, ref);
|
||||
}
|
||||
|
||||
/* Return an iterator to the first node in LSI. */
|
||||
static inline lto_symtab_encoder_iterator
|
||||
lsei_start (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
lto_symtab_encoder_iterator lsei;
|
||||
|
||||
lsei.encoder = encoder;
|
||||
lsei.index = 0;
|
||||
return lsei;
|
||||
}
|
||||
|
||||
/* Advance iterator LSE. */
|
||||
static inline void
|
||||
lsei_next_in_partition (lto_symtab_encoder_iterator *lsei)
|
||||
{
|
||||
lsei_next (lsei);
|
||||
while (!lsei_end_p (*lsei)
|
||||
&& !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))
|
||||
lsei_next (lsei);
|
||||
}
|
||||
|
||||
/* Return an iterator to the first node in LSI. */
|
||||
static inline lto_symtab_encoder_iterator
|
||||
lsei_start_in_partition (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
lto_symtab_encoder_iterator lsei = lsei_start (encoder);
|
||||
|
||||
if (lsei_end_p (lsei))
|
||||
return lsei;
|
||||
if (!lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
|
||||
lsei_next_in_partition (&lsei);
|
||||
|
||||
return lsei;
|
||||
}
|
||||
|
||||
/* Advance iterator LSE. */
|
||||
static inline void
|
||||
lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei)
|
||||
{
|
||||
lsei_next (lsei);
|
||||
while (!lsei_end_p (*lsei)
|
||||
&& (!symtab_function_p (lsei_node (*lsei))
|
||||
|| !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
|
||||
lsei_next (lsei);
|
||||
}
|
||||
|
||||
/* Return an iterator to the first node in LSI. */
|
||||
static inline lto_symtab_encoder_iterator
|
||||
lsei_start_function_in_partition (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
lto_symtab_encoder_iterator lsei = lsei_start (encoder);
|
||||
|
||||
if (lsei_end_p (lsei))
|
||||
return lsei;
|
||||
if (!symtab_function_p (lsei_node (lsei))
|
||||
|| !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
|
||||
lsei_next_function_in_partition (&lsei);
|
||||
|
||||
return lsei;
|
||||
}
|
||||
|
||||
/* Advance iterator LSE. */
|
||||
static inline void
|
||||
lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei)
|
||||
{
|
||||
lsei_next (lsei);
|
||||
while (!lsei_end_p (*lsei)
|
||||
&& (!symtab_variable_p (lsei_node (*lsei))
|
||||
|| !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
|
||||
lsei_next (lsei);
|
||||
}
|
||||
|
||||
/* Return an iterator to the first node in LSI. */
|
||||
static inline lto_symtab_encoder_iterator
|
||||
lsei_start_variable_in_partition (lto_symtab_encoder_t encoder)
|
||||
{
|
||||
lto_symtab_encoder_iterator lsei = lsei_start (encoder);
|
||||
|
||||
if (lsei_end_p (lsei))
|
||||
return lsei;
|
||||
if (!symtab_variable_p (lsei_node (lsei))
|
||||
|| !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
|
||||
lsei_next_variable_in_partition (&lsei);
|
||||
|
||||
return lsei;
|
||||
}
|
||||
|
||||
DEFINE_DECL_STREAM_FUNCS (TYPE, type)
|
||||
DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl)
|
||||
DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2012-08-12 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* lto-partition.c (set_referenced_from_other_partition_p,
|
||||
set_reachable_from_other_partition_p, set_referenced_from_this_partition_p):
|
||||
New functions.
|
||||
(lto_promote_cross_file_statics): Use them.
|
||||
|
||||
2012-07-24 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* lto.c (read_cgraph_and_symbols): Use input_symtab.
|
||||
|
|
|
@ -797,6 +797,79 @@ promote_fn (struct cgraph_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Return if LIST contain references from other partitions.
|
||||
TODO: remove this once lto partitioning is using encoders. */
|
||||
|
||||
static bool
|
||||
set_referenced_from_other_partition_p (struct ipa_ref_list *list, cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
{
|
||||
int i;
|
||||
struct ipa_ref *ref;
|
||||
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
|
||||
{
|
||||
if (symtab_function_p (ref->referring))
|
||||
{
|
||||
if (ipa_ref_referring_node (ref)->symbol.in_other_partition
|
||||
|| !cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ipa_ref_referring_varpool_node (ref)->symbol.in_other_partition
|
||||
|| !varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
|
||||
vset))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true when node is reachable from other partition.
|
||||
TODO: remove this once lto partitioning is using encoders. */
|
||||
|
||||
static bool
|
||||
set_reachable_from_other_partition_p (struct cgraph_node *node, cgraph_node_set set)
|
||||
{
|
||||
struct cgraph_edge *e;
|
||||
if (!node->analyzed)
|
||||
return false;
|
||||
if (node->global.inlined_to)
|
||||
return false;
|
||||
for (e = node->callers; e; e = e->next_caller)
|
||||
if (e->caller->symbol.in_other_partition
|
||||
|| !cgraph_node_in_set_p (e->caller, set))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Return if LIST contain references from other partitions.
|
||||
TODO: remove this once lto partitioning is using encoders. */
|
||||
|
||||
static bool
|
||||
set_referenced_from_this_partition_p (struct ipa_ref_list *list, cgraph_node_set set,
|
||||
varpool_node_set vset)
|
||||
{
|
||||
int i;
|
||||
struct ipa_ref *ref;
|
||||
for (i = 0; ipa_ref_list_referring_iterate (list, i, ref); i++)
|
||||
{
|
||||
if (symtab_function_p (ref->referring))
|
||||
{
|
||||
if (cgraph_node_in_set_p (ipa_ref_referring_node (ref), set))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (varpool_node_in_set_p (ipa_ref_referring_varpool_node (ref),
|
||||
vset))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Find out all static decls that need to be promoted to global because
|
||||
of cross file sharing. This function must be run in the WPA mode after
|
||||
all inlinees are added. */
|
||||
|
@ -834,8 +907,8 @@ lto_promote_cross_file_statics (void)
|
|||
continue;
|
||||
if ((!DECL_EXTERNAL (node->symbol.decl)
|
||||
&& !DECL_COMDAT (node->symbol.decl))
|
||||
&& (referenced_from_other_partition_p (&node->symbol.ref_list, set, vset)
|
||||
|| reachable_from_other_partition_p (node, set)))
|
||||
&& (set_referenced_from_other_partition_p (&node->symbol.ref_list, set, vset)
|
||||
|| set_reachable_from_other_partition_p (node, set)))
|
||||
promote_fn (node);
|
||||
}
|
||||
for (vsi = vsi_start (vset); !vsi_end_p (vsi); vsi_next (&vsi))
|
||||
|
@ -848,7 +921,7 @@ lto_promote_cross_file_statics (void)
|
|||
&& !DECL_EXTERNAL (vnode->symbol.decl)
|
||||
&& !DECL_COMDAT (vnode->symbol.decl)
|
||||
&& !vnode->symbol.externally_visible && vnode->analyzed
|
||||
&& referenced_from_other_partition_p (&vnode->symbol.ref_list,
|
||||
&& set_referenced_from_other_partition_p (&vnode->symbol.ref_list,
|
||||
set, vset))
|
||||
promote_var (vnode);
|
||||
}
|
||||
|
@ -866,7 +939,7 @@ lto_promote_cross_file_statics (void)
|
|||
if (const_value_known_p (vnode->symbol.decl)
|
||||
&& DECL_INITIAL (vnode->symbol.decl)
|
||||
&& !varpool_node_in_set_p (vnode, vset)
|
||||
&& referenced_from_this_partition_p (&vnode->symbol.ref_list, set, vset)
|
||||
&& set_referenced_from_this_partition_p (&vnode->symbol.ref_list, set, vset)
|
||||
&& !pointer_set_insert (inserted, vnode))
|
||||
VEC_safe_push (varpool_node_ptr, heap, promoted_initializers, vnode);
|
||||
|
||||
|
|
24
gcc/passes.c
24
gcc/passes.c
|
@ -2221,9 +2221,7 @@ execute_pass_list (struct opt_pass *pass)
|
|||
those node in SET. */
|
||||
|
||||
static void
|
||||
ipa_write_summaries_2 (struct opt_pass *pass, cgraph_node_set set,
|
||||
varpool_node_set vset,
|
||||
struct lto_out_decl_state *state)
|
||||
ipa_write_summaries_2 (struct opt_pass *pass, struct lto_out_decl_state *state)
|
||||
{
|
||||
while (pass)
|
||||
{
|
||||
|
@ -2241,7 +2239,7 @@ ipa_write_summaries_2 (struct opt_pass *pass, cgraph_node_set set,
|
|||
|
||||
pass_init_dump_file (pass);
|
||||
|
||||
ipa_pass->write_summary (set,vset);
|
||||
ipa_pass->write_summary ();
|
||||
|
||||
pass_fini_dump_file (pass);
|
||||
|
||||
|
@ -2251,7 +2249,7 @@ ipa_write_summaries_2 (struct opt_pass *pass, cgraph_node_set set,
|
|||
}
|
||||
|
||||
if (pass->sub && pass->sub->type != GIMPLE_PASS)
|
||||
ipa_write_summaries_2 (pass->sub, set, vset, state);
|
||||
ipa_write_summaries_2 (pass->sub, state);
|
||||
|
||||
pass = pass->next;
|
||||
}
|
||||
|
@ -2270,8 +2268,8 @@ ipa_write_summaries_1 (cgraph_node_set set, varpool_node_set vset)
|
|||
lto_push_out_decl_state (state);
|
||||
|
||||
gcc_assert (!flag_wpa);
|
||||
ipa_write_summaries_2 (all_regular_ipa_passes, set, vset, state);
|
||||
ipa_write_summaries_2 (all_lto_gen_passes, set, vset, state);
|
||||
ipa_write_summaries_2 (all_regular_ipa_passes, state);
|
||||
ipa_write_summaries_2 (all_lto_gen_passes, state);
|
||||
|
||||
gcc_assert (lto_get_out_decl_state () == state);
|
||||
lto_pop_out_decl_state ();
|
||||
|
@ -2339,9 +2337,7 @@ ipa_write_summaries (void)
|
|||
only those node in SET. */
|
||||
|
||||
static void
|
||||
ipa_write_optimization_summaries_1 (struct opt_pass *pass, cgraph_node_set set,
|
||||
varpool_node_set vset,
|
||||
struct lto_out_decl_state *state)
|
||||
ipa_write_optimization_summaries_1 (struct opt_pass *pass, struct lto_out_decl_state *state)
|
||||
{
|
||||
while (pass)
|
||||
{
|
||||
|
@ -2359,7 +2355,7 @@ ipa_write_optimization_summaries_1 (struct opt_pass *pass, cgraph_node_set set,
|
|||
|
||||
pass_init_dump_file (pass);
|
||||
|
||||
ipa_pass->write_optimization_summary (set, vset);
|
||||
ipa_pass->write_optimization_summary ();
|
||||
|
||||
pass_fini_dump_file (pass);
|
||||
|
||||
|
@ -2369,7 +2365,7 @@ ipa_write_optimization_summaries_1 (struct opt_pass *pass, cgraph_node_set set,
|
|||
}
|
||||
|
||||
if (pass->sub && pass->sub->type != GIMPLE_PASS)
|
||||
ipa_write_optimization_summaries_1 (pass->sub, set, vset, state);
|
||||
ipa_write_optimization_summaries_1 (pass->sub, state);
|
||||
|
||||
pass = pass->next;
|
||||
}
|
||||
|
@ -2404,8 +2400,8 @@ ipa_write_optimization_summaries (cgraph_node_set set, varpool_node_set vset)
|
|||
}
|
||||
|
||||
gcc_assert (flag_wpa);
|
||||
ipa_write_optimization_summaries_1 (all_regular_ipa_passes, set, vset, state);
|
||||
ipa_write_optimization_summaries_1 (all_lto_gen_passes, set, vset, state);
|
||||
ipa_write_optimization_summaries_1 (all_regular_ipa_passes, state);
|
||||
ipa_write_optimization_summaries_1 (all_lto_gen_passes, state);
|
||||
|
||||
gcc_assert (lto_get_out_decl_state () == state);
|
||||
lto_pop_out_decl_state ();
|
||||
|
|
|
@ -106,15 +106,13 @@ struct ipa_opt_pass_d
|
|||
void (*generate_summary) (void);
|
||||
|
||||
/* This hook is used to serialize IPA summaries on disk. */
|
||||
void (*write_summary) (struct cgraph_node_set_def *,
|
||||
struct varpool_node_set_def *);
|
||||
void (*write_summary) (void);
|
||||
|
||||
/* This hook is used to deserialize IPA summaries from disk. */
|
||||
void (*read_summary) (void);
|
||||
|
||||
/* This hook is used to serialize IPA optimization summaries on disk. */
|
||||
void (*write_optimization_summary) (struct cgraph_node_set_def *,
|
||||
struct varpool_node_set_def *);
|
||||
void (*write_optimization_summary) (void);
|
||||
|
||||
/* This hook is used to deserialize IPA summaries from disk. */
|
||||
void (*read_optimization_summary) (void);
|
||||
|
|
Loading…
Add table
Reference in a new issue