This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] RETURN_IN_MEMORY for cygwin and mingw32


Danny Smith <danny_r_smith_2001@yahoo.co.nz> writes:

> Hi
>
> The default i386 definition of RETURN_IN_MEMORY causes incomapatibility with
> objects produced by native Win32 MSVC compiler and hence the Win32api.
[...]
> + /* MSVC returns aggregate types of up to 8 bytes via registers. */
> + #undef RETURN_IN_MEMORY
> + #define RETURN_IN_MEMORY(TYPE) \
> +   (TYPE_MODE (TYPE) == BLKmode || \
> +      (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes(TYPE) > 8 ))
> + 

> However, given the recent discussion on RETURN_IN_MEMORY
> (http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00315.html)
> I'm not sure if this is the "right thing".   Is there a better way?

The right thing, I believe, would be to put

/* MSVC returns aggregate types of up to 8 bytes via registers.
   See i386.c:ix86_return_in_memory.  */
#define MSVC_AGGREGATE_RETURN 1

in a header file shared by cygwin and mingw32; then in i386.h, next to
the definition of RETURN_IN_MEMORY put

/* This is overriden by <name>.h */
#ifndef MSVC_AGGREGATE_RETURN
#define MSVC_AGGREGATE_RETURN 0
#endif

where <name>.h is the name of the header shared by cygwin and mingw32;
and finally change ix86_return_in_memory so that it produces the MSVC
behavior when MSVC_AGGREGATE_RETURN is true and TARGET_64BIT is false.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]