For EABI, start allocting space on the stack when the registers are

full.  Not when the number of args == 8.
This commit is contained in:
Andrew Cagney 2000-06-23 11:06:31 +00:00
parent ed6d6fd3c4
commit 566f0f7aa5
2 changed files with 22 additions and 11 deletions

View file

@ -1,3 +1,9 @@
Fri Jun 23 20:47:03 2000 Andrew Cagney <cagney@b1.cygnus.com>
* mips-tdep.c (mips_push_arguments): Use the variable stack_used_p
to determine if any arguments were written to the stack. Do not
rely on NUMARG>=8.
Mon Jun 19 11:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com> Mon Jun 19 11:29:35 2000 Andrew Cagney <cagney@b1.cygnus.com>
* command.h (add_set_auto_boolean_cmd): Add declaration. * command.h (add_set_auto_boolean_cmd): Add declaration.

View file

@ -2259,18 +2259,20 @@ mips_push_arguments (nargs, args, sp, struct_return, struct_addr)
register are only written to memory. */ register are only written to memory. */
while (len > 0) while (len > 0)
{ {
/* Rememer if the argument was written to the stack. */
int stack_used_p = 0;
int partial_len = len < MIPS_SAVED_REGSIZE ? len : MIPS_SAVED_REGSIZE; int partial_len = len < MIPS_SAVED_REGSIZE ? len : MIPS_SAVED_REGSIZE;
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM if (argreg > MIPS_LAST_ARG_REGNUM
|| odd_sized_struct || odd_sized_struct
|| fp_register_arg_p (typecode, arg_type)) || fp_register_arg_p (typecode, arg_type))
{ {
/* Write this portion of the argument to the stack. */
/* Should shorter than int integer values be /* Should shorter than int integer values be
promoted to int before being stored? */ promoted to int before being stored? */
int longword_offset = 0; int longword_offset = 0;
CORE_ADDR addr; CORE_ADDR addr;
stack_used_p = 1;
if (TARGET_BYTE_ORDER == BIG_ENDIAN) if (TARGET_BYTE_ORDER == BIG_ENDIAN)
{ {
if (MIPS_STACK_ARGSIZE == 8 && if (MIPS_STACK_ARGSIZE == 8 &&
@ -2309,6 +2311,8 @@ mips_push_arguments (nargs, args, sp, struct_return, struct_addr)
/* Note!!! This is NOT an else clause. Odd sized /* Note!!! This is NOT an else clause. Odd sized
structs may go thru BOTH paths. Floating point structs may go thru BOTH paths. Floating point
arguments will not. */ arguments will not. */
/* Write this portion of the argument to a general
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM if (argreg <= MIPS_LAST_ARG_REGNUM
&& !fp_register_arg_p (typecode, arg_type)) && !fp_register_arg_p (typecode, arg_type))
{ {
@ -2352,17 +2356,18 @@ mips_push_arguments (nargs, args, sp, struct_return, struct_addr)
len -= partial_len; len -= partial_len;
val += partial_len; val += partial_len;
/* The offset onto the stack at which we will start /* Compute the the offset into the stack at which we
copying parameters (after the registers are used up) will copy the next parameter.
begins at (4 * MIPS_REGSIZE) in the old ABI. This
leaves room for the "home" area for register parameters.
In the new EABI (and the NABI32), the 8 register parameters In older ABIs, the caller reserved space for
do not have "home" stack space reserved for them, so the registers that contained arguments. This was loosely
stack offset does not get incremented until after refered to as their "home". Consequently, space is
we have used up the 8 parameter registers. */ always allocated.
if (MIPS_REGS_HAVE_HOME_P || argnum >= 8) In the new EABI (and the NABI32), the stack_offset
only needs to be adjusted when it has been used.. */
if (MIPS_REGS_HAVE_HOME_P || stack_used_p)
stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE); stack_offset += ROUND_UP (partial_len, MIPS_STACK_ARGSIZE);
} }
} }