aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-03-08 14:26:37 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-03-08 13:26:37 +0000
commit18d13f34175f157bc3152afdf48da798452afc1b (patch)
tree8a4f34953d22192851b98b6fb46d7a44532ecfc0 /gcc/tree-inline.c
parent4a07c08a47f2a4fbce5634b93834ed824ebafc79 (diff)
downloadgcc-18d13f34175f157bc3152afdf48da798452afc1b.zip
gcc-18d13f34175f157bc3152afdf48da798452afc1b.tar.gz
gcc-18d13f34175f157bc3152afdf48da798452afc1b.tar.bz2
inline-3.c: New test.
* gcc.dg/inline-3.c: New test. * c-decl.c: (finish_function): Update call of tree_inlinable_function_p. * cgraph.h: (cgraph_local_info): Add can_inline_once (cgraph_global_info): Add inline_once. (cgraph_node): Add previous. (cgraph_remove_node): New. * cgraphunit.c (cgraph_mark_functions_to_inline_once): New static function. (cgraph_optimize): Call it. (cgraph_finalize_function): Set inlinable flags. (cgraph_finalize_compilation_unit): Actually remove the reclaimed nodes. (cgraph_mark_functions_to_output): Use new inlining heuristics flags. (cgraph_expand_function): Likewise. * cgraph.c (cgraph_node): Put nodes into doubly linked chain. (cgraph_remove_node): New function. * flags.h (flag_inline_functions_called_once): Declare. * tree-inline.c: Include cgraph.h (inlinable_functions_p): Add extra argument to bypass limits. (expand_call_inline): Obey cgraph flag. * tree-inline.h (tree_inlinable_function_p): Update prototype. From-SVN: r63983
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index e1fab06..a49dca9 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -115,7 +115,7 @@ static tree copy_body_r PARAMS ((tree *, int *, void *));
static tree copy_body PARAMS ((inline_data *));
static tree expand_call_inline PARAMS ((tree *, int *, void *));
static void expand_calls_inline PARAMS ((tree *, inline_data *));
-static int inlinable_function_p PARAMS ((tree, inline_data *));
+static int inlinable_function_p PARAMS ((tree, inline_data *, int));
static tree remap_decl PARAMS ((tree, inline_data *));
#ifndef INLINER_FOR_JAVA
static tree initialize_inlined_parameters PARAMS ((inline_data *, tree, tree));
@@ -872,10 +872,11 @@ declare_return_variable (id, return_slot_addr, var)
/* Returns nonzero if a function can be inlined as a tree. */
int
-tree_inlinable_function_p (fn)
+tree_inlinable_function_p (fn, nolimit)
tree fn;
+ int nolimit;
{
- return inlinable_function_p (fn, NULL);
+ return inlinable_function_p (fn, NULL, nolimit);
}
/* If *TP is possibly call to alloca, return nonzero. */
@@ -939,9 +940,10 @@ find_builtin_longjmp_call (exp)
can be inlined at all. */
static int
-inlinable_function_p (fn, id)
+inlinable_function_p (fn, id, nolimit)
tree fn;
inline_data *id;
+ int nolimit;
{
int inlinable;
int currfn_insns;
@@ -973,12 +975,13 @@ inlinable_function_p (fn, id)
front-end that must set DECL_INLINE in this case, because
dwarf2out loses if a function is inlined that doesn't have
DECL_INLINE set. */
- else if (! DECL_INLINE (fn))
+ else if (! DECL_INLINE (fn) && !nolimit)
;
/* We can't inline functions that are too big. Only allow a single
function to be of MAX_INLINE_INSNS_SINGLE size. Make special
allowance for extern inline functions, though. */
- else if (! (*lang_hooks.tree_inlining.disregard_inline_limits) (fn)
+ else if (!nolimit
+ && ! (*lang_hooks.tree_inlining.disregard_inline_limits) (fn)
&& currfn_insns > max_inline_insns_single)
;
/* We can't inline functions that call __builtin_longjmp at all.
@@ -1009,7 +1012,7 @@ inlinable_function_p (fn, id)
/* In case we don't disregard the inlining limits and we basically
can inline this function, investigate further. */
if (! (*lang_hooks.tree_inlining.disregard_inline_limits) (fn)
- && inlinable)
+ && inlinable && !nolimit)
{
int sum_insns = (id ? id->inlined_stmts : 0) * INSNS_PER_STMT
+ currfn_insns;
@@ -1158,7 +1161,9 @@ expand_call_inline (tp, walk_subtrees, data)
/* Don't try to inline functions that are not well-suited to
inlining. */
- if (!inlinable_function_p (fn, id))
+ if ((!flag_unit_at_a_time || !DECL_SAVED_TREE (fn)
+ || !cgraph_global_info (fn)->inline_once)
+ && !inlinable_function_p (fn, id, 0))
return NULL_TREE;
if (! (*lang_hooks.tree_inlining.start_inlining) (fn))