Commit 28632d63 by Jan Hubicka Committed by Jan Hubicka

lto.c (lto_materialize_function): Announce function when reading body...

	* lto.c (lto_materialize_function): Announce function when
	reading body; allocate_struct_function only when reading body;
	do not finalize local statics; ggc_collect after reading;
	do not mark reachable node.
	(materialize_cgraph): Do not announce function.

From-SVN: r159516
parent d3a9b459
2010-05-18 Jan Hubicka <jh@suse.cz>
* lto.c (lto_materialize_function): Announce function when
reading body; allocate_struct_function only when reading body;
do not finalize local statics; ggc_collect after reading;
do not mark reachable node.
(materialize_cgraph): Do not announce function.
2010-05-11 Jan Hubicka <jh@suse.cz> 2010-05-11 Jan Hubicka <jh@suse.cz>
* lto.c (materialize_cgraph): Revert my previous patch. * lto.c (materialize_cgraph): Revert my previous patch.
......
...@@ -84,7 +84,6 @@ lto_materialize_function (struct cgraph_node *node) ...@@ -84,7 +84,6 @@ lto_materialize_function (struct cgraph_node *node)
struct lto_file_decl_data *file_data; struct lto_file_decl_data *file_data;
const char *data, *name; const char *data, *name;
size_t len; size_t len;
tree step;
/* Ignore clone nodes. Read the body only from the original one. /* Ignore clone nodes. Read the body only from the original one.
We may find clone nodes during LTRANS after WPA has made inlining We may find clone nodes during LTRANS after WPA has made inlining
...@@ -103,46 +102,33 @@ lto_materialize_function (struct cgraph_node *node) ...@@ -103,46 +102,33 @@ lto_materialize_function (struct cgraph_node *node)
name, &len); name, &len);
if (data) if (data)
{ {
struct function *fn;
gcc_assert (!DECL_IS_BUILTIN (decl)); gcc_assert (!DECL_IS_BUILTIN (decl));
/* This function has a definition. */ /* This function has a definition. */
TREE_STATIC (decl) = 1; TREE_STATIC (decl) = 1;
gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL); gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL);
allocate_struct_function (decl, false);
/* Load the function body only if not operating in WPA mode. In /* Load the function body only if not operating in WPA mode. In
WPA mode, the body of the function is not needed. */ WPA mode, the body of the function is not needed. */
if (!flag_wpa) if (!flag_wpa)
{ {
allocate_struct_function (decl, false);
announce_function (node->decl);
lto_input_function_body (file_data, decl, data); lto_input_function_body (file_data, decl, data);
lto_stats.num_function_bodies++; lto_stats.num_function_bodies++;
} }
fn = DECL_STRUCT_FUNCTION (decl);
lto_free_section_data (file_data, LTO_section_function_body, name, lto_free_section_data (file_data, LTO_section_function_body, name,
data, len); data, len);
if (!flag_wpa)
/* Look for initializers of constant variables and private ggc_collect ();
statics. */
for (step = fn->local_decls; step; step = TREE_CHAIN (step))
{
tree decl = TREE_VALUE (step);
if (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
&& flag_unit_at_a_time)
varpool_finalize_decl (decl);
}
} }
else else
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
/* Let the middle end know about the function. */ /* Let the middle end know about the function. */
rest_of_decl_compilation (decl, 1, 0); rest_of_decl_compilation (decl, 1, 0);
if (cgraph_node (decl)->needed)
cgraph_mark_reachable_node (cgraph_node (decl));
} }
...@@ -1686,7 +1672,6 @@ materialize_cgraph (void) ...@@ -1686,7 +1672,6 @@ materialize_cgraph (void)
if (node->local.lto_file_data if (node->local.lto_file_data
&& !DECL_IS_BUILTIN (node->decl)) && !DECL_IS_BUILTIN (node->decl))
{ {
announce_function (node->decl);
lto_materialize_function (node); lto_materialize_function (node);
lto_stats.num_input_cgraph_nodes++; lto_stats.num_input_cgraph_nodes++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment