summaryrefslogtreecommitdiff
path: root/gcc/tree-optimize.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-09-08 08:56:27 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-09-08 08:56:27 -0700
commitc1f927e84ec73debafbc0114cc4d81abd1b27ae7 (patch)
treead932cb4dec8a82eb9fd686cb0a6c341596f0816 /gcc/tree-optimize.c
parent7f14bbe68f1fac27349b5154730aeb2e23e97dfa (diff)
downloadgcc-c1f927e84ec73debafbc0114cc4d81abd1b27ae7.tar.gz
c-decl.c (c_expand_body_1): Push and pop function context here.
gcc/ * c-decl.c (c_expand_body_1): Push and pop function context here. * tree-optimize.c (tree_rest_of_compilation): ... not here. Take nested argument instead of computing nesting ourselves. gcc/cp/ * decl.c (finish_function): Clear current_function_decl. * decl2.c (mark_used): Don't push/pop gc context. * optimize.c (optimize_function): Likewise. * tree.c (cp_cannot_inline_tree_fn): Likewise. * pt.c (instantiate_decl): Inc/dec function_depth instead. * semantics.c (expand_body): Update for tree_rest_of_compilation nested argument. From-SVN: r71208
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r--gcc/tree-optimize.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index e5bea3ea5bc..253fda2f3cd 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -93,21 +93,13 @@ clear_decl_rtl (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data)
compilation for FNDECL. */
void
-tree_rest_of_compilation (tree fndecl)
+tree_rest_of_compilation (tree fndecl, bool nested_p)
{
- static int nesting = -1;
-
timevar_push (TV_EXPAND);
- ++nesting;
-
if (flag_unit_at_a_time && !cgraph_global_info_ready)
abort ();
- if (nesting > 0)
- /* Squirrel away our current state. */
- push_function_context ();
-
/* Initialize the RTL code for the function. */
current_function_decl = fndecl;
input_location = DECL_SOURCE_LOCATION (fndecl);
@@ -162,7 +154,7 @@ tree_rest_of_compilation (tree fndecl)
/* If this is a nested function, protect the local variables in the stack
above us from being collected while we're compiling this function. */
- if (nesting > 0)
+ if (nested_p)
ggc_push_context ();
/* There's no need to defer outputting this function any more; we
@@ -173,7 +165,7 @@ tree_rest_of_compilation (tree fndecl)
rest_of_compilation (fndecl);
/* Undo the GC context switch. */
- if (nesting > 0)
+ if (nested_p)
ggc_pop_context ();
/* If requested, warn about function definitions where the function will
@@ -227,7 +219,7 @@ tree_rest_of_compilation (tree fndecl)
clear_decl_rtl,
fndecl);
- if (DECL_SAVED_INSNS (fndecl) == 0 && ! nesting && ! flag_inline_trees)
+ if (DECL_SAVED_INSNS (fndecl) == 0 && !nested_p && !flag_inline_trees)
{
/* Stop pointing to the local nodes about to be freed.
But DECL_INITIAL must remain nonzero so we know this
@@ -240,11 +232,5 @@ tree_rest_of_compilation (tree fndecl)
DECL_ARGUMENTS (fndecl) = 0;
}
- if (nesting > 0)
- /* Return to the enclosing function. */
- pop_function_context ();
-
- --nesting;
-
timevar_pop (TV_EXPAND);
}