aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenth@tat.physik.uni-tuebingen.de>2005-03-22 20:53:40 +0000
committerJan Hubicka <jh@suse.cz>2005-03-22 20:53:40 +0000
commitaef99ee6c380d2d16c89316a75b9ecde3a08664f (patch)
treee6caff86555ce9f9639013c3cd82b4c469828776 /gcc/cgraphunit.c
parent41ae5cb80ebc4b491cbc92589d6c1af726b3d4c2 (diff)
* cgraphunit.c (cgraph_estimate_size_after_inlining): Compute
call cost based on argument sizes. (cgraph_mark_inline_edge): Avoid inline unit from shringking by inlining. * params.def: (max-inline-inssn-single): Set to 450. (max-inline-insns-auto): Set to 90. (max-inline-insns-recursive): Set to 450 (max-inline-insns-recursive-auto): Set to 450. (large-function-insns): Set to 2700. (inline-call-cost): New parameter. * tree-inline.c (estimate_move_cost): New function. (estimate_num_insns_1): Compute move sizes costs by estimate_move_cost for non-gimple-regs, set cost to 0 for gimple-regs. Compute call size based on arguments. * tree-inline.h (estimate_move_cost): Declare. * invoke.texi: (max-inline-inssn-single): Change default to 450. (max-inline-insns-auto): Change default to 90. (max-inline-insns-recursive): Change default to 450 (max-inline-insns-recursive-auto): Change default to 450. (large-function-insns): Change default to 2700. (inline-call-cost): Document new parameter. * gcc.dg/winline-6.c: Modify so inlined function have nonzero cost. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@96892 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index db0aaaf2ada..6e864d5e243 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1030,7 +1030,12 @@ static int
cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to,
struct cgraph_node *what)
{
- return (what->global.insns - INSNS_PER_CALL) * times + to->global.insns;
+ tree fndecl = what->decl;
+ tree arg;
+ int call_insns = PARAM_VALUE (PARAM_INLINE_CALL_COST);
+ for (arg = DECL_ARGUMENTS (fndecl); arg; arg = TREE_CHAIN (arg))
+ call_insns += estimate_move_cost (TREE_TYPE (arg));
+ return (what->global.insns - call_insns) * times + to->global.insns;
}
/* Estimate the growth caused by inlining NODE into all callees. */
@@ -1124,7 +1129,8 @@ cgraph_mark_inline_edge (struct cgraph_edge *e)
to->global.insns = new_insns;
}
gcc_assert (what->global.inlined_to == to);
- overall_insns += new_insns - old_insns;
+ if (new_insns > old_insns)
+ overall_insns += new_insns - old_insns;
ncalls_inlined++;
}