aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-09 17:29:21 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-09 17:29:21 +0000
commit724462b06920593c5899703a0547f6052ec9d973 (patch)
tree267374ed574354532c002262d01eab0c5d4195fb /gcc/lto-cgraph.c
parentbdbf421cd2aa91716fab7fa7b6a312ab5a576212 (diff)
* passes.c (ipa_write_summaries_1): Set state;
do not call compute_ltrans_boundary. (ipa_write_optimization_summaries): Likewise. (ipa_write_summaries): compute_ltrans_boundary here. * lto-streamer.h (lto_symtab_encoder_d): NODES are allocated in heap. (compute_ltrans_boundary): Update prototype. * lto.c (lto_wpa_write_files): Do not delete partition encoder; it is deleted after streaming. * lto-partition.c (partition_symbol_p): New function. (promote_var, promote_fn): Remove. (promote_symbol): New function. (lto_promote_cross_file_statics): First compute boundaries; rewrite to lookup the actual boundaries instead of computing them ad-hoc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191113 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c83
1 files changed, 45 insertions, 38 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 0281cdb42bc..300e5714e66 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -588,38 +588,6 @@ output_profile_summary (struct lto_simple_output_block *ob)
streamer_write_uhwi_stream (ob->main_stream, 0);
}
-/* Add NODE into encoder as well as nodes it is cloned from.
- Do it in a way so clones appear first. */
-
-static void
-add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node,
- bool include_body)
-{
- if (node->clone_of)
- add_node_to (encoder, node->clone_of, include_body);
- else if (include_body)
- lto_set_symtab_encoder_encode_body (encoder, node);
- lto_symtab_encoder_encode (encoder, (symtab_node)node);
-}
-
-/* Add all references in LIST to encoders. */
-
-static void
-add_references (lto_symtab_encoder_t encoder,
- struct ipa_ref_list *list)
-{
- int i;
- struct ipa_ref *ref;
- for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
- if (symtab_function_p (ref->referred))
- add_node_to (encoder, ipa_ref_node (ref), false);
- else
- {
- struct varpool_node *vnode = ipa_ref_varpool_node (ref);
- lto_symtab_encoder_encode (encoder, (symtab_node)vnode);
- }
-}
-
/* Output all callees or indirect outgoing edges. EDGE must be the first such
edge. */
@@ -674,11 +642,48 @@ output_refs (lto_symtab_encoder_t encoder)
lto_destroy_simple_output_block (ob);
}
-/* Find out all cgraph and varpool nodes we want to encode in current unit
- and insert them to encoders. */
-void
-compute_ltrans_boundary (struct lto_out_decl_state *state,
- lto_symtab_encoder_t in_encoder)
+/* Add NODE into encoder as well as nodes it is cloned from.
+ Do it in a way so clones appear first. */
+
+static void
+add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node,
+ bool include_body)
+{
+ if (node->clone_of)
+ add_node_to (encoder, node->clone_of, include_body);
+ else if (include_body)
+ lto_set_symtab_encoder_encode_body (encoder, node);
+ lto_symtab_encoder_encode (encoder, (symtab_node)node);
+}
+
+/* Add all references in LIST to encoders. */
+
+static void
+add_references (lto_symtab_encoder_t encoder,
+ struct ipa_ref_list *list)
+{
+ int i;
+ struct ipa_ref *ref;
+ for (i = 0; ipa_ref_list_reference_iterate (list, i, ref); i++)
+ if (symtab_function_p (ref->referred))
+ add_node_to (encoder, ipa_ref_node (ref), false);
+ else
+ {
+ struct varpool_node *vnode = ipa_ref_varpool_node (ref);
+ lto_symtab_encoder_encode (encoder, (symtab_node)vnode);
+ }
+}
+
+/* Find all symbols we want to stream into given partition and insert them
+ to encoders.
+
+ The function actually replaces IN_ENCODER by new one. The reason is that
+ streaming code needs clone's origin to be streamed before clone. This
+ means that we need to insert the nodes in specific order. This order is
+ ignored by the partitioning logic earlier. */
+
+lto_symtab_encoder_t
+compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
{
struct cgraph_node *node;
struct cgraph_edge *edge;
@@ -686,7 +691,7 @@ compute_ltrans_boundary (struct lto_out_decl_state *state,
lto_symtab_encoder_t encoder;
lto_symtab_encoder_iterator lsei;
- encoder = state->symtab_node_encoder = lto_symtab_encoder_new ();
+ encoder = lto_symtab_encoder_new ();
/* Go over all entries in the IN_ENCODER and duplicate them to
ENCODER. At the same time insert masters of clones so
@@ -747,6 +752,8 @@ compute_ltrans_boundary (struct lto_out_decl_state *state,
}
}
}
+ lto_symtab_encoder_delete (in_encoder);
+ return encoder;
}
/* Output the part of the symtab in SET and VSET. */