[LLVMdev] MinGW/MSVC++ uses different ABI for sret

Óscar Fuentes ofv at wanadoo.es
Fri Sep 25 17:42:24 PDT 2009

Hello Eli.

Eli Friedman <eli.friedman at gmail.com> writes:

> On Fri, Sep 25, 2009 at 2:41 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:
>> I filed a bug yesterday ( http://llvm.org/bugs/show_bug.cgi?id=5046 )
>> and Anton kindly explained that LLVM is doing the right thing as per the
>> ABI (the GCC ABI, I'll add).
>>  1. Is there a LLVM way of dealing with this without using separate code
>>  for VC++ and GCC?
> I'm not sure what you mean... LLVM can distinguish between MinGW and
> MSVC targets.   If we want to, it shouldn't be too hard to make
> X86TargetLowering::LowerFormalArguments and
> X86TargetLowering::LowerCall account for the difference.

Yes, automatically switching to the MSVC ABI when the target triple is
*-pc-win32 seems the Right Thing.

>>  3. Is a bug that LLVM does not distinguish among GCC and VC++ sret
>>  handling?
> Probably... see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834 .

Great! Googling two hours and didn't found that report nor the
documents linked from it :-/

I'll file a LLVM bug report about this issue.

BTW, it's even worse, as aggregates passed by value are, well... passed
by value, contrary to the 386 unix ABI which uses pointers. I'm afraid
that this has no so easy solution as the sret issue. Is there any LLVM
target where aggregates are "really" passed by value?

Thanks Eli.


More information about the llvm-dev mailing list