xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZCallingConv.td (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric//=- SystemZCallingConv.td - Calling conventions for SystemZ -*- tablegen -*-=//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric// This describes the calling conventions for the SystemZ ABI.
90b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
100b57cec5SDimitry Andric
110b57cec5SDimitry Andricclass CCIfExtend<CCAction A>
120b57cec5SDimitry Andric  : CCIf<"ArgFlags.isSExt() || ArgFlags.isZExt()", A>;
130b57cec5SDimitry Andric
140b57cec5SDimitry Andricclass CCIfSubtarget<string F, CCAction A>
150b57cec5SDimitry Andric  : CCIf<!strconcat("static_cast<const SystemZSubtarget&>"
160b57cec5SDimitry Andric                    "(State.getMachineFunction().getSubtarget()).", F),
170b57cec5SDimitry Andric         A>;
180b57cec5SDimitry Andric
190b57cec5SDimitry Andric// Match if this specific argument is a fixed (i.e. named) argument.
200b57cec5SDimitry Andricclass CCIfFixed<CCAction A>
210b57cec5SDimitry Andric    : CCIf<"static_cast<SystemZCCState *>(&State)->IsFixed(ValNo)", A>;
220b57cec5SDimitry Andric
23fe6060f1SDimitry Andric// Match if this specific argument is not a fixed (i.e. vararg) argument.
24fe6060f1SDimitry Andricclass CCIfNotFixed<CCAction A>
25fe6060f1SDimitry Andric    : CCIf<"!(static_cast<SystemZCCState *>(&State)->IsFixed(ValNo))", A>;
26fe6060f1SDimitry Andric
270b57cec5SDimitry Andric// Match if this specific argument was widened from a short vector type.
280b57cec5SDimitry Andricclass CCIfShortVector<CCAction A>
290b57cec5SDimitry Andric    : CCIf<"static_cast<SystemZCCState *>(&State)->IsShortVector(ValNo)", A>;
300b57cec5SDimitry Andric
310b57cec5SDimitry Andric
320b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
330b57cec5SDimitry Andric// z/Linux return value calling convention
340b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
35fe6060f1SDimitry Andricdef RetCC_SystemZ_ELF : CallingConv<[
360b57cec5SDimitry Andric  // Promote i32 to i64 if it has an explicit extension type.
370b57cec5SDimitry Andric  CCIfType<[i32], CCIfExtend<CCPromoteToType<i64>>>,
380b57cec5SDimitry Andric
390b57cec5SDimitry Andric  // A SwiftError is returned in R9.
400b57cec5SDimitry Andric  CCIfSwiftError<CCIfType<[i64], CCAssignToReg<[R9D]>>>,
410b57cec5SDimitry Andric
420b57cec5SDimitry Andric  // ABI-compliant code returns 64-bit integers in R2.  Make the other
430b57cec5SDimitry Andric  // call-clobbered argument registers available for code that doesn't
440b57cec5SDimitry Andric  // care about the ABI.  (R6 is an argument register too, but is
450b57cec5SDimitry Andric  // call-saved and therefore not suitable for return values.)
460b57cec5SDimitry Andric  CCIfType<[i32], CCAssignToReg<[R2L, R3L, R4L, R5L]>>,
470b57cec5SDimitry Andric  CCIfType<[i64], CCAssignToReg<[R2D, R3D, R4D, R5D]>>,
480b57cec5SDimitry Andric
490b57cec5SDimitry Andric  // ABI-complaint code returns float and double in F0.  Make the
500b57cec5SDimitry Andric  // other floating-point argument registers available for code that
510b57cec5SDimitry Andric  // doesn't care about the ABI.  All floating-point argument registers
520b57cec5SDimitry Andric  // are call-clobbered, so we can use all of them here.
530b57cec5SDimitry Andric  CCIfType<[f32], CCAssignToReg<[F0S, F2S, F4S, F6S]>>,
540b57cec5SDimitry Andric  CCIfType<[f64], CCAssignToReg<[F0D, F2D, F4D, F6D]>>,
550b57cec5SDimitry Andric
560b57cec5SDimitry Andric  // Similarly for vectors, with V24 being the ABI-compliant choice.
570b57cec5SDimitry Andric  // Sub-128 vectors are returned in the same way, but they're widened
580b57cec5SDimitry Andric  // to one of these types during type legalization.
590b57cec5SDimitry Andric  CCIfSubtarget<"hasVector()",
600b57cec5SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
610b57cec5SDimitry Andric             CCAssignToReg<[V24, V26, V28, V30, V25, V27, V29, V31]>>>
620b57cec5SDimitry Andric]>;
630b57cec5SDimitry Andric
640b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
65480093f4SDimitry Andric// z/Linux argument calling conventions for GHC
66480093f4SDimitry Andric//===----------------------------------------------------------------------===//
67480093f4SDimitry Andricdef CC_SystemZ_GHC : CallingConv<[
68480093f4SDimitry Andric  // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, R5, R6, R7, R8, SpLim
69480093f4SDimitry Andric  CCIfType<[i64], CCAssignToReg<[R7D, R8D, R10D, R11D, R12D, R13D,
70480093f4SDimitry Andric                                 R6D, R2D, R3D, R4D, R5D, R9D]>>,
71480093f4SDimitry Andric
72480093f4SDimitry Andric  // Pass in STG registers: F1, ..., F6
73480093f4SDimitry Andric  CCIfType<[f32], CCAssignToReg<[F8S, F9S, F10S, F11S, F0S, F1S]>>,
74480093f4SDimitry Andric
75480093f4SDimitry Andric  // Pass in STG registers: D1, ..., D6
76480093f4SDimitry Andric  CCIfType<[f64], CCAssignToReg<[F12D, F13D, F14D, F15D, F2D, F3D]>>,
77480093f4SDimitry Andric
78480093f4SDimitry Andric  // Pass in STG registers: XMM1, ..., XMM6
79480093f4SDimitry Andric  CCIfSubtarget<"hasVector()",
80480093f4SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
81480093f4SDimitry Andric             CCIfFixed<CCAssignToReg<[V16, V17, V18, V19, V20, V21]>>>>,
82480093f4SDimitry Andric
83480093f4SDimitry Andric  // Fail otherwise
84480093f4SDimitry Andric  CCCustom<"CC_SystemZ_GHC_Error">
85480093f4SDimitry Andric]>;
86480093f4SDimitry Andric
87480093f4SDimitry Andric//===----------------------------------------------------------------------===//
880b57cec5SDimitry Andric// z/Linux argument calling conventions
890b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
90fe6060f1SDimitry Andricdef CC_SystemZ_ELF : CallingConv<[
91480093f4SDimitry Andric  CCIfCC<"CallingConv::GHC", CCDelegateTo<CC_SystemZ_GHC>>,
92480093f4SDimitry Andric
930b57cec5SDimitry Andric  // Promote i32 to i64 if it has an explicit extension type.
940b57cec5SDimitry Andric  // The convention is that true integer arguments that are smaller
950b57cec5SDimitry Andric  // than 64 bits should be marked as extended, but structures that
960b57cec5SDimitry Andric  // are smaller than 64 bits shouldn't.
970b57cec5SDimitry Andric  CCIfType<[i32], CCIfExtend<CCPromoteToType<i64>>>,
980b57cec5SDimitry Andric
990b57cec5SDimitry Andric  // A SwiftSelf is passed in callee-saved R10.
1000b57cec5SDimitry Andric  CCIfSwiftSelf<CCIfType<[i64], CCAssignToReg<[R10D]>>>,
1010b57cec5SDimitry Andric
1020b57cec5SDimitry Andric  // A SwiftError is passed in callee-saved R9.
1030b57cec5SDimitry Andric  CCIfSwiftError<CCIfType<[i64], CCAssignToReg<[R9D]>>>,
1040b57cec5SDimitry Andric
105*5f757f3fSDimitry Andric  // Force i128 (if the type is legal) and long double values to the stack
106*5f757f3fSDimitry Andric  // and pass i64 pointers to them.
107*5f757f3fSDimitry Andric  CCIfType<[i128, f128], CCPassIndirect<i64>>,
108*5f757f3fSDimitry Andric  // If i128 is not legal, such values are already split into two i64 here,
1090b57cec5SDimitry Andric  // so we have to use a custom handler.
1100b57cec5SDimitry Andric  CCIfType<[i64], CCCustom<"CC_SystemZ_I128Indirect">>,
1110b57cec5SDimitry Andric
1120b57cec5SDimitry Andric  // The first 5 integer arguments are passed in R2-R6.  Note that R6
1130b57cec5SDimitry Andric  // is call-saved.
1140b57cec5SDimitry Andric  CCIfType<[i32], CCAssignToReg<[R2L, R3L, R4L, R5L, R6L]>>,
1150b57cec5SDimitry Andric  CCIfType<[i64], CCAssignToReg<[R2D, R3D, R4D, R5D, R6D]>>,
1160b57cec5SDimitry Andric
1170b57cec5SDimitry Andric  // The first 4 float and double arguments are passed in even registers F0-F6.
1180b57cec5SDimitry Andric  CCIfType<[f32], CCAssignToReg<[F0S, F2S, F4S, F6S]>>,
1190b57cec5SDimitry Andric  CCIfType<[f64], CCAssignToReg<[F0D, F2D, F4D, F6D]>>,
1200b57cec5SDimitry Andric
1210b57cec5SDimitry Andric  // The first 8 named vector arguments are passed in V24-V31.  Sub-128 vectors
1220b57cec5SDimitry Andric  // are passed in the same way, but they're widened to one of these types
1230b57cec5SDimitry Andric  // during type legalization.
1240b57cec5SDimitry Andric  CCIfSubtarget<"hasVector()",
1250b57cec5SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
1260b57cec5SDimitry Andric             CCIfFixed<CCAssignToReg<[V24, V26, V28, V30,
1270b57cec5SDimitry Andric                                      V25, V27, V29, V31]>>>>,
1280b57cec5SDimitry Andric
1290b57cec5SDimitry Andric  // However, sub-128 vectors which need to go on the stack occupy just a
1300b57cec5SDimitry Andric  // single 8-byte-aligned 8-byte stack slot.  Pass as i64.
1310b57cec5SDimitry Andric  CCIfSubtarget<"hasVector()",
1320b57cec5SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
1330b57cec5SDimitry Andric             CCIfShortVector<CCBitConvertToType<i64>>>>,
1340b57cec5SDimitry Andric
1350b57cec5SDimitry Andric  // Other vector arguments are passed in 8-byte-aligned 16-byte stack slots.
1360b57cec5SDimitry Andric  CCIfSubtarget<"hasVector()",
1370b57cec5SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
1380b57cec5SDimitry Andric             CCAssignToStack<16, 8>>>,
1390b57cec5SDimitry Andric
1400b57cec5SDimitry Andric  // Other arguments are passed in 8-byte-aligned 8-byte stack slots.
1410b57cec5SDimitry Andric  CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>
1420b57cec5SDimitry Andric]>;
1430b57cec5SDimitry Andric
1440b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
1450b57cec5SDimitry Andric// z/Linux callee-saved registers
1460b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
147fe6060f1SDimitry Andricdef CSR_SystemZ_ELF : CalleeSavedRegs<(add (sequence "R%dD", 6, 15),
1480b57cec5SDimitry Andric                                       (sequence "F%dD", 8, 15))>;
1490b57cec5SDimitry Andric
1500b57cec5SDimitry Andric// R9 is used to return SwiftError; remove it from CSR.
151fe6060f1SDimitry Andricdef CSR_SystemZ_SwiftError : CalleeSavedRegs<(sub CSR_SystemZ_ELF, R9D)>;
1520b57cec5SDimitry Andric
1530b57cec5SDimitry Andric// "All registers" as used by the AnyReg calling convention.
1540b57cec5SDimitry Andric// Note that registers 0 and 1 are still defined as intra-call scratch
1550b57cec5SDimitry Andric// registers that may be clobbered e.g. by PLT stubs.
1560b57cec5SDimitry Andricdef CSR_SystemZ_AllRegs : CalleeSavedRegs<(add (sequence "R%dD", 2, 15),
1570b57cec5SDimitry Andric                                               (sequence "F%dD", 0, 15))>;
1580b57cec5SDimitry Andricdef CSR_SystemZ_AllRegs_Vector : CalleeSavedRegs<(add (sequence "R%dD", 2, 15),
1590b57cec5SDimitry Andric                                                      (sequence "V%d", 0, 31))>;
1600b57cec5SDimitry Andric
161480093f4SDimitry Andricdef CSR_SystemZ_NoRegs : CalleeSavedRegs<(add)>;
162480093f4SDimitry Andric
163fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
164fe6060f1SDimitry Andric// z/OS XPLINK64 callee-saved registers
165fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
166753f127fSDimitry Andricdef CSR_SystemZ_XPLINK64 : CalleeSavedRegs<(add (sequence "R%dD", 8, 15),
167349cc55cSDimitry Andric                                                (sequence "F%dD", 15, 8))>;
168fe6060f1SDimitry Andric
169349cc55cSDimitry Andricdef CSR_SystemZ_XPLINK64_Vector : CalleeSavedRegs<(add CSR_SystemZ_XPLINK64,
170fe6060f1SDimitry Andric                                                   (sequence "V%d", 23, 16))>;
171fe6060f1SDimitry Andric
172fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
173fe6060f1SDimitry Andric// z/OS XPLINK64 return value calling convention
174fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
175fe6060f1SDimitry Andricdef RetCC_SystemZ_XPLINK64 : CallingConv<[
176fe6060f1SDimitry Andric  // XPLINK64 ABI compliant code widens integral types smaller than i64
177fe6060f1SDimitry Andric  // to i64.
178fe6060f1SDimitry Andric  CCIfType<[i32], CCPromoteToType<i64>>,
179fe6060f1SDimitry Andric
180fe6060f1SDimitry Andric  // Structs of size 1-24 bytes are returned in R1D, R2D, and R3D.
181fe6060f1SDimitry Andric  CCIfType<[i64], CCIfInReg<CCAssignToReg<[R1D, R2D, R3D]>>>,
182fe6060f1SDimitry Andric  // An i64 is returned in R3D. R2D and R1D provided for ABI non-compliant
183fe6060f1SDimitry Andric  // code.
184fe6060f1SDimitry Andric  CCIfType<[i64], CCAssignToReg<[R3D, R2D, R1D]>>,
185fe6060f1SDimitry Andric
186fe6060f1SDimitry Andric  // ABI compliant code returns floating point values in FPR0, FPR2, FPR4
187fe6060f1SDimitry Andric  // and FPR6, using as many registers as required.
188fe6060f1SDimitry Andric  // All floating point return-value registers are call-clobbered.
189fe6060f1SDimitry Andric  CCIfType<[f32], CCAssignToReg<[F0S, F2S, F4S, F6S]>>,
190fe6060f1SDimitry Andric  CCIfType<[f64], CCAssignToReg<[F0D, F2D, F4D, F6D]>>,
191fe6060f1SDimitry Andric
192fe6060f1SDimitry Andric  // ABI compliant code returns f128 in F0D and F2D, hence F0Q.
193fe6060f1SDimitry Andric  // F4D and F6D, hence F4Q are used for complex long double types.
194fe6060f1SDimitry Andric  CCIfType<[f128], CCAssignToReg<[F0Q,F4Q]>>,
195fe6060f1SDimitry Andric
196fe6060f1SDimitry Andric  // ABI compliant code returns vectors in VR24 but other registers
197fe6060f1SDimitry Andric  // are provided for code that does not care about the ABI.
198fe6060f1SDimitry Andric  CCIfSubtarget<"hasVector()",
199fe6060f1SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
200fe6060f1SDimitry Andric             CCAssignToReg<[V24, V25, V26, V27, V28, V29, V30, V31]>>>
201fe6060f1SDimitry Andric]>;
202fe6060f1SDimitry Andric
203fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
204fe6060f1SDimitry Andric// z/OS XPLINK64 argument calling conventions
205fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
206fe6060f1SDimitry Andric// XPLink uses a logical argument list consisting of contiguous register-size
207fe6060f1SDimitry Andric// words (8 bytes in 64-Bit mode) where some arguments are passed in registers
208fe6060f1SDimitry Andric// and some in storage.
209fe6060f1SDimitry Andric// Even though 3 GPRs, 4 FPRs, and 8 VRs may be used,
210fe6060f1SDimitry Andric// space must be reserved for all the args on stack.
211fe6060f1SDimitry Andric// The first three register-sized words of the parameter area are passed in
212fe6060f1SDimitry Andric// GPRs 1-3. FP values and vector-type arguments are instead passed in FPRs
213fe6060f1SDimitry Andric// and VRs respectively, but if a FP value or vector argument occupies one of
214fe6060f1SDimitry Andric// the first three register-sized words of the parameter area, the corresponding
215fe6060f1SDimitry Andric// GPR's value is not used to pass arguments.
216fe6060f1SDimitry Andric//
217fe6060f1SDimitry Andric// The XPLINK64 Calling Convention is fully specified in Chapter 22 of the z/OS
218fe6060f1SDimitry Andric// Language Environment Vendor Interfaces. Appendix B of the same document contains
219fe6060f1SDimitry Andric// examples.
220fe6060f1SDimitry Andric
221fe6060f1SDimitry Andricdef CC_SystemZ_XPLINK64 : CallingConv<[
222fe6060f1SDimitry Andric  // XPLINK64 ABI compliant code widens integral types smaller than i64
223fe6060f1SDimitry Andric  // to i64 before placing the parameters either on the stack or in registers.
224fe6060f1SDimitry Andric  CCIfType<[i32], CCIfExtend<CCPromoteToType<i64>>>,
225fcaf7f86SDimitry Andric  // Promote f32 to f64 and bitcast to i64, if it needs to be passed in GPRs.
226fcaf7f86SDimitry Andric  // Although we assign the f32 vararg to be bitcast, it will first be promoted
227fcaf7f86SDimitry Andric  // to an f64 within convertValVTToLocVT().
228fcaf7f86SDimitry Andric  CCIfType<[f32, f64], CCIfNotFixed<CCBitConvertToType<i64>>>,
229349cc55cSDimitry Andric  // long double, can only be passed in GPR2 and GPR3, if available,
230349cc55cSDimitry Andric  // hence R2Q
231349cc55cSDimitry Andric  CCIfType<[f128], CCIfNotFixed<CCCustom<"CC_XPLINK64_Allocate128BitVararg">>>,
232349cc55cSDimitry Andric  // Non fixed vector arguments are treated in the same way as long
233349cc55cSDimitry Andric  // doubles.
234349cc55cSDimitry Andric  CCIfSubtarget<"hasVector()",
235349cc55cSDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
236349cc55cSDimitry Andric      CCIfNotFixed<CCCustom<"CC_XPLINK64_Allocate128BitVararg">>>>,
237fe6060f1SDimitry Andric
238fe6060f1SDimitry Andric  // A SwiftSelf is passed in callee-saved R10.
239fe6060f1SDimitry Andric  CCIfSwiftSelf<CCIfType<[i64], CCAssignToReg<[R10D]>>>,
240fe6060f1SDimitry Andric
241fe6060f1SDimitry Andric  // A SwiftError is passed in R0.
242fe6060f1SDimitry Andric  CCIfSwiftError<CCIfType<[i64], CCAssignToReg<[R0D]>>>,
243fe6060f1SDimitry Andric
244*5f757f3fSDimitry Andric  // Force i128 values to the stack and pass i64 pointers to them.
245*5f757f3fSDimitry Andric  CCIfType<[i128], CCPassIndirect<i64>>,
246*5f757f3fSDimitry Andric  // If i128 is not legal, such values are already split into two i64 here,
247*5f757f3fSDimitry Andric  // so we have to use a custom handler.
248fe6060f1SDimitry Andric  CCIfType<[i64], CCCustom<"CC_SystemZ_I128Indirect">>,
249fe6060f1SDimitry Andric  // The first 3 integer arguments are passed in registers R1D-R3D.
250fe6060f1SDimitry Andric  // The rest will be passed in the user area. The address offset of the user
251fe6060f1SDimitry Andric  // area can be found in register R4D.
252fcaf7f86SDimitry Andric  CCIfType<[i64], CCAssignToRegAndStack<[R1D, R2D, R3D], 8, 8>>,
253fe6060f1SDimitry Andric
254fe6060f1SDimitry Andric  // The first 8 named vector arguments are passed in V24-V31. Sub-128 vectors
255fe6060f1SDimitry Andric  // are passed in the same way, but they're widened to one of these types
256fe6060f1SDimitry Andric  // during type legalization.
257fe6060f1SDimitry Andric  CCIfSubtarget<"hasVector()",
258fe6060f1SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
259fe6060f1SDimitry Andric      CCIfFixed<CCCustom<"CC_XPLINK64_Shadow_Reg">>>>,
260fe6060f1SDimitry Andric  CCIfSubtarget<"hasVector()",
261fe6060f1SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
262fcaf7f86SDimitry Andric              CCIfFixed<CCAssignToRegAndStack<[V24, V25, V26, V27,
263fcaf7f86SDimitry Andric                                               V28, V29, V30, V31], 16, 8>>>>,
264fe6060f1SDimitry Andric
265fcaf7f86SDimitry Andric  // The first 4 named float and double arguments are passed in registers
266fcaf7f86SDimitry Andric  // FPR0-FPR6. The rest will be passed in the user area.
267fe6060f1SDimitry Andric  CCIfType<[f32, f64], CCIfFixed<CCCustom<"CC_XPLINK64_Shadow_Reg">>>,
268fcaf7f86SDimitry Andric  CCIfType<[f32], CCIfFixed<CCAssignToRegAndStack<[F0S, F2S, F4S, F6S], 4, 8>>>,
269fcaf7f86SDimitry Andric  CCIfType<[f64], CCIfFixed<CCAssignToRegAndStack<[F0D, F2D, F4D, F6D], 8, 8>>>,
270fcaf7f86SDimitry Andric
271fe6060f1SDimitry Andric  // The first 2 long double arguments are passed in register FPR0/FPR2
272fe6060f1SDimitry Andric  // and FPR4/FPR6. The rest will be passed in the user area.
273fe6060f1SDimitry Andric  CCIfType<[f128], CCIfFixed<CCCustom<"CC_XPLINK64_Shadow_Reg">>>,
274fcaf7f86SDimitry Andric  CCIfType<[f128], CCIfFixed<CCAssignToRegAndStack<[F0Q, F4Q], 16, 8>>>,
275fe6060f1SDimitry Andric
276fe6060f1SDimitry Andric  // Other arguments are passed in 8-byte-aligned 8-byte stack slots.
277fe6060f1SDimitry Andric  CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,
278fe6060f1SDimitry Andric  // Other f128 arguments are passed in 8-byte-aligned 16-byte stack slots.
279fe6060f1SDimitry Andric  CCIfType<[f128], CCAssignToStack<16, 8>>,
280fe6060f1SDimitry Andric  // Vector arguments are passed in 8-byte-alinged 16-byte stack slots too.
281fe6060f1SDimitry Andric  CCIfSubtarget<"hasVector()",
282fe6060f1SDimitry Andric    CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
283fe6060f1SDimitry Andric             CCAssignToStack<16, 8>>>
284fe6060f1SDimitry Andric]>;
285fe6060f1SDimitry Andric
286fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
287fe6060f1SDimitry Andric// s390x return value calling convention
288fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
289fe6060f1SDimitry Andric
290fe6060f1SDimitry Andricdef RetCC_SystemZ : CallingConv<[
291fe6060f1SDimitry Andric  // zOS XPLINK64
292fe6060f1SDimitry Andric  CCIfSubtarget<"isTargetXPLINK64()", CCDelegateTo<RetCC_SystemZ_XPLINK64>>,
293fe6060f1SDimitry Andric
294fe6060f1SDimitry Andric  // ELF Linux SystemZ
295fe6060f1SDimitry Andric  CCIfSubtarget<"isTargetELF()", CCDelegateTo<RetCC_SystemZ_ELF>>
296fe6060f1SDimitry Andric]>;
297fe6060f1SDimitry Andric
298fe6060f1SDimitry Andric
299fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
300fe6060f1SDimitry Andric// s390x argument calling conventions
301fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
302fe6060f1SDimitry Andricdef CC_SystemZ : CallingConv<[
303fe6060f1SDimitry Andric  // zOS XPLINK64
304fe6060f1SDimitry Andric  CCIfSubtarget<"isTargetXPLINK64()", CCDelegateTo<CC_SystemZ_XPLINK64>>,
305fe6060f1SDimitry Andric
306fe6060f1SDimitry Andric  // ELF Linux SystemZ
307fe6060f1SDimitry Andric  CCIfSubtarget<"isTargetELF()", CCDelegateTo<CC_SystemZ_ELF>>
308fe6060f1SDimitry Andric]>;
309