This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] 32 bit non-eabi mips va_arg
- To: gcc-patches at egcs dot cygnus dot com
- Subject: Re: [patch] 32 bit non-eabi mips va_arg
- From: Clinton Popetz <cpopetz at cygnus dot com>
- Date: 14 Jan 2000 11:06:19 -0600
- Newsgroups: cygnus.egcs.patches
- Organization: Cygnus Solutions
- References: <20000114105602.A27136@cpopetz.com>
Sorry, I forgot a ChangeLog entry.
-Clint
2000-01-14 Clinton Popetz <cpopetz@cygnus.com>
* builtins.c (PAD_VARARGS_DOWN): Define.
(std_expand_builtin_va_arg): Use the above macro.
* config/mips/mips.c (PAD_VARARGS_DOWN): Define.
* tm.texi (Register Arguments): Document the above macro.
>
> Index: builtins.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
> retrieving revision 1.25
> diff -c -2 -p -r1.25 builtins.c
> *** builtins.c 2000/01/11 23:27:40 1.25
> --- builtins.c 2000/01/14 16:00:01
> *************** Boston, MA 02111-1307, USA. */
> *** 52,55 ****
> --- 52,59 ----
> #endif
>
> + #ifndef PAD_VARARGS_DOWN
> + #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
> + #endif
> +
> tree (*lang_type_promotes_to) PARAMS ((tree));
>
> *************** std_expand_builtin_va_arg (valist, type)
> *** 1968,1972 ****
> /* Get AP. */
> addr_tree = valist;
> ! if (BYTES_BIG_ENDIAN)
> {
> /* Small args are padded downward. */
> --- 1972,1976 ----
> /* Get AP. */
> addr_tree = valist;
> ! if (PAD_VARARGS_DOWN)
> {
> /* Small args are padded downward. */
> Index: config/mips/mips.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/mips/mips.h,v
> retrieving revision 1.83
> diff -c -2 -p -r1.83 mips.h
> *** mips.h 2000/01/14 14:31:43 1.83
> --- mips.h 2000/01/14 16:00:06
> ***************
> *** 1,4 ****
> /* Definitions of target machine for GNU compiler. MIPS version.
> ! Copyright (C) 1989, 90-98, 1999 Free Software Foundation, Inc.
> Contributed by A. Lichnewsky (lich@inria.inria.fr).
> Changed by Michael Meissner (meissner@osf.org).
> --- 1,4 ----
> /* Definitions of target machine for GNU compiler. MIPS version.
> ! Copyright (C) 1989, 90-98, 1999, 2000 Free Software Foundation, Inc.
> Contributed by A. Lichnewsky (lich@inria.inria.fr).
> Changed by Michael Meissner (meissner@osf.org).
> *************** do { \
> *** 1439,1442 ****
> --- 1439,1447 ----
> || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN))
>
> +
> + /* Force right-alignment for small varargs in 32 bit little_endian mode */
> +
> + #define PAD_VARARGS_DOWN (TARGET_64BIT ? BYTES_BIG_ENDIAN : !BYTES_BIG_ENDIAN)
> +
> /* Define this macro if an argument declared as `char' or `short' in a
> prototype should actually be passed as an `int'. In addition to
>
> Index: tm.texi
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
> retrieving revision 1.104
> diff -c -2 -p -r1.104 tm.texi
> *** tm.texi 2000/01/13 10:43:33 1.104
> --- tm.texi 2000/01/14 16:48:43
> *************** big-endian machines, the default is to p
> *** 2944,2947 ****
> --- 2944,2955 ----
> constant size shorter than an @code{int}, and upward otherwise.
>
> + @findex PAD_VARARGS_DOWN
> + @item PAD_VARARGS_DOWN
> + If defined, a C expression which determines whether the default
> + implementation of va_arg will attempt to pad down before reading the
> + next argument, if that argument is smaller than its aligned space as
> + controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such
> + arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
> +
> @findex FUNCTION_ARG_BOUNDARY
> @item FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})