From 88e541e13b8cd466aa6cf4acaada7345e43b8eee Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 29 Dec 2003 18:47:20 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/builtins.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 486b98145a8c..9541d6592447 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-12-29 Nathan Sidwell + + * 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 PR fortran/12632 diff --git a/gcc/builtins.c b/gcc/builtins.c index d3dfb8824d75..c9449fa5ca6a 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 -- 2.43.5