diff options
author | Jan Hubicka <jh@suse.cz> | 2006-11-28 11:53:16 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2006-11-28 10:53:16 +0000 |
commit | ff28a94d32c8e9263b842211c49fdbe7dfb227ee (patch) | |
tree | 9bb94288fc5fbb8cdce4a230d3d4b48f6137378e /gcc/ipa-inline.c | |
parent | 00df958942c2e5805cf3ab236da2725f30fee80d (diff) | |
download | gcc-ff28a94d32c8e9263b842211c49fdbe7dfb227ee.zip gcc-ff28a94d32c8e9263b842211c49fdbe7dfb227ee.tar.gz gcc-ff28a94d32c8e9263b842211c49fdbe7dfb227ee.tar.bz2 |
invoke.texi (large-stack-frame, [...]): New params.
* invoke.texi (large-stack-frame, large-stack-frame-growth): New params.
* cgraph.c (dump_cgraph_node): Dump stack usage.
* cgraph.h (cgraph_local_info): Add estimated_self_stack_size.
(cgraph_global_info): Add estimated_stack_size and stack_frame_offset.
* cgraphunit.c (cgraph_analyze_function): Analyze stack sizes.
* ipa-inline.c (cgraph_clone_inlined_nodes): Propagate stack usage.
(cgraph_check_inline_limits): Limit stack growth.
* cfgexpand.c: Include tree-inline.h.
(account_stack_vars): New function.
(expand_one_var): New param to just account the stack; return estimated
size.
(expand_used_vars_for_block): Update call of expand_one_var.
(account_used_vars_for_block): New function.
(estimated_stack_frame_size): Likewise.
(init_vars_expansion, fini_vars_expansion): Break out from..
(expand_used_vars): ... here.
* tree-inline.h (estimated_stack_frame_size): Declare.
* params.def (PARAM_LARGE_STACK_FRAME, PARAM_STACK_FRAME_GROWTH): New.
From-SVN: r119281
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 638fdef..8e47f36 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -115,6 +115,7 @@ cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to, void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_original) { + HOST_WIDE_INT peak; if (duplicate) { /* We may eliminate the need for out-of-line copy to be output. @@ -141,6 +142,11 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_o e->callee->global.inlined_to = e->caller->global.inlined_to; else e->callee->global.inlined_to = e->caller; + e->callee->global.stack_frame_offset + = e->caller->global.stack_frame_offset + e->caller->local.estimated_self_stack_size; + peak = e->callee->global.stack_frame_offset + e->callee->local.estimated_self_stack_size; + if (e->callee->global.inlined_to->global.estimated_stack_size < peak) + e->callee->global.inlined_to->global.estimated_stack_size = peak; /* Recursively clone all bodies. */ for (e = e->callee->callees; e; e = e->next_callee) @@ -257,6 +263,7 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what, struct cgraph_edge *e; int newsize; int limit; + HOST_WIDE_INT stack_size_limit, inlined_stack; if (one_only) times = 1; @@ -288,6 +295,21 @@ cgraph_check_inline_limits (struct cgraph_node *to, struct cgraph_node *what, *reason = N_("--param large-function-growth limit reached"); return false; } + + stack_size_limit = to->local.estimated_self_stack_size; + + stack_size_limit += stack_size_limit * PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) / 100; + + inlined_stack = (to->global.stack_frame_offset + + to->local.estimated_self_stack_size + + what->global.estimated_stack_size); + if (inlined_stack > stack_size_limit + && inlined_stack > PARAM_VALUE (PARAM_LARGE_STACK_FRAME)) + { + if (reason) + *reason = N_("--param large-stack-frame-growth limit reached"); + return false; + } return true; } |