mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
Fix mingw32 thiscall + sret.
Unlike msvc, when handling a thiscall + sret gcc will * Put the sret in %ecx * Put the this pointer is (%esp) This fixes, for example, calling stringstream::str. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -453,18 +453,34 @@ def CC_X86_32_FastCall : CallingConv<[
|
||||
CCDelegateTo<CC_X86_32_Common>
|
||||
]>;
|
||||
|
||||
def CC_X86_32_ThisCall : CallingConv<[
|
||||
def CC_X86_32_ThisCall_Common : CallingConv<[
|
||||
// The first integer argument is passed in ECX
|
||||
CCIfType<[i32], CCAssignToReg<[ECX]>>,
|
||||
|
||||
// Otherwise, same as everything else.
|
||||
CCDelegateTo<CC_X86_32_Common>
|
||||
]>;
|
||||
|
||||
def CC_X86_32_ThisCall_Mingw : CallingConv<[
|
||||
// Promote i8/i16 arguments to i32.
|
||||
CCIfType<[i8, i16], CCPromoteToType<i32>>,
|
||||
|
||||
CCDelegateTo<CC_X86_32_ThisCall_Common>
|
||||
]>;
|
||||
|
||||
def CC_X86_32_ThisCall_Win : CallingConv<[
|
||||
// Promote i8/i16 arguments to i32.
|
||||
CCIfType<[i8, i16], CCPromoteToType<i32>>,
|
||||
|
||||
// Pass sret arguments indirectly through stack.
|
||||
CCIfSRet<CCAssignToStack<4, 4>>,
|
||||
|
||||
// The first integer argument is passed in ECX
|
||||
CCIfType<[i32], CCAssignToReg<[ECX]>>,
|
||||
CCDelegateTo<CC_X86_32_ThisCall_Common>
|
||||
]>;
|
||||
|
||||
// Otherwise, same as everything else.
|
||||
CCDelegateTo<CC_X86_32_Common>
|
||||
def CC_X86_32_ThisCall : CallingConv<[
|
||||
CCIfSubtarget<"isTargetCygMing()", CCDelegateTo<CC_X86_32_ThisCall_Mingw>>,
|
||||
CCDelegateTo<CC_X86_32_ThisCall_Win>
|
||||
]>;
|
||||
|
||||
def CC_X86_32_FastCC : CallingConv<[
|
||||
|
||||
Reference in New Issue
Block a user