summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-05 14:05:54 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-05 14:05:54 +0000
commitfd193bcd4b2ed21bbc003bb85c23db5e0d31e572 (patch)
tree666c7b939b006e039aeec82b1397690b52070e18 /gcc/lto-streamer-in.c
parent09d0041cb92d96d749a3a5d5dfab78de3100d9d9 (diff)
downloadgcc-fd193bcd4b2ed21bbc003bb85c23db5e0d31e572.tar.gz
2009-10-05 Richard Guenther <rguenther@suse.de>
PR lto/41552 PR lto/41487 * lto-symtab.c (struct lto_symtab_base_def): Remove. (struct lto_symtab_identifier_def): Likewise. (struct lto_symtab_decl_def): Likewise. (struct lto_symtab_entry_def): New. (lto_symtab_identifier_t): Rename to ... (lto_symtab_entry_t): ... this. (lto_symtab_decls): Remove. (lto_symtab_base_hash): Rename to ... (lto_symtab_entry_hash): ... this. (lto_symtab_base_eq): Rename to ... (lto_symtab_entry_eq): ... this. (lto_symtab_base_marked_p): Rename to ... (lto_symtab_entry_marked_p): ... this. (lto_symtab_identifier_marked_p): Remove. (lto_symtab_decl_marked_p): Likewise. (lto_symtab_maybe_init_hash_tables): Rename to ... (lto_symtab_maybe_init_hash_table): ... this. (lto_symtab_set_resolution_and_file_data): Remove. (lto_symtab_register_decl): New function. (lto_symtab_get_identifier): Remove. (lto_symtab_get): New function. (lto_symtab_get_resolution): Adjust. (lto_symtab_get_identifier_decl): Remove. (lto_symtab_set_identifier_decl): Likewise. (lto_symtab_merge_decl): Rename to ... (lto_symtab_merge): ... this. Rewrite. (lto_symtab_merge_var): Remove. (lto_symtab_merge_fn): Likewise. (lto_symtab_prevailing_decl): Adjust. (lto_cgraph_replace_node): New function. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise. (lto_symtab_fixup_var_decls): Likewise. (lto_symtab_resolve_symbols): Likewise. (lto_symtab_merge_decls): Likewise. (lto_symtab_prevailing_decl): Adjust. (lto_symtab_get_symtab_def): Remove. (lto_symtab_get_file_data): Likewise. (lto_symtab_clear_resolution): Adjust. (lto_symtab_clear_resolution): Likewise. * lto-cgraph.c (input_edge): Do not merge cgraph nodes here. (input_cgraph_1): Likewise. * lto-streamer-in.c (get_resolution): Do not provide fake symbol resolutions here. (deferred_global_decls): Remove. (lto_register_deferred_decls_in_symtab): Likewise. (lto_register_var_decl_in_symtab): Change signature, register variable via lto_symtab_register_decl. (lto_register_function_decl_in_symtab): Likewise. (lto_read_tree): Adjust. * lto-streamer.h (lto_register_deferred_decls_in_symtab): Remove. (lto_symtab_merge_var): Likewise. (lto_symtab_merge_fn): Likewise. (lto_symtab_register_decl): Declare. (lto_symtab_merge_decls): Likewise. lto/ * lto.c (lto_read_decls): Do not register deferred decls. (read_cgraph_and_symbols): Delay symbol and cgraph merging until after reading the IPA summaries. * g++.dg/lto/20091002-1_0.C: Adjust flags. * g++.dg/lto/20091004-1_0.C: New testcase. * g++.dg/lto/20091004-1_1.C: Likewise. * g++.dg/lto/20091004-2_0.C: Likewise. * g++.dg/lto/20091004-2_1.C: Likewise. * g++.dg/lto/20091004-3_0.C: Likewise. * g++.dg/lto/20091004-3_1.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152450 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c102
1 files changed, 18 insertions, 84 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index a8d237959c3..175a1e771e7 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1347,44 +1347,8 @@ get_resolution (struct data_in *data_in, unsigned index)
return ret;
}
else
- {
- /* Fake symbol resolution if no resolution file was provided. */
- tree t = lto_streamer_cache_get (data_in->reader_cache, index);
-
- gcc_assert (TREE_PUBLIC (t));
-
- /* There should be no DECL_ABSTRACT in the middle end. */
- gcc_assert (!DECL_ABSTRACT (t));
-
- /* If T is a weak definition, we select the first one we see to
- be the prevailing definition. */
- if (DECL_WEAK (t))
- {
- tree prevailing_decl;
- if (DECL_EXTERNAL (t))
- return LDPR_RESOLVED_IR;
-
- /* If this is the first time we see T, it won't have a
- prevailing definition yet. */
- prevailing_decl = lto_symtab_prevailing_decl (t);
- if (prevailing_decl == t
- || prevailing_decl == NULL_TREE
- || DECL_EXTERNAL (prevailing_decl))
- return LDPR_PREVAILING_DEF;
- else
- return LDPR_PREEMPTED_IR;
- }
- else
- {
- /* For non-weak definitions, extern declarations are assumed
- to be resolved elsewhere (LDPR_RESOLVED_IR), otherwise T
- is a prevailing definition. */
- if (DECL_EXTERNAL (t))
- return LDPR_RESOLVED_IR;
- else
- return LDPR_PREVAILING_DEF;
- }
- }
+ /* Delay resolution finding until decl merging. */
+ return LDPR_UNKNOWN;
}
@@ -2243,55 +2207,13 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
}
}
-static VEC(tree, heap) *deferred_global_decls;
-
-/* Register the queued global decls with the symtab. DATA_IN contains
- tables and descriptors for the file being read.*/
-
-void
-lto_register_deferred_decls_in_symtab (struct data_in *data_in)
-{
- unsigned i;
- tree decl;
-
- for (i = 0; VEC_iterate (tree, deferred_global_decls, i, decl); ++i)
- {
- enum ld_plugin_symbol_resolution resolution;
- int ix;
-
- if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
- gcc_unreachable ();
-
- /* Register and adjust the decls type. */
- TREE_TYPE (decl) = gimple_register_type (TREE_TYPE (decl));
-
- if (TREE_CODE (decl) == VAR_DECL)
- {
- gcc_assert (TREE_PUBLIC (decl));
- resolution = get_resolution (data_in, ix);
- lto_symtab_merge_var (decl, resolution);
- }
- else if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- gcc_assert (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl));
- resolution = get_resolution (data_in, ix);
- lto_symtab_merge_fn (decl, resolution, data_in->file_data);
- }
- else
- gcc_unreachable ();
- }
-
- VEC_free (tree, heap, deferred_global_decls);
- deferred_global_decls = NULL;
-}
-
/* Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. */
static void
-lto_register_var_decl_in_symtab (tree decl)
+lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
{
/* Register symbols with file or global scope to mark what input
file has their definition. */
@@ -2319,7 +2241,13 @@ lto_register_var_decl_in_symtab (tree decl)
/* If this variable has already been declared, queue the
declaration for merging. */
if (TREE_PUBLIC (decl))
- VEC_safe_push (tree, heap, deferred_global_decls, decl);
+ {
+ int ix;
+ if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
+ gcc_unreachable ();
+ lto_symtab_register_decl (decl, get_resolution (data_in, ix),
+ data_in->file_data);
+ }
}
@@ -2380,7 +2308,13 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
/* If this variable has already been declared, queue the
declaration for merging. */
if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl))
- VEC_safe_push (tree, heap, deferred_global_decls, decl);
+ {
+ int ix;
+ if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
+ gcc_unreachable ();
+ lto_symtab_register_decl (decl, get_resolution (data_in, ix),
+ data_in->file_data);
+ }
}
@@ -2481,7 +2415,7 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
gcc_assert (!lto_stream_as_builtin_p (result));
if (TREE_CODE (result) == VAR_DECL)
- lto_register_var_decl_in_symtab (result);
+ lto_register_var_decl_in_symtab (data_in, result);
else if (TREE_CODE (result) == FUNCTION_DECL && !DECL_BUILT_IN (result))
lto_register_function_decl_in_symtab (data_in, result);