diff options
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64CallingConvention.td')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64CallingConvention.td | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64CallingConvention.td b/llvm/lib/Target/AArch64/AArch64CallingConvention.td index 37976a222783..e47996bf38d4 100644 --- a/llvm/lib/Target/AArch64/AArch64CallingConvention.td +++ b/llvm/lib/Target/AArch64/AArch64CallingConvention.td @@ -22,8 +22,7 @@ class CCIfILP32<CCAction A> : // ARM AAPCS64 Calling Convention //===----------------------------------------------------------------------===// -let Entry = 1 in -def CC_AArch64_AAPCS : CallingConv<[ +defvar AArch64_Common = [ CCIfType<[iPTR], CCBitConvertToType<i64>>, CCIfType<[v2f32], CCBitConvertToType<v2i32>>, CCIfType<[v2f64, v4f32], CCBitConvertToType<v2i64>>, @@ -58,11 +57,6 @@ def CC_AArch64_AAPCS : CallingConv<[ // slot is 64-bit. CCIfByVal<CCPassByVal<8, 8>>, - // The 'nest' parameter, if any, is passed in X18. - // Darwin uses X18 as the platform register and hence 'nest' isn't currently - // supported there. - CCIfNest<CCAssignToReg<[X18]>>, - // Pass SwiftSelf in a callee saved register. CCIfSwiftSelf<CCIfType<[i64], CCAssignToReg<[X20]>>>, @@ -115,7 +109,16 @@ def CC_AArch64_AAPCS : CallingConv<[ CCAssignToStack<8, 8>>, CCIfType<[f128, v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16, v8bf16], CCAssignToStack<16, 16>> -]>; +]; + +let Entry = 1 in +def CC_AArch64_AAPCS : CallingConv<!listconcat( + // The 'nest' parameter, if any, is passed in X18. + // Darwin and Windows use X18 as the platform register and hence 'nest' isn't + // currently supported there. + [CCIfNest<CCAssignToReg<[X18]>>], + AArch64_Common +)>; let Entry = 1 in def RetCC_AArch64_AAPCS : CallingConv<[ @@ -153,13 +156,16 @@ def RetCC_AArch64_AAPCS : CallingConv<[ CCAssignToReg<[P0, P1, P2, P3]>> ]>; +let Entry = 1 in +def CC_AArch64_Win64PCS : CallingConv<AArch64_Common>; + // Vararg functions on windows pass floats in integer registers let Entry = 1 in def CC_AArch64_Win64_VarArg : CallingConv<[ CCIfType<[f16, bf16], CCBitConvertToType<i16>>, CCIfType<[f32], CCBitConvertToType<i32>>, CCIfType<[f64], CCBitConvertToType<i64>>, - CCDelegateTo<CC_AArch64_AAPCS> + CCDelegateTo<CC_AArch64_Win64PCS> ]>; // Vararg functions on Arm64EC ABI use a different convention, using @@ -319,31 +325,6 @@ def CC_AArch64_DarwinPCS_ILP32_VarArg : CallingConv<[ CCAssignToStack<16, 16>> ]>; - -// The WebKit_JS calling convention only passes the first argument (the callee) -// in register and the remaining arguments on stack. We allow 32bit stack slots, -// so that WebKit can write partial values in the stack and define the other -// 32bit quantity as undef. -let Entry = 1 in -def CC_AArch64_WebKit_JS : CallingConv<[ - // Handle i1, i8, i16, i32, and i64 passing in register X0 (W0). - CCIfType<[i1, i8, i16], CCPromoteToType<i32>>, - CCIfType<[i32], CCAssignToReg<[W0]>>, - CCIfType<[i64], CCAssignToReg<[X0]>>, - - // Pass the remaining arguments on the stack instead. - CCIfType<[i32, f32], CCAssignToStack<4, 4>>, - CCIfType<[i64, f64], CCAssignToStack<8, 8>> -]>; - -let Entry = 1 in -def RetCC_AArch64_WebKit_JS : CallingConv<[ - CCIfType<[i32], CCAssignToReg<[W0, W1, W2, W3, W4, W5, W6, W7]>>, - CCIfType<[i64], CCAssignToReg<[X0, X1, X2, X3, X4, X5, X6, X7]>>, - CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7]>>, - CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>> -]>; - //===----------------------------------------------------------------------===// // ARM64 Calling Convention for GHC //===----------------------------------------------------------------------===// @@ -352,7 +333,7 @@ def RetCC_AArch64_WebKit_JS : CallingConv<[ // The only documentation is the GHC source code, specifically the C header // file: // -// https://github.com/ghc/ghc/blob/master/includes/stg/MachRegs.h +// https://github.com/ghc/ghc/blob/master/rts/include/stg/MachRegs.h // // which defines the registers for the Spineless Tagless G-Machine (STG) that // GHC uses to implement lazy evaluation. The generic STG machine has a set of @@ -363,8 +344,10 @@ def RetCC_AArch64_WebKit_JS : CallingConv<[ // // https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GeneratedCode // -// The AArch64 register mapping is under the heading "The ARMv8/AArch64 ABI -// register mapping". +// The AArch64 register mapping is defined in the following header file: +// +// https://github.com/ghc/ghc/blob/master/rts/include/stg/MachRegs/arm64.h +// let Entry = 1 in def CC_AArch64_GHC : CallingConv<[ |
