Commit b7e52782 by Eric Botcazou Committed by Eric Botcazou

* builtins. (expand_builtin_alloca): Remove second parameter and

	infer its value from the first parameter instead.
	(expand_builtin) <BUILT_IN_ALLOCA>: Adjust call to above.

From-SVN: r248818
parent 1c26adb7
2017-06-02 Eric Botcazou <ebotcazou@adacore.com>
* builtins. (expand_builtin_alloca): Remove second parameter and
infer its value from the first parameter instead.
(expand_builtin) <BUILT_IN_ALLOCA>: Adjust call to above.
2017-06-02 Jakub Jelinek <jakub@redhat.com> 2017-06-02 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80903 PR rtl-optimization/80903
......
...@@ -140,7 +140,7 @@ static rtx expand_builtin_memset_with_bounds (tree, rtx, machine_mode); ...@@ -140,7 +140,7 @@ static rtx expand_builtin_memset_with_bounds (tree, rtx, machine_mode);
static rtx expand_builtin_memset_args (tree, tree, tree, rtx, machine_mode, tree); static rtx expand_builtin_memset_args (tree, tree, tree, rtx, machine_mode, tree);
static rtx expand_builtin_bzero (tree); static rtx expand_builtin_bzero (tree);
static rtx expand_builtin_strlen (tree, rtx, machine_mode); static rtx expand_builtin_strlen (tree, rtx, machine_mode);
static rtx expand_builtin_alloca (tree, bool); static rtx expand_builtin_alloca (tree);
static rtx expand_builtin_unop (machine_mode, tree, rtx, rtx, optab); static rtx expand_builtin_unop (machine_mode, tree, rtx, rtx, optab);
static rtx expand_builtin_frame_address (tree, tree); static rtx expand_builtin_frame_address (tree, tree);
static tree stabilize_va_list_loc (location_t, tree, int); static tree stabilize_va_list_loc (location_t, tree, int);
...@@ -4914,11 +4914,10 @@ expand_builtin_frame_address (tree fndecl, tree exp) ...@@ -4914,11 +4914,10 @@ expand_builtin_frame_address (tree fndecl, tree exp)
} }
/* Expand EXP, a call to the alloca builtin. Return NULL_RTX if we /* Expand EXP, a call to the alloca builtin. Return NULL_RTX if we
failed and the caller should emit a normal call. CANNOT_ACCUMULATE failed and the caller should emit a normal call. */
is the same as for allocate_dynamic_stack_space. */
static rtx static rtx
expand_builtin_alloca (tree exp, bool cannot_accumulate) expand_builtin_alloca (tree exp)
{ {
rtx op0; rtx op0;
rtx result; rtx result;
...@@ -4926,7 +4925,7 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate) ...@@ -4926,7 +4925,7 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate)
tree fndecl = get_callee_fndecl (exp); tree fndecl = get_callee_fndecl (exp);
bool alloca_with_align = (DECL_FUNCTION_CODE (fndecl) bool alloca_with_align = (DECL_FUNCTION_CODE (fndecl)
== BUILT_IN_ALLOCA_WITH_ALIGN); == BUILT_IN_ALLOCA_WITH_ALIGN);
bool alloca_for_var = CALL_ALLOCA_FOR_VAR_P (exp);
bool valid_arglist bool valid_arglist
= (alloca_with_align = (alloca_with_align
? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE) ? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)
...@@ -4955,8 +4954,9 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate) ...@@ -4955,8 +4954,9 @@ expand_builtin_alloca (tree exp, bool cannot_accumulate)
? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1)) ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1))
: BIGGEST_ALIGNMENT); : BIGGEST_ALIGNMENT);
/* Allocate the desired space. */ /* Allocate the desired space. If the allocation stems from the declaration
result = allocate_dynamic_stack_space (op0, 0, align, cannot_accumulate); of a variable-sized object, it cannot accumulate. */
result = allocate_dynamic_stack_space (op0, 0, align, alloca_for_var);
result = convert_memory_address (ptr_mode, result); result = convert_memory_address (ptr_mode, result);
return result; return result;
...@@ -6752,9 +6752,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, ...@@ -6752,9 +6752,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
case BUILT_IN_ALLOCA: case BUILT_IN_ALLOCA:
case BUILT_IN_ALLOCA_WITH_ALIGN: case BUILT_IN_ALLOCA_WITH_ALIGN:
/* If the allocation stems from the declaration of a variable-sized target = expand_builtin_alloca (exp);
object, it cannot accumulate. */
target = expand_builtin_alloca (exp, CALL_ALLOCA_FOR_VAR_P (exp));
if (target) if (target)
return target; return target;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment