aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2010-10-09 15:05:51 -0700
committerRichard Henderson <rth@gcc.gnu.org>2010-10-09 15:05:51 -0700
commit3a42502df4cb1fd3b8090658920bfe2635b39613 (patch)
treea90073debda145f6a7cc32fb368f7c0370185f15 /gcc/builtins.c
parenta5f4f531fe6b58b550d0fda12a90bc94b7986402 (diff)
downloadgcc-3a42502df4cb1fd3b8090658920bfe2635b39613.zip
gcc-3a42502df4cb1fd3b8090658920bfe2635b39613.tar.gz
gcc-3a42502df4cb1fd3b8090658920bfe2635b39613.tar.bz2
re PR rtl-optimization/33721 ([meta-bug] Gcc can't properly align stack variable)
PR rtl-opt/33721 * explow.c (allocate_dynamic_stack_space): Add REQUIRED_ALIGN parm, remove TARGET parm, convert KNOWN_ALIGN parm to SIZE_ALIGN. Honor required_align, tidy the code a bit. Emit split_stack code in the right place. Mark the return value with the alignment properly. * expr.h (allocate_dynamic_stack_space): Update decl. * builtins.c (expand_builtin_apply): Update call to allocate_dynamic_stack_space. (expand_builtin_alloca): Likewise. Remove TARGET parameter. * calls.c (initialize_argument_information): Update call to allocate_dynamic_stack_space. (expand_call): Likewise. * cfgexpand.c (get_decl_align_unit): Don't limit alignment. Don't update_stack_alignment here. (alloc_stack_frame_space): Make ALIGN unsigned. (stack_var_cmp): Sort by alignment too. (partition_stack_vars): Don't merge large and small alignment vars. (expand_one_stack_var_at): Add BASE and BASE_ALIGN parameters. Take care when BASE is not virtual_stack_vars_rtx. (expand_stack_vars): Allocate dynamic stack space for large alignment variables. (expand_one_stack_var): Update all to expand_one_stack_var_at. (defer_stack_allocation): True for large alignment vars. (update_stack_alignment): Merge into ... (expand_one_var): ... here. (gimple_expand_cfg): Place code from expand_stack_vars. From-SVN: r165240
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1764cb4..6fd2d35 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -132,7 +132,7 @@ static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
static rtx expand_builtin_memset_args (tree, tree, tree, rtx, enum machine_mode, tree);
static rtx expand_builtin_bzero (tree);
static rtx expand_builtin_strlen (tree, rtx, enum machine_mode);
-static rtx expand_builtin_alloca (tree, rtx, bool);
+static rtx expand_builtin_alloca (tree, bool);
static rtx expand_builtin_unop (enum machine_mode, tree, rtx, rtx, optab);
static rtx expand_builtin_frame_address (tree, tree);
static tree stabilize_va_list_loc (location_t, tree, int);
@@ -1572,7 +1572,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
arguments to the outgoing arguments address. 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 (argsize, 0, BITS_PER_UNIT, TRUE);
+ allocate_dynamic_stack_space (argsize, 0, BIGGEST_ALIGNMENT, true);
/* Set DRAP flag to true, even though allocate_dynamic_stack_space
may have already set current_function_calls_alloca to true.
@@ -4931,12 +4931,11 @@ expand_builtin_frame_address (tree fndecl, tree exp)
}
/* Expand EXP, a call to the alloca builtin. Return NULL_RTX if we
- failed and the caller should emit a normal call, otherwise try to
- get the result in TARGET, if convenient. CANNOT_ACCUMULATE is the
- same as for allocate_dynamic_stack_space. */
+ failed and the caller should emit a normal call. CANNOT_ACCUMULATE
+ is the same as for allocate_dynamic_stack_space. */
static rtx
-expand_builtin_alloca (tree exp, rtx target, bool cannot_accumulate)
+expand_builtin_alloca (tree exp, bool cannot_accumulate)
{
rtx op0;
rtx result;
@@ -4952,7 +4951,7 @@ expand_builtin_alloca (tree exp, rtx target, bool cannot_accumulate)
op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
/* Allocate the desired space. */
- result = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT,
+ result = allocate_dynamic_stack_space (op0, 0, BIGGEST_ALIGNMENT,
cannot_accumulate);
result = convert_memory_address (ptr_mode, result);
@@ -5997,7 +5996,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
case BUILT_IN_ALLOCA:
/* If the allocation stems from the declaration of a variable-sized
object, it cannot accumulate. */
- target = expand_builtin_alloca (exp, target, ALLOCA_FOR_VAR_P (exp));
+ target = expand_builtin_alloca (exp, ALLOCA_FOR_VAR_P (exp));
if (target)
return target;
break;