diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-19 15:58:05 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-19 15:58:05 +0000 |
commit | 2b34677fbeb37af3d28c381312f4a39bc5604b5d (patch) | |
tree | 220024bc6525d567df9a66f538a7903a174bcadc /gcc/calls.c | |
parent | e6e9878940feb02d0a3cc7b2796a9ab9677b74ed (diff) | |
download | gcc-2b34677fbeb37af3d28c381312f4a39bc5604b5d.tar.gz |
* asan.c (handle_builtin_alloca): Deal with all alloca variants.
(get_mem_refs_of_builtin_call): Likewise.
* builtins.c (expand_builtin_apply): Adjust call to
allocate_dynamic_stack_space.
(expand_builtin_alloca): For __builtin_alloca_with_align_and_max, pass
the third argument to allocate_dynamic_stack_space, otherwise -1.
(expand_builtin): Deal with all alloca variants.
(is_inexpensive_builtin): Likewise.
* builtins.def (BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX): New.
* calls.c (special_function_p): Deal with all alloca variants.
(initialize_argument_information): Adjust call to
allocate_dynamic_stack_space.
(expand_call): Likewise.
* cfgexpand.c (expand_call_stmt): Deal with all alloca variants.
* doc/extend.texi (Built-ins): Add __builtin_alloca_with_align_and_max
* explow.c (allocate_dynamic_stack_space): Add MAX_SIZE parameter and
use it for the stack usage computation.
* explow.h (allocate_dynamic_stack_space): Adjust prototype.
* function.c (gimplify_parameters): Turn BUILT_IN_ALLOCA_WITH_ALIGN
into BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX and pass maximum size.
* gimple-ssa-warn-alloca.c (alloca_call_type): Simplify control flow.
Take into account 3rd argument of __builtin_alloca_with_align_and_max.
(in_loop_p): Remove first argument and useless check.
(pass_walloca::execute): Remove useless test and adjust call to above.
* gimple.c (gimple_build_call_from_tree): Deal with all alloc variants
* gimplify.c (gimplify_vla_decl): Turn BUILT_IN_ALLOCA_WITH_ALIGN into
BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX and pass maximum size.
(gimplify_call_expr): Deal with all alloca variants.
* hsa-gen.c (gen_hsa_alloca): Likewise.
(gen_hsa_insns_for_call): Likewise.
* ipa-pure-const.c (special_builtin_state): Likewise.
* tree-chkp.c (chkp_build_returned_bound): Likewise.
* tree-object-size.c (alloc_object_size): Likewise.
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise.
(call_may_clobber_ref_p_1): Likewise.
* tree-ssa-ccp.c (evaluate_stmt): Likewise.
(ccp_fold_stmt): Likewise.
(optimize_stack_restore): Likewise.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise.
(mark_all_reaching_defs_necessary_1): Likewise.
(propagate_necessity): Likewise.
(eliminate_unnecessary_stmts): Likewise.
* tree.c (build_common_builtin_nodes): Build
BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX.
* tree.h (ALLOCA_FUNCTION_CODE_P): New macro.
(CASE_BUILT_IN_ALLOCA): Likewise.
* varasm.c (incorporeal_function_p): Deal with all alloca variants.
c-family/
* c-common.c (check_builtin_function_arguments): Also check arguments
of __builtin_alloca_with_align_and_max.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 7ed05d40d86..3730f43c7a9 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -607,16 +607,9 @@ special_function_p (const_tree fndecl, int flags) flags |= ECF_RETURNS_TWICE; } - if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) - switch (DECL_FUNCTION_CODE (fndecl)) - { - case BUILT_IN_ALLOCA: - case BUILT_IN_ALLOCA_WITH_ALIGN: - flags |= ECF_MAY_BE_ALLOCA; - break; - default: - break; - } + if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL + && ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (fndecl))) + flags |= ECF_MAY_BE_ALLOCA; return flags; } @@ -698,8 +691,7 @@ gimple_alloca_call_p (const gimple *stmt) if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_ALLOCA: - case BUILT_IN_ALLOCA_WITH_ALIGN: + CASE_BUILT_IN_ALLOCA: return true; default: break; @@ -719,8 +711,7 @@ alloca_call_p (const_tree exp) && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_ALLOCA: - case BUILT_IN_ALLOCA_WITH_ALIGN: + CASE_BUILT_IN_ALLOCA: return true; default: break; @@ -1819,6 +1810,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, copy = allocate_dynamic_stack_space (size_rtx, TYPE_ALIGN (type), TYPE_ALIGN (type), + max_int_size_in_bytes + (type), true); copy = gen_rtx_MEM (BLKmode, copy); set_mem_attributes (copy, type, 1); @@ -3638,8 +3631,8 @@ expand_call (tree exp, rtx target, int ignore) /* We can pass TRUE as the 4th argument because we just saved the stack pointer and will restore it right after the call. */ - allocate_dynamic_stack_space (push_size, 0, - BIGGEST_ALIGNMENT, true); + allocate_dynamic_stack_space (push_size, 0, BIGGEST_ALIGNMENT, + -1, true); } /* If argument evaluation might modify the stack pointer, |