[LLVMdev] Handling SRet on Windows x86

Anton Korobeynikov asl at math.spbu.ru
Tue Oct 2 08:03:19 PDT 2012

Hello Timur,

> I'd like to ask for advice:
> a) Is it OK to change the SRet/ThisCall behaviour on non-Windows platforms?
>     [I suppose no]

> b) Should I be altering CC_X86_32_ThisCall
>     OR should I introduce CC_X86_Win32_ThisCall instead?
>     [Answer not clear to me - is there any platform besides Windows
>     that uses thiscall?]

It seems for me that you're trying to solve the problem from the wrong
end. As far as I remember, there is a difference - "simple" (probable
POD-like stuff) are returned in the regs, while classes with
non-trivial ctors, etc. are passed / returned on stack. It's frontend
responsibility to emit proper IR in this case.

See http://llvm.org/bugs/show_bug.cgi?id=5064 and around. This seems
to be the correct description of what's going on.

With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University

More information about the llvm-dev mailing list