aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-01-29 01:34:09 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2004-01-29 00:34:09 +0000
commitd173e68599639b825a1e12884fa35c00a024bee4 (patch)
tree66950d896c4e79e9db825a8c670c14a160a7f554 /gcc/cgraphunit.c
parentba9d552e03a1b1d0daa792d157d5268020300afc (diff)
downloadgcc-d173e68599639b825a1e12884fa35c00a024bee4.zip
gcc-d173e68599639b825a1e12884fa35c00a024bee4.tar.gz
gcc-d173e68599639b825a1e12884fa35c00a024bee4.tar.bz2
re PR c++/12850 (memory consumption for heavy template instantiations tripled since 3.3)
PR c++/12850 * cgraph.c (cgraph_remove_node): Clear out saved/insns/arguments and initial pointers. * cgraphunit.c (cgraph_finalize_function): Clear out DECL_SAVED_INSNS for functions that will be only inlined. (cgraph_mark_function_to_output): Likewise. (cgraph_expand_function): Sanity check that DECL_DEFER_OUTPUT is clear; do not clear function body. * tree-optimize.c (clear_decl_rtl): Use decl_function_context. (tree_rest_of_compilation): Reorganize the logic releasing function body to use callgraph datastructure. From-SVN: r76822
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 3a7dcb3..f68bd2a 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -228,6 +228,11 @@ cgraph_finalize_function (tree decl, bool nested)
/* If we've not yet emitted decl, tell the debug info about it. */
if (!TREE_ASM_WRITTEN (decl))
(*debug_hooks->deferred_inline_function) (decl);
+
+ /* We will never really output the function body, clear the SAVED_INSNS array
+ early then. */
+ if (DECL_EXTERNAL (decl))
+ DECL_SAVED_INSNS (decl) = NULL;
}
/* Walk tree and record all calls. Called via walk_tree. */
@@ -476,6 +481,8 @@ cgraph_mark_functions_to_output (void)
&& !TREE_ASM_WRITTEN (decl) && !node->origin
&& !DECL_EXTERNAL (decl))
node->output = 1;
+ else
+ DECL_SAVED_INSNS (decl) = NULL;
}
}
@@ -525,9 +532,9 @@ cgraph_expand_function (struct cgraph_node *node)
/* Generate RTL for the body of DECL. Nested functions are expanded
via lang_expand_decl_stmt. */
(*lang_hooks.callgraph.expand_function) (decl);
+ if (DECL_DEFER_OUTPUT (decl))
+ abort ();
- if (!cgraph_function_possibly_inlined_p (decl))
- DECL_SAVED_TREE (decl) = NULL;
current_function_decl = NULL;
}