summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-11 07:14:12 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-11 07:14:12 +0000
commit28df663bb621dcf2daa666164152c8ebe07a560d (patch)
treeb849ba0e43631f349c7d6dbe1465e4f5bbf2c0de /gcc/cgraphunit.c
parent885460534c19a0c03925680466c21a344e59aee0 (diff)
downloadgcc-28df663bb621dcf2daa666164152c8ebe07a560d.tar.gz
* cgraphunit.c (cgraph_finalize_function): Add nested arg.
Tweek tests for function already generated. (cgraph_expand_function): Don't double announce in !unit-at-a-time. * cgraph.h (cgraph_finalize_function): Update for extra arg. * c-decl.c (finish_function): Likewise. * semantics.c (expand_or_defer_fn): Update for new cgraph_finalize_function argument. * parse.y (source_end_java_method): Update for new cgraph_finalize_function argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index bb55d2d3e8c..3519359e9bf 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -106,7 +106,7 @@ decide_is_function_needed (struct cgraph_node *node, tree decl)
/* "extern inline" functions are never output locally. */
if (DECL_EXTERNAL (decl))
return false;
- /* We want to emit COMDAT functions only when they turns out to be neccesary. */
+ /* We want to emit COMDAT functions only when absolutely neccesary. */
if (DECL_COMDAT (decl))
return false;
if (!DECL_INLINE (decl)
@@ -142,34 +142,39 @@ cgraph_assemble_pending_functions (void)
return output;
}
-/* Analyze function once it is parsed. Set up the local information
- available - create cgraph edges for function calls via BODY. */
+/* 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)
+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
- 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 old body inlined
- into some functions and new body expanded and inlined in others.
+ 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
+ old body inlined into some functions and new body expanded and
+ inlined in others.
- ??? It may make more sense to use one body for inlining and other body
- for expanding the function but this is dificult to do. */
- /* Reset our datastructures so we can analyze the function body
- again. */
+ ??? It may make more sense to use one body for inlining and other
+ body for expanding the function but this is dificult to do. */
+
+ if (TREE_ASM_WRITTEN (decl))
+ abort ();
+
+ /* Reset our datastructures so we can analyze the function again. */
memset (&node->local, 0, sizeof (node->local));
memset (&node->global, 0, sizeof (node->global));
memset (&node->rtl, 0, sizeof (node->rtl));
node->analyzed = false;
- if (node->output)
- abort ();
while (node->callees)
cgraph_remove_call (node->decl, node->callees->callee->decl);
+
/* We may need to re-queue the node for assembling in case
we already proceeded it and ignored as not needed. */
if (node->reachable && !flag_unit_at_a_time)
@@ -183,6 +188,7 @@ cgraph_finalize_function (tree decl)
node->reachable = 0;
}
}
+
notice_global_symbol (decl);
node->decl = decl;
node->local.finalized = true;
@@ -195,13 +201,13 @@ cgraph_finalize_function (tree decl)
if (decide_is_function_needed (node, decl))
cgraph_mark_needed_node (node);
- /* If not unit at a time, go ahead and emit everything we've
- found to be reachable at this time. Do this only at top-level. */
- if (!node->origin)
+ /* If not unit at a time, go ahead and emit everything we've found
+ to be reachable at this time. */
+ if (!nested)
cgraph_assemble_pending_functions ();
/* If we've not yet emitted decl, tell the debug info about it. */
- if (flag_unit_at_a_time || !node->reachable)
+ if (!TREE_ASM_WRITTEN (decl))
(*debug_hooks->deferred_inline_function) (decl);
}
@@ -465,7 +471,8 @@ cgraph_expand_function (struct cgraph_node *node)
tree decl = node->decl;
struct cgraph_edge *e;
- announce_function (decl);
+ if (flag_unit_at_a_time)
+ announce_function (decl);
cgraph_optimize_function (node);