aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-05-11 17:52:36 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-05-11 15:52:36 +0000
commit9a8098970a84f2b1b7a1ef97dcd5fa7cd28d27fc (patch)
tree3863b58d5473996402091677849e3dda1ca988af
parentb80531941013cd00875bb5e1c7e56c06ee149ff8 (diff)
downloadgcc-9a8098970a84f2b1b7a1ef97dcd5fa7cd28d27fc.zip
gcc-9a8098970a84f2b1b7a1ef97dcd5fa7cd28d27fc.tar.gz
gcc-9a8098970a84f2b1b7a1ef97dcd5fa7cd28d27fc.tar.bz2
lto-symtab.c (lto_symtab_free): New function.
* lto-symtab.c (lto_symtab_free): New function. * lto-streamer.h (lto_symtab_free): Declare. * lto-cgraph.c (reachable_from_other_partition_p): Export; do not assume that if function is needed it is reachable. (lto_output_node): See if it the function is reachable or referenced. (output_cgraph): Update call of lto_output_node. * lto-streamer.h (reachable_from_other_partition_p): Declare. * lto.c (lto_fixup_decls): Free no longer needed lto_global_var_decls vector. * lto.c (lto_1_to_1_map): Remove some no longer needed checks. (lto_promote_cross_file_statics): Never promote DECL_EXTERNAL; use reachable_from_other_partition_p and referenced_from_other_partition_p test. From-SVN: r159280
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/lto-cgraph.c11
-rw-r--r--gcc/lto-streamer.h3
-rw-r--r--gcc/lto-symtab.c9
-rw-r--r--gcc/lto/ChangeLog12
-rw-r--r--gcc/lto/lto.c31
6 files changed, 55 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 405218b..4f370ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,18 @@
2010-05-11 Jan Hubicka <jh@suse.cz>
+ * lto-symtab.c (lto_symtab_free): New function.
+ * lto-streamer.h (lto_symtab_free): Declare.
+
+2010-05-11 Jan Hubicka <jh@suse.cz>
+
+ * lto-cgraph.c (reachable_from_other_partition_p): Export; do not assume
+ that if function is needed it is reachable.
+ (lto_output_node): See if it the function is reachable or referenced.
+ (output_cgraph): Update call of lto_output_node.
+ * lto-streamer.h (reachable_from_other_partition_p): Declare.
+
+2010-05-11 Jan Hubicka <jh@suse.cz>
+
* crtstuff.c (__JCR_LIST__, __DTOR_END__, __JCR_END__, __FRAME_END__):
Mark as used.
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index a7c0947..df4d2446 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -312,12 +312,10 @@ referenced_from_other_partition_p (struct ipa_ref_list *list, cgraph_node_set se
/* Return true when node is reachable from other partition. */
-static bool
+bool
reachable_from_other_partition_p (struct cgraph_node *node, cgraph_node_set set)
{
struct cgraph_edge *e;
- if (node->needed)
- return true;
if (!node->analyzed)
return false;
if (node->global.inlined_to)
@@ -339,6 +337,7 @@ reachable_from_other_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_cgraph_encoder_t encoder, cgraph_node_set set,
+ varpool_node_set vset,
bitmap written_decls)
{
unsigned int tag;
@@ -400,7 +399,9 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (bp, node->address_taken, 1);
bp_pack_value (bp, node->abstract_and_needed, 1);
bp_pack_value (bp, tag == LTO_cgraph_analyzed_node
- && reachable_from_other_partition_p (node, set), 1);
+ && !DECL_EXTERNAL (node->decl)
+ && (reachable_from_other_partition_p (node, set)
+ || referenced_from_other_partition_p (&node->ref_list, set, vset)), 1);
bp_pack_value (bp, node->lowered, 1);
bp_pack_value (bp, in_other_partition, 1);
bp_pack_value (bp, node->alias, 1);
@@ -767,7 +768,7 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
for (i = 0; i < n_nodes; i++)
{
node = lto_cgraph_encoder_deref (encoder, i);
- lto_output_node (ob, node, encoder, set, written_decls);
+ lto_output_node (ob, node, encoder, set, vset, written_decls);
}
lto_bitmap_free (written_decls);
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index e11da75..8e99e2d 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -863,6 +863,8 @@ void input_cgraph (void);
bool referenced_from_other_partition_p (struct ipa_ref_list *,
cgraph_node_set,
varpool_node_set vset);
+bool reachable_from_other_partition_p (struct cgraph_node *,
+ cgraph_node_set);
/* In lto-symtab.c. */
@@ -872,6 +874,7 @@ extern void lto_symtab_merge_decls (void);
extern void lto_symtab_merge_cgraph_nodes (void);
extern tree lto_symtab_prevailing_decl (tree decl);
extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl);
+extern void lto_symtab_free (void);
/* In lto-opts.c. */
diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
index 732940e..f8349cf 100644
--- a/gcc/lto-symtab.c
+++ b/gcc/lto-symtab.c
@@ -65,6 +65,15 @@ static GTY ((if_marked ("lto_symtab_entry_marked_p"),
param_is (struct lto_symtab_entry_def)))
htab_t lto_symtab_identifiers;
+/* Free symtab hashtable. */
+
+void
+lto_symtab_free (void)
+{
+ htab_delete (lto_symtab_identifiers);
+ lto_symtab_identifiers = NULL;
+}
+
/* Return the hash value of an lto_symtab_entry_t object pointed to by P. */
static hashval_t
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index a86396a..6166a81 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,15 @@
+2010-05-11 Jan Hubicka <jh@suse.cz>
+
+ * lto.c (lto_fixup_decls): Free no longer needed lto_global_var_decls
+ vector.
+
+2010-05-11 Jan Hubicka <jh@suse.cz>
+
+ * lto.c (lto_1_to_1_map): Remove some no longer needed checks.
+ (lto_promote_cross_file_statics): Never promote DECL_EXTERNAL;
+ use reachable_from_other_partition_p and
+ referenced_from_other_partition_p test.
+
2010-05-11 Kai Tietz <kai.tietz@onevision.com>
* lto-coff.c (validate_file): Add x64-coff support.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index c83bfb0..9f6ad40 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -556,13 +556,11 @@ lto_1_to_1_map (void)
if (node->global.inlined_to || node->clone_of)
continue;
/* Nodes without a body do not need partitioning. */
- if (!node->analyzed || node->same_body_alias)
+ if (!node->analyzed)
continue;
- /* We only need to partition the nodes that we read from the
- gimple bytecode files. */
+
file_data = node->local.lto_file_data;
- if (file_data == NULL)
- continue;
+ gcc_assert (!node->same_body_alias && file_data);
slot = pointer_map_contains (pmap, file_data);
if (slot)
@@ -735,22 +733,13 @@ lto_promote_cross_file_statics (void)
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
{
struct cgraph_node *node = csi_node (csi);
- bool globalize = node->local.vtable_method;
- struct cgraph_edge *e;
if (node->local.externally_visible)
continue;
- if (!globalize
- && referenced_from_other_partition_p (&node->ref_list, set, vset))
- globalize = true;
- for (e = node->callers; e && !globalize; e = e->next_caller)
- {
- struct cgraph_node *caller = e->caller;
- if (caller->global.inlined_to)
- caller = caller->global.inlined_to;
- if (!cgraph_node_in_set_p (caller, set))
- globalize = true;
- }
- if (globalize)
+ if (node->clone_of || node->global.inlined_to)
+ continue;
+ if (!DECL_EXTERNAL (node->decl)
+ && (referenced_from_other_partition_p (&node->ref_list, set, vset)
+ || reachable_from_other_partition_p (node, set)))
{
gcc_assert (flag_wpa);
TREE_PUBLIC (node->decl) = 1;
@@ -1465,6 +1454,8 @@ lto_fixup_decls (struct lto_file_decl_data **files)
VEC_replace (tree, lto_global_var_decls, i, decl);
}
+ VEC_free (tree, gc, lto_global_var_decls);
+ lto_global_var_decls = NULL;
pointer_set_destroy (seen);
}
@@ -1640,6 +1631,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
node->ipa_transforms_to_apply,
(ipa_opt_pass)&pass_ipa_inline);
}
+ lto_symtab_free ();
+
timevar_pop (TV_IPA_LTO_CGRAPH_MERGE);
timevar_push (TV_IPA_LTO_DECL_INIT_IO);