diff options
author | Richard Sandiford <rsandifo@redhat.com> | 2004-11-27 09:46:43 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2004-11-27 09:46:43 +0000 |
commit | e64ca6c474d58e97631bf92aa9823df39f28d332 (patch) | |
tree | 47c8c495e2fb0e084d92a8feb04e93a863760e9a | |
parent | b78b8bd83ec46cfbed0addd238d9dc6f831959b1 (diff) | |
download | gcc-e64ca6c474d58e97631bf92aa9823df39f28d332.zip gcc-e64ca6c474d58e97631bf92aa9823df39f28d332.tar.gz gcc-e64ca6c474d58e97631bf92aa9823df39f28d332.tar.bz2 |
mips-protos.h (function_arg_boundary): Declare.
* config/mips/mips-protos.h (function_arg_boundary): Declare.
* config/mips/mips.h (PARM_BOUNDARY): Simplify definition.
(STACK_BOUNDARY, MIPS_STACK_ALIGN): Likewise.
(FUNCTION_ARG_BOUNDARY): Use new function_arg_boundary function.
* config/mips/mips.c (function_arg_boundary): New function.
Impose a maximum alignment of STACK_BOUNDARY.
From-SVN: r91370
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/mips/mips-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 17 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 26 |
4 files changed, 32 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1fe9b7..bb246c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-11-27 Richard Sandiford <rsandifo@redhat.com> + + * config/mips/mips-protos.h (function_arg_boundary): Declare. + * config/mips/mips.h (PARM_BOUNDARY): Simplify definition. + (STACK_BOUNDARY, MIPS_STACK_ALIGN): Likewise. + (FUNCTION_ARG_BOUNDARY): Use new function_arg_boundary function. + * config/mips/mips.c (function_arg_boundary): New function. + Impose a maximum alignment of STACK_BOUNDARY. + 2004-11-27 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/17825 diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index 834c41d..77b7a9a 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -143,6 +143,7 @@ extern struct rtx_def *function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern int function_arg_partial_nregs (const CUMULATIVE_ARGS *, enum machine_mode, tree, int); +extern int function_arg_boundary (enum machine_mode, tree); extern bool mips_pad_arg_upward (enum machine_mode, tree); extern bool mips_pad_reg_upward (enum machine_mode, tree); extern void mips_va_start (tree, rtx); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 601e3ce..1b98eca 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -3326,6 +3326,23 @@ function_arg_partial_nregs (const CUMULATIVE_ARGS *cum, } +/* Implement FUNCTION_ARG_BOUNDARY. Every parameter gets at least + PARM_BOUNDARY bits of alignment, but will be given anything up + to STACK_BOUNDARY bits if the type requires it. */ + +int +function_arg_boundary (enum machine_mode mode, tree type) +{ + unsigned int alignment; + + alignment = type ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode); + if (alignment < PARM_BOUNDARY) + alignment = PARM_BOUNDARY; + if (alignment > STACK_BOUNDARY) + alignment = STACK_BOUNDARY; + return alignment; +} + /* Return true if FUNCTION_ARG_PADDING (MODE, TYPE) should return upward rather than downward. In other words, return true if the first byte of the stack slot has useful data, false if the last diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 1e578d3..fd42276 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1300,10 +1300,7 @@ extern const struct mips_cpu_info *mips_tune_info; #endif /* Allocation boundary (in *bits*) for storing arguments in argument list. */ -#define PARM_BOUNDARY ((mips_abi == ABI_O64 \ - || TARGET_NEWABI \ - || (mips_abi == ABI_EABI && TARGET_64BIT)) ? 64 : 32) - +#define PARM_BOUNDARY BITS_PER_WORD /* Allocation boundary (in *bits*) for the code of a function. */ #define FUNCTION_BOUNDARY 32 @@ -2145,7 +2142,7 @@ extern enum reg_class mips_char_to_class[256]; `current_function_outgoing_args_size'. */ #define OUTGOING_REG_PARM_STACK_SPACE -#define STACK_BOUNDARY ((TARGET_OLDABI || mips_abi == ABI_EABI) ? 64 : 128) +#define STACK_BOUNDARY (TARGET_NEWABI ? 128 : 64) #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) 0 @@ -2285,18 +2282,7 @@ typedef struct mips_args { #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED) -/* If defined, a C expression that gives the alignment boundary, in - bits, of an argument with the specified mode and type. If it is - not defined, `PARM_BOUNDARY' is used for all arguments. */ - -#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \ - (((TYPE) != 0) \ - ? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \ - ? PARM_BOUNDARY \ - : TYPE_ALIGN(TYPE)) \ - : ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \ - ? PARM_BOUNDARY \ - : GET_MODE_ALIGNMENT(MODE))) +#define FUNCTION_ARG_BOUNDARY function_arg_boundary #define FUNCTION_ARG_PADDING(MODE, TYPE) \ (mips_pad_arg_upward (MODE, TYPE) ? upward : downward) @@ -2318,10 +2304,8 @@ typedef struct mips_args { /* Treat LOC as a byte offset from the stack pointer and round it up to the next fully-aligned offset. */ -#define MIPS_STACK_ALIGN(LOC) \ - ((TARGET_OLDABI || mips_abi == ABI_EABI) \ - ? ((LOC) + 7) & ~7 \ - : ((LOC) + 15) & ~15) +#define MIPS_STACK_ALIGN(LOC) \ + (TARGET_NEWABI ? ((LOC) + 15) & -16 : ((LOC) + 7) & -8) /* Implement `va_start' for varargs and stdarg. */ |