aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-12-29 18:47:20 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-12-29 18:47:20 +0000
commit88e541e13b8cd466aa6cf4acaada7345e43b8eee (patch)
treebab6c846ae138d8ab40bf953fabc1f49bd143bb1
parent30a035080e17df2e1b21322d398532b30af80cd1 (diff)
downloadgcc-88e541e13b8cd466aa6cf4acaada7345e43b8eee.zip
gcc-88e541e13b8cd466aa6cf4acaada7345e43b8eee.tar.gz
gcc-88e541e13b8cd466aa6cf4acaada7345e43b8eee.tar.bz2
builtins.c (expand_builtin_apply_args_1): Add pretend args size to the virtual incoming args pointer for downward stacks.
* builtins.c (expand_builtin_apply_args_1): Add pretend args size to the virtual incoming args pointer for downward stacks. From-SVN: r75207
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/builtins.c14
2 files changed, 14 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 486b981..9541d659 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-29 Nathan Sidwell <nathan@codesourcery.com>
+
+ * builtins.c (expand_builtin_apply_args_1): Add pretend args size
+ to the virtual incoming args pointer for downward stacks.
+
2003-12-29 Roger Sayle <roger@eyesopen.com>
PR fortran/12632
diff --git a/gcc/builtins.c b/gcc/builtins.c
index d3dfb88..c9449fa 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1096,7 +1096,7 @@ result_vector (int savep, rtx result)
static rtx
expand_builtin_apply_args_1 (void)
{
- rtx registers;
+ rtx registers, tem;
int size, align, regno;
enum machine_mode mode;
rtx struct_incoming_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 1);
@@ -1114,8 +1114,6 @@ expand_builtin_apply_args_1 (void)
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if ((mode = apply_args_mode[regno]) != VOIDmode)
{
- rtx tem;
-
align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
if (size % align != 0)
size = CEIL (size, align) * align;
@@ -1127,8 +1125,14 @@ expand_builtin_apply_args_1 (void)
}
/* Save the arg pointer to the block. */
- emit_move_insn (adjust_address (registers, Pmode, 0),
- copy_to_reg (virtual_incoming_args_rtx));
+ tem = copy_to_reg (virtual_incoming_args_rtx);
+#ifdef STACK_GROWS_DOWNWARDS
+ /* We need the pointer as the caller actually passed them to us, not
+ as we might have pretended they were passed. */
+ tem = plus_constant (tem, current_function_pretend_args_size);
+#endif
+ emit_move_insn (adjust_address (registers, Pmode, 0), tem);
+
size = GET_MODE_SIZE (Pmode);
/* Save the structure value address unless this is passed as an