diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-10-05 04:20:27 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-10-05 04:20:27 +0000 |
commit | 4838c5ee553f062d75d0a6288a025e98600de97c (patch) | |
tree | 8ce05ef7518fd1359d3ae5d044511179f1ea1c8f /gcc/c-decl.c | |
parent | 8d5463d486fe257414a840e204531a8e4405a9a6 (diff) | |
download | gcc-4838c5ee553f062d75d0a6288a025e98600de97c.zip gcc-4838c5ee553f062d75d0a6288a025e98600de97c.tar.gz gcc-4838c5ee553f062d75d0a6288a025e98600de97c.tar.bz2 |
Makefile.in (c-decl.o): Depend on tree-inline.h.
* Makefile.in (c-decl.o): Depend on tree-inline.h.
(c-lang.o): Likewise, as well as insn-config.h and integrate.h.
* c-decl.c: Include tree-inline.h.
(c_expand_body): Call optimize_inline_calls. Determine whether
a function is inlinable upfront, and only clear
DECL_SAVED_TREE, DECL_INITIAL and DECL_ARGUMENTS if it isn't.
* c-lang.c: Include tree-inline.h, insn-config.h and integrate.h.
(c_disregard_inline_limits): New function.
(inline_forbidden_p, c_cannot_inline_tree_fn): Likewise.
(c_post_options): Enable tree inlining if inlining is enabled.
Don't inline trees when instrumenting functions.
(c_init): Initialize lang_disregard_inline_limits and
lang_cannot_inline_tree_fn.
* tree-inline.c (initialize_inlined_parameters): Handle calls
with fewer arguments than declared parameters, and fewer
parameters than passed arguments. Don't assume value is a
DECL.
(declare_return_variable): Convert return value back to the
original type, if it was promoted.
(tree_inlinable_function_p): New function.
(inlinable_function_p): Don't look at DECL_INLINE if we're
inlining all functions. Make it work with a NULL id.
Re-check DECL_UNINLINABLE after language-specific checks.
(varargs_function_p): Move back to cp/tree.c.
* tree-inline.h (tree_inlinable_function_p): Declare it.
(varargs_function_p): Removed declaration.
* integrate.h (function_attribute_inlinable_p): Declare it.
* integrate.c (function_attribute_inlinable_p): Export it.
(save_for_inline): Don't bother to prepare argvec when not
inlining.
* cse.c (check_for_label_ref): Don't check deleted labels.
From-SVN: r46025
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ac09d26..10e4270 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "intl.h" #include "tree.h" +#include "tree-inline.h" #include "rtl.h" #include "flags.h" #include "function.h" @@ -6707,11 +6708,24 @@ c_expand_body (fndecl, nested_p) tree fndecl; int nested_p; { + int uninlinable = 1; + /* There's no reason to do any of the work here if we're only doing semantic analysis; this code just generates RTL. */ if (flag_syntax_only) return; + if (flag_inline_trees) + { + /* First, cache whether the current function is inlinable. Some + predicates depend on cfun and current_function_decl to + function completely. */ + uninlinable = ! tree_inlinable_function_p (fndecl); + + /* Then, inline any functions called in it. */ + optimize_inline_calls (fndecl); + } + if (nested_p) { /* Make sure that we will evaluate variable-sized types involved @@ -6751,8 +6765,11 @@ c_expand_body (fndecl, nested_p) /* Generate the RTL for this function. */ expand_stmt (DECL_SAVED_TREE (fndecl)); - /* Allow the body of the function to be garbage collected. */ - DECL_SAVED_TREE (fndecl) = NULL_TREE; + if (uninlinable) + { + /* Allow the body of the function to be garbage collected. */ + DECL_SAVED_TREE (fndecl) = NULL_TREE; + } /* We hard-wired immediate_size_expand to zero above. expand_function_end will decrement this variable. So, we set the @@ -6813,7 +6830,8 @@ c_expand_body (fndecl, nested_p) } } - if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested_p) + 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 |