diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-28 10:53:16 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-28 10:53:16 +0000 |
commit | 5a02d67bef967122bde442b874452e3bb1c96791 (patch) | |
tree | 9bb94288fc5fbb8cdce4a230d3d4b48f6137378e /gcc/ipa-inline.c | |
parent | 310615899626b73c22a7a234e3e5add92ae624ec (diff) | |
download | gcc-5a02d67bef967122bde442b874452e3bb1c96791.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119281 138bc75d-0d04-0410-961f-82ee72b054a4
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 638fdefb8c8..8e47f36509b 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; } |