MIPS problem with structures/varargs
Mark Mitchell
mark@codesourcery.com
Thu Sep 30 19:57:00 GMT 1999
Gavin --
How about the attached simple patch? (It needs a ChangeLog, I
know.)
The definition of FUNCTION_ARG_PADDING here is just what was in
defaults.h (which is what MIPS used before), except that in big-endian
mode, we left-align small things. (This won't affect passing `char'
because that's promoted to an `int' anyhow; the only small things are
therefore small structures.)
This fixes the bug on my test case. But, I haven't got any way to
really test on big-endian MIPS. Perhaps the test for `mips_abi ==
ABI_32' should also include ABI_N32 and ABI_64?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
Index: mips.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.h,v
retrieving revision 1.62
diff -c -p -r1.62 mips.h
*** mips.h 1999/08/31 02:16:29 1.62
--- mips.h 1999/09/05 19:04:06
*************** typedef struct mips_args {
*** 2564,2569 ****
--- 2564,2584 ----
#define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
function_arg_partial_nregs (&CUM, MODE, TYPE, NAMED)
+ /* If defined, a C expression which determines whether, and in which
+ direction, to pad out an argument with extra space. The value
+ should be of type `enum direction': either `upward' to pad above
+ the argument, `downward' to pad below, or `none' to inhibit
+ padding. */
+
+ #define FUNCTION_ARG_PADDING(MODE, TYPE) \
+ (! BYTES_BIG_ENDIAN \
+ ? upward \
+ : (((MODE) == BLKmode \
+ ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
+ && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \
+ : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
+ ? ((mips_abi == ABI_32) ? upward : downward) : upward))
+
/* 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. */
More information about the Gcc-bugs
mailing list