Commit d71cc23f by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (cgraph_reset_node): Break out from ...


	* cgraphunit.c (cgraph_reset_node): Break out from ...
	(cgraph_finalize_function): ... here.
	(cgraph_finalize_compilation_unit): Reset nodes where backend
	removed the body.

From-SVN: r100599
parent 0f1341c7
2005-06-04 Jan Hubicka <jh@suse.cz>
* cgraphunit.c (cgraph_reset_node): Break out from ...
(cgraph_finalize_function): ... here.
(cgraph_finalize_compilation_unit): Reset nodes where backend
removed the body.
2005-06-04 Richard Henderson <rth@redhat.com>
PR target/21888
......
......@@ -339,20 +339,7 @@ cgraph_assemble_pending_functions (void)
return output;
}
/* DECL has been parsed. Take it, queue it, compile it at the whim of the
logic in effect. If NESTED is true, then our caller cannot stand to have
the garbage collector run at the moment. We would need to either create
a new GC context, or just not compile right now. */
void
cgraph_finalize_function (tree decl, bool nested)
{
struct cgraph_node *node = cgraph_node (decl);
if (node->local.finalized)
{
/* As an GCC extension we allow redefinition of the function. The
/* As an GCC extension we allow redefinition of the function. The
semantics when both copies of bodies differ is not well defined.
We replace the old body with new body so in unit at a time mode
we always use new body, while in normal mode we may end up with
......@@ -362,6 +349,9 @@ cgraph_finalize_function (tree decl, bool nested)
??? It may make more sense to use one body for inlining and other
body for expanding the function but this is difficult to do. */
static void
cgraph_reset_node (struct cgraph_node *node)
{
/* If node->output is set, then this is a unit-at-a-time compilation
and we have already begun whole-unit analysis. This is *not*
testing for whether we've already emitted the function. That
......@@ -376,6 +366,7 @@ cgraph_finalize_function (tree decl, bool nested)
memset (&node->rtl, 0, sizeof (node->rtl));
node->analyzed = false;
node->local.redefined_extern_inline = true;
node->local.finalized = false;
if (!flag_unit_at_a_time)
{
......@@ -400,7 +391,20 @@ cgraph_finalize_function (tree decl, bool nested)
if (!n)
node->reachable = 0;
}
}
}
/* DECL has been parsed. Take it, queue it, compile it at the whim of the
logic in effect. If NESTED is true, then our caller cannot stand to have
the garbage collector run at the moment. We would need to either create
a new GC context, or just not compile right now. */
void
cgraph_finalize_function (tree decl, bool nested)
{
struct cgraph_node *node = cgraph_node (decl);
if (node->local.finalized)
cgraph_reset_node (node);
notice_global_symbol (decl);
node->decl = decl;
......@@ -837,7 +841,10 @@ cgraph_finalize_compilation_unit (void)
weak alias attribute to kill its body. See
gcc.c-torture/compile/20011119-1.c */
if (!DECL_SAVED_TREE (decl))
{
cgraph_reset_node (node);
continue;
}
gcc_assert (!node->analyzed && node->reachable);
gcc_assert (DECL_SAVED_TREE (decl));
......@@ -870,14 +877,20 @@ cgraph_finalize_compilation_unit (void)
{
tree decl = node->decl;
if (node->local.finalized && !DECL_SAVED_TREE (decl))
cgraph_reset_node (node);
if (!node->reachable && DECL_SAVED_TREE (decl))
{
if (cgraph_dump_file)
fprintf (cgraph_dump_file, " %s", cgraph_node_name (node));
cgraph_remove_node (node);
continue;
}
else
node->next_needed = NULL;
gcc_assert (!node->local.finalized || DECL_SAVED_TREE (decl));
gcc_assert (node->analyzed == node->local.finalized);
}
if (cgraph_dump_file)
{
......
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