1 //=- AArch64CallingConv.td - Calling Conventions for AArch64 -*- tablegen -*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This describes the calling conventions for AArch64 architecture.
11 //===----------------------------------------------------------------------===//
13 /// CCIfAlign - Match of the original alignment of the arg
14 class CCIfAlign<string Align, CCAction A> :
15 CCIf<!strconcat("ArgFlags.getOrigAlign() == ", Align), A>;
16 /// CCIfBigEndian - Match only if we're in big endian mode.
17 class CCIfBigEndian<CCAction A> :
18 CCIf<"State.getMachineFunction().getDataLayout().isBigEndian()", A>;
20 //===----------------------------------------------------------------------===//
21 // ARM AAPCS64 Calling Convention
22 //===----------------------------------------------------------------------===//
25 def CC_AArch64_AAPCS : CallingConv<[
26 CCIfType<[iPTR], CCBitConvertToType<i64>>,
27 CCIfType<[v2f32], CCBitConvertToType<v2i32>>,
28 CCIfType<[v2f64, v4f32], CCBitConvertToType<v2i64>>,
30 // Big endian vectors must be passed as if they were 1-element vectors so that
31 // their lanes are in a consistent order.
32 CCIfBigEndian<CCIfType<[v2i32, v2f32, v4i16, v4f16, v8i8],
33 CCBitConvertToType<f64>>>,
34 CCIfBigEndian<CCIfType<[v2i64, v2f64, v4i32, v4f32, v8i16, v8f16, v16i8],
35 CCBitConvertToType<f128>>>,
37 // In AAPCS, an SRet is passed in X8, not X0 like a normal pointer parameter.
38 // However, on windows, in some circumstances, the SRet is passed in X0 or X1
39 // instead. The presence of the inreg attribute indicates that SRet is
40 // passed in the alternative register (X0 or X1), not X8:
41 // - X0 for non-instance methods.
42 // - X1 for instance methods.
44 // The "sret" attribute identifies indirect returns.
45 // The "inreg" attribute identifies non-aggregate types.
46 // The position of the "sret" attribute identifies instance/non-instance
48 // "sret" on argument 0 means non-instance methods.
49 // "sret" on argument 1 means instance methods.
51 CCIfInReg<CCIfType<[i64],
52 CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1], [W0, W1]>>>>>,
54 CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[X8], [W8]>>>,
56 // Put ByVal arguments directly on the stack. Minimum size and alignment of a
58 CCIfByVal<CCPassByVal<8, 8>>,
60 // The 'nest' parameter, if any, is passed in X18.
61 // Darwin uses X18 as the platform register and hence 'nest' isn't currently
63 CCIfNest<CCAssignToReg<[X18]>>,
65 // Pass SwiftSelf in a callee saved register.
66 CCIfSwiftSelf<CCIfType<[i64], CCAssignToRegWithShadow<[X20], [W20]>>>,
68 // A SwiftError is passed in X21.
69 CCIfSwiftError<CCIfType<[i64], CCAssignToRegWithShadow<[X21], [W21]>>>,
71 CCIfConsecutiveRegs<CCCustom<"CC_AArch64_Custom_Block">>,
73 CCIfType<[nxv16i8, nxv8i16, nxv4i32, nxv2i64, nxv2f16, nxv4f16, nxv8f16,
74 nxv1f32, nxv2f32, nxv4f32, nxv1f64, nxv2f64],
75 CCAssignToReg<[Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7]>>,
76 CCIfType<[nxv16i8, nxv8i16, nxv4i32, nxv2i64, nxv2f16, nxv4f16, nxv8f16,
77 nxv1f32, nxv2f32, nxv4f32, nxv1f64, nxv2f64],
80 CCIfType<[nxv2i1, nxv4i1, nxv8i1, nxv16i1],
81 CCAssignToReg<[P0, P1, P2, P3]>>,
82 CCIfType<[nxv2i1, nxv4i1, nxv8i1, nxv16i1],
85 // Handle i1, i8, i16, i32, i64, f32, f64 and v2f64 by passing in registers,
86 // up to eight each of GPR and FPR.
87 CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
88 CCIfType<[i32], CCAssignToRegWithShadow<[W0, W1, W2, W3, W4, W5, W6, W7],
89 [X0, X1, X2, X3, X4, X5, X6, X7]>>,
90 // i128 is split to two i64s, we can't fit half to register X7.
91 CCIfType<[i64], CCIfSplit<CCAssignToRegWithShadow<[X0, X2, X4, X6],
94 // i128 is split to two i64s, and its stack alignment is 16 bytes.
95 CCIfType<[i64], CCIfSplit<CCAssignToStackWithShadow<8, 16, [X7]>>>,
97 CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6, X7],
98 [W0, W1, W2, W3, W4, W5, W6, W7]>>,
99 CCIfType<[f16], CCAssignToRegWithShadow<[H0, H1, H2, H3, H4, H5, H6, H7],
100 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
101 CCIfType<[f32], CCAssignToRegWithShadow<[S0, S1, S2, S3, S4, S5, S6, S7],
102 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
103 CCIfType<[f64], CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
104 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
105 CCIfType<[v1i64, v2i32, v4i16, v8i8, v1f64, v2f32, v4f16],
106 CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
107 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
108 CCIfType<[f128, v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
109 CCAssignToReg<[Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
111 // If more than will fit in registers, pass them on the stack instead.
112 CCIfType<[i1, i8, i16, f16], CCAssignToStack<8, 8>>,
113 CCIfType<[i32, f32], CCAssignToStack<8, 8>>,
114 CCIfType<[i64, f64, v1f64, v2f32, v1i64, v2i32, v4i16, v8i8, v4f16],
115 CCAssignToStack<8, 8>>,
116 CCIfType<[f128, v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
117 CCAssignToStack<16, 16>>
121 def RetCC_AArch64_AAPCS : CallingConv<[
122 CCIfType<[iPTR], CCBitConvertToType<i64>>,
123 CCIfType<[v2f32], CCBitConvertToType<v2i32>>,
124 CCIfType<[v2f64, v4f32], CCBitConvertToType<v2i64>>,
126 CCIfSwiftError<CCIfType<[i64], CCAssignToRegWithShadow<[X21], [W21]>>>,
128 // Big endian vectors must be passed as if they were 1-element vectors so that
129 // their lanes are in a consistent order.
130 CCIfBigEndian<CCIfType<[v2i32, v2f32, v4i16, v4f16, v8i8],
131 CCBitConvertToType<f64>>>,
132 CCIfBigEndian<CCIfType<[v2i64, v2f64, v4i32, v4f32, v8i16, v8f16, v16i8],
133 CCBitConvertToType<f128>>>,
135 CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
136 CCIfType<[i32], CCAssignToRegWithShadow<[W0, W1, W2, W3, W4, W5, W6, W7],
137 [X0, X1, X2, X3, X4, X5, X6, X7]>>,
138 CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6, X7],
139 [W0, W1, W2, W3, W4, W5, W6, W7]>>,
140 CCIfType<[f16], CCAssignToRegWithShadow<[H0, H1, H2, H3, H4, H5, H6, H7],
141 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
142 CCIfType<[f32], CCAssignToRegWithShadow<[S0, S1, S2, S3, S4, S5, S6, S7],
143 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
144 CCIfType<[f64], CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
145 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
146 CCIfType<[v1i64, v2i32, v4i16, v8i8, v1f64, v2f32, v4f16],
147 CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
148 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
149 CCIfType<[f128, v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
150 CCAssignToReg<[Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
152 CCIfType<[nxv16i8, nxv8i16, nxv4i32, nxv2i64, nxv2f16, nxv4f16, nxv8f16,
153 nxv1f32, nxv2f32, nxv4f32, nxv1f64, nxv2f64],
154 CCAssignToReg<[Z0, Z1, Z2, Z3, Z4, Z5, Z6, Z7]>>,
156 CCIfType<[nxv2i1, nxv4i1, nxv8i1, nxv16i1],
157 CCAssignToReg<[P0, P1, P2, P3]>>
160 // Vararg functions on windows pass floats in integer registers
162 def CC_AArch64_Win64_VarArg : CallingConv<[
163 CCIfType<[f16, f32], CCPromoteToType<f64>>,
164 CCIfType<[f64], CCBitConvertToType<i64>>,
165 CCDelegateTo<CC_AArch64_AAPCS>
169 // Darwin uses a calling convention which differs in only two ways
170 // from the standard one at this level:
171 // + i128s (i.e. split i64s) don't need even registers.
172 // + Stack slots are sized as needed rather than being at least 64-bit.
174 def CC_AArch64_DarwinPCS : CallingConv<[
175 CCIfType<[iPTR], CCBitConvertToType<i64>>,
176 CCIfType<[v2f32], CCBitConvertToType<v2i32>>,
177 CCIfType<[v2f64, v4f32, f128], CCBitConvertToType<v2i64>>,
179 // An SRet is passed in X8, not X0 like a normal pointer parameter.
180 CCIfSRet<CCIfType<[i64], CCAssignToRegWithShadow<[X8], [W8]>>>,
182 // Put ByVal arguments directly on the stack. Minimum size and alignment of a
184 CCIfByVal<CCPassByVal<8, 8>>,
186 // Pass SwiftSelf in a callee saved register.
187 CCIfSwiftSelf<CCIfType<[i64], CCAssignToRegWithShadow<[X20], [W20]>>>,
189 // A SwiftError is passed in X21.
190 CCIfSwiftError<CCIfType<[i64], CCAssignToRegWithShadow<[X21], [W21]>>>,
192 CCIfConsecutiveRegs<CCCustom<"CC_AArch64_Custom_Block">>,
194 // Handle i1, i8, i16, i32, i64, f32, f64 and v2f64 by passing in registers,
195 // up to eight each of GPR and FPR.
196 CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
197 CCIfType<[i32], CCAssignToRegWithShadow<[W0, W1, W2, W3, W4, W5, W6, W7],
198 [X0, X1, X2, X3, X4, X5, X6, X7]>>,
199 // i128 is split to two i64s, we can't fit half to register X7.
201 CCIfSplit<CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6],
202 [W0, W1, W2, W3, W4, W5, W6]>>>,
203 // i128 is split to two i64s, and its stack alignment is 16 bytes.
204 CCIfType<[i64], CCIfSplit<CCAssignToStackWithShadow<8, 16, [X7]>>>,
206 CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6, X7],
207 [W0, W1, W2, W3, W4, W5, W6, W7]>>,
208 CCIfType<[f16], CCAssignToRegWithShadow<[H0, H1, H2, H3, H4, H5, H6, H7],
209 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
210 CCIfType<[f32], CCAssignToRegWithShadow<[S0, S1, S2, S3, S4, S5, S6, S7],
211 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
212 CCIfType<[f64], CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
213 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
214 CCIfType<[v1i64, v2i32, v4i16, v8i8, v1f64, v2f32, v4f16],
215 CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
216 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
217 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
218 CCAssignToReg<[Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
220 // If more than will fit in registers, pass them on the stack instead.
221 CCIf<"ValVT == MVT::i1 || ValVT == MVT::i8", CCAssignToStack<1, 1>>,
222 CCIf<"ValVT == MVT::i16 || ValVT == MVT::f16", CCAssignToStack<2, 2>>,
223 CCIfType<[i32, f32], CCAssignToStack<4, 4>>,
224 CCIfType<[i64, f64, v1f64, v2f32, v1i64, v2i32, v4i16, v8i8, v4f16],
225 CCAssignToStack<8, 8>>,
226 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
227 CCAssignToStack<16, 16>>
231 def CC_AArch64_DarwinPCS_VarArg : CallingConv<[
232 CCIfType<[iPTR], CCBitConvertToType<i64>>,
233 CCIfType<[v2f32], CCBitConvertToType<v2i32>>,
234 CCIfType<[v2f64, v4f32, f128], CCBitConvertToType<v2i64>>,
236 CCIfConsecutiveRegs<CCCustom<"CC_AArch64_Custom_Stack_Block">>,
238 // Handle all scalar types as either i64 or f64.
239 CCIfType<[i8, i16, i32], CCPromoteToType<i64>>,
240 CCIfType<[f16, f32], CCPromoteToType<f64>>,
242 // Everything is on the stack.
243 // i128 is split to two i64s, and its stack alignment is 16 bytes.
244 CCIfType<[i64], CCIfSplit<CCAssignToStack<8, 16>>>,
245 CCIfType<[i64, f64, v1i64, v2i32, v4i16, v8i8, v1f64, v2f32, v4f16],
246 CCAssignToStack<8, 8>>,
247 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32, v2f64, v8f16],
248 CCAssignToStack<16, 16>>
251 // The WebKit_JS calling convention only passes the first argument (the callee)
252 // in register and the remaining arguments on stack. We allow 32bit stack slots,
253 // so that WebKit can write partial values in the stack and define the other
254 // 32bit quantity as undef.
256 def CC_AArch64_WebKit_JS : CallingConv<[
257 // Handle i1, i8, i16, i32, and i64 passing in register X0 (W0).
258 CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
259 CCIfType<[i32], CCAssignToRegWithShadow<[W0], [X0]>>,
260 CCIfType<[i64], CCAssignToRegWithShadow<[X0], [W0]>>,
262 // Pass the remaining arguments on the stack instead.
263 CCIfType<[i32, f32], CCAssignToStack<4, 4>>,
264 CCIfType<[i64, f64], CCAssignToStack<8, 8>>
268 def RetCC_AArch64_WebKit_JS : CallingConv<[
269 CCIfType<[i32], CCAssignToRegWithShadow<[W0, W1, W2, W3, W4, W5, W6, W7],
270 [X0, X1, X2, X3, X4, X5, X6, X7]>>,
271 CCIfType<[i64], CCAssignToRegWithShadow<[X0, X1, X2, X3, X4, X5, X6, X7],
272 [W0, W1, W2, W3, W4, W5, W6, W7]>>,
273 CCIfType<[f32], CCAssignToRegWithShadow<[S0, S1, S2, S3, S4, S5, S6, S7],
274 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>,
275 CCIfType<[f64], CCAssignToRegWithShadow<[D0, D1, D2, D3, D4, D5, D6, D7],
276 [Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7]>>
279 //===----------------------------------------------------------------------===//
280 // ARM64 Calling Convention for GHC
281 //===----------------------------------------------------------------------===//
283 // This calling convention is specific to the Glasgow Haskell Compiler.
284 // The only documentation is the GHC source code, specifically the C header
287 // https://github.com/ghc/ghc/blob/master/includes/stg/MachRegs.h
289 // which defines the registers for the Spineless Tagless G-Machine (STG) that
290 // GHC uses to implement lazy evaluation. The generic STG machine has a set of
291 // registers which are mapped to appropriate set of architecture specific
292 // registers for each CPU architecture.
294 // The STG Machine is documented here:
296 // https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GeneratedCode
298 // The AArch64 register mapping is under the heading "The ARMv8/AArch64 ABI
299 // register mapping".
302 def CC_AArch64_GHC : CallingConv<[
303 CCIfType<[iPTR], CCBitConvertToType<i64>>,
305 // Handle all vector types as either f64 or v2f64.
306 CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType<f64>>,
307 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32, f128], CCBitConvertToType<v2f64>>,
309 CCIfType<[v2f64], CCAssignToReg<[Q4, Q5]>>,
310 CCIfType<[f32], CCAssignToReg<[S8, S9, S10, S11]>>,
311 CCIfType<[f64], CCAssignToReg<[D12, D13, D14, D15]>>,
313 // Promote i8/i16/i32 arguments to i64.
314 CCIfType<[i8, i16, i32], CCPromoteToType<i64>>,
316 // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, R5, R6, SpLim
317 CCIfType<[i64], CCAssignToReg<[X19, X20, X21, X22, X23, X24, X25, X26, X27, X28]>>
320 // The order of the callee-saves in this file is important, because the
321 // FrameLowering code will use this order to determine the layout the
322 // callee-save area in the stack frame. As can be observed below, Darwin
323 // requires the frame-record (LR, FP) to be at the top the callee-save area,
324 // whereas for other platforms they are at the bottom.
326 // FIXME: LR is only callee-saved in the sense that *we* preserve it and are
327 // presumably a callee to someone. External functions may not do so, but this
328 // is currently safe since BL has LR as an implicit-def and what happens after a
329 // tail call doesn't matter.
331 // It would be better to model its preservation semantics properly (create a
332 // vreg on entry, use it in RET & tail call generation; make that vreg def if we
333 // end up saving LR as part of a call frame). Watch this space...
334 def CSR_AArch64_AAPCS : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24,
335 X25, X26, X27, X28, LR, FP,
337 D12, D13, D14, D15)>;
339 // Darwin puts the frame-record at the top of the callee-save area.
340 def CSR_Darwin_AArch64_AAPCS : CalleeSavedRegs<(add LR, FP, X19, X20, X21, X22,
341 X23, X24, X25, X26, X27, X28,
343 D12, D13, D14, D15)>;
345 // Win64 has unwinding codes for an (FP,LR) pair, save_fplr and save_fplr_x.
346 // We put FP before LR, so that frame lowering logic generates (FP,LR) pairs,
347 // and not (LR,FP) pairs.
348 def CSR_Win_AArch64_AAPCS : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24,
349 X25, X26, X27, X28, FP, LR,
351 D12, D13, D14, D15)>;
353 // AArch64 PCS for vector functions (VPCS)
354 // must (additionally) preserve full Q8-Q23 registers
355 def CSR_AArch64_AAVPCS : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24,
356 X25, X26, X27, X28, LR, FP,
357 (sequence "Q%u", 8, 23))>;
359 // Functions taking SVE arguments or returning an SVE type
360 // must (additionally) preserve full Z8-Z23 and predicate registers P4-P15
361 def CSR_AArch64_SVE_AAPCS : CalleeSavedRegs<(add X19, X20, X21, X22, X23, X24,
362 X25, X26, X27, X28, LR, FP,
363 (sequence "Z%u", 8, 23),
364 (sequence "P%u", 4, 15))>;
366 // Constructors and destructors return 'this' in the iOS 64-bit C++ ABI; since
367 // 'this' and the pointer return value are both passed in X0 in these cases,
368 // this can be partially modelled by treating X0 as a callee-saved register;
369 // only the resulting RegMask is used; the SaveList is ignored
371 // (For generic ARM 64-bit ABI code, clang will not generate constructors or
372 // destructors with 'this' returns, so this RegMask will not be used in that
374 def CSR_AArch64_AAPCS_ThisReturn : CalleeSavedRegs<(add CSR_AArch64_AAPCS, X0)>;
376 def CSR_AArch64_AAPCS_SwiftError
377 : CalleeSavedRegs<(sub CSR_Darwin_AArch64_AAPCS, X21)>;
379 // The function used by Darwin to obtain the address of a thread-local variable
380 // guarantees more than a normal AAPCS function. x16 and x17 are used on the
381 // fast path for calculation, but other registers except X0 (argument/return)
382 // and LR (it is a call, after all) are preserved.
383 def CSR_AArch64_TLS_Darwin
384 : CalleeSavedRegs<(add (sub (sequence "X%u", 1, 28), X16, X17),
386 (sequence "Q%u", 0, 31))>;
388 // We can only handle a register pair with adjacent registers, the register pair
389 // should belong to the same class as well. Since the access function on the
390 // fast path calls a function that follows CSR_AArch64_TLS_Darwin,
391 // CSR_AArch64_CXX_TLS_Darwin should be a subset of CSR_AArch64_TLS_Darwin.
392 def CSR_AArch64_CXX_TLS_Darwin
393 : CalleeSavedRegs<(add CSR_Darwin_AArch64_AAPCS,
394 (sub (sequence "X%u", 1, 28), X15, X16, X17, X18),
395 (sequence "D%u", 0, 31))>;
397 // CSRs that are handled by prologue, epilogue.
398 def CSR_AArch64_CXX_TLS_Darwin_PE
399 : CalleeSavedRegs<(add LR, FP)>;
401 // CSRs that are handled explicitly via copies.
402 def CSR_AArch64_CXX_TLS_Darwin_ViaCopy
403 : CalleeSavedRegs<(sub CSR_AArch64_CXX_TLS_Darwin, LR, FP)>;
405 // The ELF stub used for TLS-descriptor access saves every feasible
406 // register. Only X0 and LR are clobbered.
407 def CSR_AArch64_TLS_ELF
408 : CalleeSavedRegs<(add (sequence "X%u", 1, 28), FP,
409 (sequence "Q%u", 0, 31))>;
411 def CSR_AArch64_AllRegs
412 : CalleeSavedRegs<(add (sequence "W%u", 0, 30), WSP,
413 (sequence "X%u", 0, 28), FP, LR, SP,
414 (sequence "B%u", 0, 31), (sequence "H%u", 0, 31),
415 (sequence "S%u", 0, 31), (sequence "D%u", 0, 31),
416 (sequence "Q%u", 0, 31))>;
418 def CSR_AArch64_NoRegs : CalleeSavedRegs<(add)>;
420 def CSR_AArch64_RT_MostRegs : CalleeSavedRegs<(add CSR_AArch64_AAPCS,
421 (sequence "X%u", 9, 15))>;
423 def CSR_AArch64_StackProbe_Windows
424 : CalleeSavedRegs<(add (sequence "X%u", 0, 15),
425 (sequence "X%u", 18, 28), FP, SP,
426 (sequence "Q%u", 0, 31))>;
428 // Variants of the standard calling conventions for shadow call stack.
429 // These all preserve x18 in addition to any other registers.
430 def CSR_AArch64_NoRegs_SCS
431 : CalleeSavedRegs<(add CSR_AArch64_NoRegs, X18)>;
432 def CSR_AArch64_AllRegs_SCS
433 : CalleeSavedRegs<(add CSR_AArch64_AllRegs, X18)>;
434 def CSR_AArch64_CXX_TLS_Darwin_SCS
435 : CalleeSavedRegs<(add CSR_AArch64_CXX_TLS_Darwin, X18)>;
436 def CSR_AArch64_AAPCS_SwiftError_SCS
437 : CalleeSavedRegs<(add CSR_AArch64_AAPCS_SwiftError, X18)>;
438 def CSR_AArch64_RT_MostRegs_SCS
439 : CalleeSavedRegs<(add CSR_AArch64_RT_MostRegs, X18)>;
440 def CSR_AArch64_AAVPCS_SCS
441 : CalleeSavedRegs<(add CSR_AArch64_AAVPCS, X18)>;
442 def CSR_AArch64_AAPCS_SCS
443 : CalleeSavedRegs<(add CSR_AArch64_AAPCS, X18)>;