aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-08-13 02:37:51 +0000
committerJan Hubicka <jh@suse.cz>2012-08-13 02:37:51 +0000
commit771c9af4943e8ab9402eec0db82addd7790a86f5 (patch)
tree45f40f7cd77f92dcd298eb5c790cad79a92c02be /gcc/lto
parent7df87b451bbc0fadb0262808f01e2f78b0e5efbb (diff)
* 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@190336 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lto-partition.c81
2 files changed, 84 insertions, 4 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index fb1ea42e25e..4143c6af25d 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -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.
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 602173dd949..37289b694ef 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -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);