mips-protos.h (function_arg_boundary): Declare.
authorRichard Sandiford <rsandifo@redhat.com>
Sat, 27 Nov 2004 09:46:43 +0000 (09:46 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 27 Nov 2004 09:46:43 +0000 (09:46 +0000)
* 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

gcc/ChangeLog
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h

index c1fe9b7dd0002ba579e32948c9b6600d3a9af9fe..bb246c40c6a18064b63e6545bbfa05a241810ebc 100644 (file)
@@ -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
index 834c41d1a8ebd3342c8f81dc476304a9f420b6ed..77b7a9ab795c5c85928b267069dcd175a12bfc9e 100644 (file)
@@ -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);
index 601e3cec3987e845d27fa3970454d5191a56f53d..1b98eca3c815a6c871c38d92400ddebc15be58b7 100644 (file)
@@ -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
index 1e578d326e3db82011fe58520fcfdb53750fd613..fd42276eb7a6373e0fc119217daf3859615e1537 100644 (file)
@@ -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)
 \f
 #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)
 
 \f
 /* Implement `va_start' for varargs and stdarg.  */