xref: /netbsd-src/external/apache2/llvm/dist/llvm/lib/Target/PowerPC/PPCCallingConv.td (revision 82d56013d7b633d116a93943de88e08335357a7c)
17330f729Sjoerg//===- PPCCallingConv.td - Calling Conventions for PowerPC -*- tablegen -*-===//
27330f729Sjoerg//
37330f729Sjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
47330f729Sjoerg// See https://llvm.org/LICENSE.txt for license information.
57330f729Sjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67330f729Sjoerg//
77330f729Sjoerg//===----------------------------------------------------------------------===//
87330f729Sjoerg//
97330f729Sjoerg// This describes the calling conventions for the PowerPC 32- and 64-bit
107330f729Sjoerg// architectures.
117330f729Sjoerg//
127330f729Sjoerg//===----------------------------------------------------------------------===//
137330f729Sjoerg
147330f729Sjoerg/// CCIfSubtarget - Match if the current subtarget has a feature F.
157330f729Sjoergclass CCIfSubtarget<string F, CCAction A>
167330f729Sjoerg    : CCIf<!strconcat("static_cast<const PPCSubtarget&>"
177330f729Sjoerg                       "(State.getMachineFunction().getSubtarget()).",
187330f729Sjoerg                     F),
197330f729Sjoerg          A>;
207330f729Sjoergclass CCIfNotSubtarget<string F, CCAction A>
217330f729Sjoerg    : CCIf<!strconcat("!static_cast<const PPCSubtarget&>"
227330f729Sjoerg                       "(State.getMachineFunction().getSubtarget()).",
237330f729Sjoerg                     F),
247330f729Sjoerg          A>;
257330f729Sjoergclass CCIfOrigArgWasNotPPCF128<CCAction A>
267330f729Sjoerg    : CCIf<"!static_cast<PPCCCState *>(&State)->WasOriginalArgPPCF128(ValNo)",
277330f729Sjoerg           A>;
287330f729Sjoergclass CCIfOrigArgWasPPCF128<CCAction A>
297330f729Sjoerg    : CCIf<"static_cast<PPCCCState *>(&State)->WasOriginalArgPPCF128(ValNo)",
307330f729Sjoerg           A>;
317330f729Sjoerg
327330f729Sjoerg//===----------------------------------------------------------------------===//
337330f729Sjoerg// Return Value Calling Convention
347330f729Sjoerg//===----------------------------------------------------------------------===//
357330f729Sjoerg
367330f729Sjoerg// PPC64 AnyReg return-value convention. No explicit register is specified for
377330f729Sjoerg// the return-value. The register allocator is allowed and expected to choose
387330f729Sjoerg// any free register.
397330f729Sjoerg//
407330f729Sjoerg// This calling convention is currently only supported by the stackmap and
417330f729Sjoerg// patchpoint intrinsics. All other uses will result in an assert on Debug
427330f729Sjoerg// builds. On Release builds we fallback to the PPC C calling convention.
437330f729Sjoergdef RetCC_PPC64_AnyReg : CallingConv<[
447330f729Sjoerg  CCCustom<"CC_PPC_AnyReg_Error">
457330f729Sjoerg]>;
467330f729Sjoerg
477330f729Sjoerg// Return-value convention for PowerPC coldcc.
487330f729Sjoerglet Entry = 1 in
497330f729Sjoergdef RetCC_PPC_Cold : CallingConv<[
507330f729Sjoerg  // Use the same return registers as RetCC_PPC, but limited to only
517330f729Sjoerg  // one return value. The remaining return values will be saved to
527330f729Sjoerg  // the stack.
537330f729Sjoerg  CCIfType<[i32, i1], CCIfSubtarget<"isPPC64()", CCPromoteToType<i64>>>,
547330f729Sjoerg  CCIfType<[i1], CCIfNotSubtarget<"isPPC64()", CCPromoteToType<i32>>>,
557330f729Sjoerg
567330f729Sjoerg  CCIfType<[i32], CCAssignToReg<[R3]>>,
577330f729Sjoerg  CCIfType<[i64], CCAssignToReg<[X3]>>,
587330f729Sjoerg  CCIfType<[i128], CCAssignToReg<[X3]>>,
597330f729Sjoerg
607330f729Sjoerg  CCIfType<[f32], CCAssignToReg<[F1]>>,
617330f729Sjoerg  CCIfType<[f64], CCAssignToReg<[F1]>>,
62*82d56013Sjoerg  CCIfType<[f128], CCIfSubtarget<"hasAltivec()", CCAssignToReg<[V2]>>>,
637330f729Sjoerg
647330f729Sjoerg  CCIfType<[v16i8, v8i16, v4i32, v2i64, v1i128, v4f32, v2f64],
657330f729Sjoerg           CCIfSubtarget<"hasAltivec()",
667330f729Sjoerg           CCAssignToReg<[V2]>>>
677330f729Sjoerg]>;
687330f729Sjoerg
697330f729Sjoerg// Return-value convention for PowerPC
707330f729Sjoerglet Entry = 1 in
717330f729Sjoergdef RetCC_PPC : CallingConv<[
727330f729Sjoerg  CCIfCC<"CallingConv::AnyReg", CCDelegateTo<RetCC_PPC64_AnyReg>>,
737330f729Sjoerg
747330f729Sjoerg  // On PPC64, integer return values are always promoted to i64
757330f729Sjoerg  CCIfType<[i32, i1], CCIfSubtarget<"isPPC64()", CCPromoteToType<i64>>>,
767330f729Sjoerg  CCIfType<[i1], CCIfNotSubtarget<"isPPC64()", CCPromoteToType<i32>>>,
777330f729Sjoerg
787330f729Sjoerg  CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>,
797330f729Sjoerg  CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6]>>,
807330f729Sjoerg  CCIfType<[i128], CCAssignToReg<[X3, X4, X5, X6]>>,
817330f729Sjoerg
827330f729Sjoerg  // Floating point types returned as "direct" go into F1 .. F8; note that
837330f729Sjoerg  // only the ELFv2 ABI fully utilizes all these registers.
847330f729Sjoerg  CCIfNotSubtarget<"hasSPE()",
857330f729Sjoerg       CCIfType<[f32], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>>,
867330f729Sjoerg  CCIfNotSubtarget<"hasSPE()",
877330f729Sjoerg       CCIfType<[f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>>,
887330f729Sjoerg  CCIfSubtarget<"hasSPE()",
897330f729Sjoerg       CCIfType<[f32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>>,
907330f729Sjoerg  CCIfSubtarget<"hasSPE()",
917330f729Sjoerg       CCIfType<[f64], CCCustom<"CC_PPC32_SPE_RetF64">>>,
927330f729Sjoerg
937330f729Sjoerg  // For P9, f128 are passed in vector registers.
947330f729Sjoerg  CCIfType<[f128],
95*82d56013Sjoerg           CCIfSubtarget<"hasAltivec()",
967330f729Sjoerg           CCAssignToReg<[V2, V3, V4, V5, V6, V7, V8, V9]>>>,
977330f729Sjoerg
987330f729Sjoerg  // Vector types returned as "direct" go into V2 .. V9; note that only the
997330f729Sjoerg  // ELFv2 ABI fully utilizes all these registers.
1007330f729Sjoerg  CCIfType<[v16i8, v8i16, v4i32, v2i64, v1i128, v4f32, v2f64],
1017330f729Sjoerg           CCIfSubtarget<"hasAltivec()",
1027330f729Sjoerg           CCAssignToReg<[V2, V3, V4, V5, V6, V7, V8, V9]>>>
1037330f729Sjoerg]>;
1047330f729Sjoerg
1057330f729Sjoerg// No explicit register is specified for the AnyReg calling convention. The
1067330f729Sjoerg// register allocator may assign the arguments to any free register.
1077330f729Sjoerg//
1087330f729Sjoerg// This calling convention is currently only supported by the stackmap and
1097330f729Sjoerg// patchpoint intrinsics. All other uses will result in an assert on Debug
1107330f729Sjoerg// builds. On Release builds we fallback to the PPC C calling convention.
1117330f729Sjoergdef CC_PPC64_AnyReg : CallingConv<[
1127330f729Sjoerg  CCCustom<"CC_PPC_AnyReg_Error">
1137330f729Sjoerg]>;
1147330f729Sjoerg
1157330f729Sjoerg// Note that we don't currently have calling conventions for 64-bit
1167330f729Sjoerg// PowerPC, but handle all the complexities of the ABI in the lowering
1177330f729Sjoerg// logic.  FIXME: See if the logic can be simplified with use of CCs.
1187330f729Sjoerg// This may require some extensions to current table generation.
1197330f729Sjoerg
1207330f729Sjoerg// Simple calling convention for 64-bit ELF PowerPC fast isel.
1217330f729Sjoerg// Only handle ints and floats.  All ints are promoted to i64.
1227330f729Sjoerg// Vector types and quadword ints are not handled.
1237330f729Sjoerglet Entry = 1 in
1247330f729Sjoergdef CC_PPC64_ELF_FIS : CallingConv<[
1257330f729Sjoerg  CCIfCC<"CallingConv::AnyReg", CCDelegateTo<CC_PPC64_AnyReg>>,
1267330f729Sjoerg
1277330f729Sjoerg  CCIfType<[i1],  CCPromoteToType<i64>>,
1287330f729Sjoerg  CCIfType<[i8],  CCPromoteToType<i64>>,
1297330f729Sjoerg  CCIfType<[i16], CCPromoteToType<i64>>,
1307330f729Sjoerg  CCIfType<[i32], CCPromoteToType<i64>>,
1317330f729Sjoerg  CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6, X7, X8, X9, X10]>>,
1327330f729Sjoerg  CCIfType<[f32, f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>
1337330f729Sjoerg]>;
1347330f729Sjoerg
1357330f729Sjoerg// Simple return-value convention for 64-bit ELF PowerPC fast isel.
1367330f729Sjoerg// All small ints are promoted to i64.  Vector types, quadword ints,
1377330f729Sjoerg// and multiple register returns are "supported" to avoid compile
1387330f729Sjoerg// errors, but none are handled by the fast selector.
1397330f729Sjoerglet Entry = 1 in
1407330f729Sjoergdef RetCC_PPC64_ELF_FIS : CallingConv<[
1417330f729Sjoerg  CCIfCC<"CallingConv::AnyReg", CCDelegateTo<RetCC_PPC64_AnyReg>>,
1427330f729Sjoerg
1437330f729Sjoerg  CCIfType<[i1],   CCPromoteToType<i64>>,
1447330f729Sjoerg  CCIfType<[i8],   CCPromoteToType<i64>>,
1457330f729Sjoerg  CCIfType<[i16],  CCPromoteToType<i64>>,
1467330f729Sjoerg  CCIfType<[i32],  CCPromoteToType<i64>>,
1477330f729Sjoerg  CCIfType<[i64],  CCAssignToReg<[X3, X4, X5, X6]>>,
1487330f729Sjoerg  CCIfType<[i128], CCAssignToReg<[X3, X4, X5, X6]>>,
1497330f729Sjoerg  CCIfType<[f32],  CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>,
1507330f729Sjoerg  CCIfType<[f64],  CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>,
1517330f729Sjoerg  CCIfType<[f128],
152*82d56013Sjoerg           CCIfSubtarget<"hasAltivec()",
1537330f729Sjoerg           CCAssignToReg<[V2, V3, V4, V5, V6, V7, V8, V9]>>>,
1547330f729Sjoerg  CCIfType<[v16i8, v8i16, v4i32, v2i64, v1i128, v4f32, v2f64],
1557330f729Sjoerg           CCIfSubtarget<"hasAltivec()",
1567330f729Sjoerg           CCAssignToReg<[V2, V3, V4, V5, V6, V7, V8, V9]>>>
1577330f729Sjoerg]>;
1587330f729Sjoerg
1597330f729Sjoerg//===----------------------------------------------------------------------===//
1607330f729Sjoerg// PowerPC System V Release 4 32-bit ABI
1617330f729Sjoerg//===----------------------------------------------------------------------===//
1627330f729Sjoerg
1637330f729Sjoergdef CC_PPC32_SVR4_Common : CallingConv<[
1647330f729Sjoerg  CCIfType<[i1], CCPromoteToType<i32>>,
1657330f729Sjoerg
1667330f729Sjoerg  // The ABI requires i64 to be passed in two adjacent registers with the first
1677330f729Sjoerg  // register having an odd register number.
1687330f729Sjoerg  CCIfType<[i32],
1697330f729Sjoerg  CCIfSplit<CCIfSubtarget<"useSoftFloat()",
1707330f729Sjoerg            CCIfOrigArgWasNotPPCF128<
1717330f729Sjoerg            CCCustom<"CC_PPC32_SVR4_Custom_AlignArgRegs">>>>>,
1727330f729Sjoerg
1737330f729Sjoerg  CCIfType<[i32],
1747330f729Sjoerg  CCIfSplit<CCIfNotSubtarget<"useSoftFloat()",
1757330f729Sjoerg                            CCCustom<"CC_PPC32_SVR4_Custom_AlignArgRegs">>>>,
1767330f729Sjoerg  CCIfType<[f64],
1777330f729Sjoerg  CCIfSubtarget<"hasSPE()",
1787330f729Sjoerg                CCCustom<"CC_PPC32_SVR4_Custom_AlignArgRegs">>>,
1797330f729Sjoerg  CCIfSplit<CCIfSubtarget<"useSoftFloat()",
1807330f729Sjoerg                          CCIfOrigArgWasPPCF128<CCCustom<
1817330f729Sjoerg                          "CC_PPC32_SVR4_Custom_SkipLastArgRegsPPCF128">>>>,
1827330f729Sjoerg
1837330f729Sjoerg  // The 'nest' parameter, if any, is passed in R11.
1847330f729Sjoerg  CCIfNest<CCAssignToReg<[R11]>>,
1857330f729Sjoerg
1867330f729Sjoerg  // The first 8 integer arguments are passed in integer registers.
1877330f729Sjoerg  CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>,
1887330f729Sjoerg
1897330f729Sjoerg  // Make sure the i64 words from a long double are either both passed in
1907330f729Sjoerg  // registers or both passed on the stack.
1917330f729Sjoerg  CCIfType<[f64], CCIfSplit<CCCustom<"CC_PPC32_SVR4_Custom_AlignFPArgRegs">>>,
1927330f729Sjoerg
1937330f729Sjoerg  // FP values are passed in F1 - F8.
1947330f729Sjoerg  CCIfType<[f32, f64],
1957330f729Sjoerg           CCIfNotSubtarget<"hasSPE()",
1967330f729Sjoerg                            CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>>,
1977330f729Sjoerg  CCIfType<[f64],
1987330f729Sjoerg           CCIfSubtarget<"hasSPE()",
1997330f729Sjoerg                         CCCustom<"CC_PPC32_SPE_CustomSplitFP64">>>,
2007330f729Sjoerg  CCIfType<[f32],
2017330f729Sjoerg           CCIfSubtarget<"hasSPE()",
2027330f729Sjoerg                         CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>>,
2037330f729Sjoerg
2047330f729Sjoerg  // Split arguments have an alignment of 8 bytes on the stack.
2057330f729Sjoerg  CCIfType<[i32], CCIfSplit<CCAssignToStack<4, 8>>>,
2067330f729Sjoerg
2077330f729Sjoerg  CCIfType<[i32], CCAssignToStack<4, 4>>,
2087330f729Sjoerg
2097330f729Sjoerg  // Floats are stored in double precision format, thus they have the same
2107330f729Sjoerg  // alignment and size as doubles.
2117330f729Sjoerg  // With SPE floats are stored as single precision, so have alignment and
2127330f729Sjoerg  // size of int.
2137330f729Sjoerg  CCIfType<[f32,f64], CCIfNotSubtarget<"hasSPE()", CCAssignToStack<8, 8>>>,
2147330f729Sjoerg  CCIfType<[f32], CCIfSubtarget<"hasSPE()", CCAssignToStack<4, 4>>>,
2157330f729Sjoerg  CCIfType<[f64], CCIfSubtarget<"hasSPE()", CCAssignToStack<8, 8>>>,
2167330f729Sjoerg
2177330f729Sjoerg  // Vectors and float128 get 16-byte stack slots that are 16-byte aligned.
2187330f729Sjoerg  CCIfType<[v16i8, v8i16, v4i32, v4f32, v2f64, v2i64], CCAssignToStack<16, 16>>,
219*82d56013Sjoerg  CCIfType<[f128], CCIfSubtarget<"hasAltivec()", CCAssignToStack<16, 16>>>
2207330f729Sjoerg]>;
2217330f729Sjoerg
2227330f729Sjoerg// This calling convention puts vector arguments always on the stack. It is used
2237330f729Sjoerg// to assign vector arguments which belong to the variable portion of the
2247330f729Sjoerg// parameter list of a variable argument function.
2257330f729Sjoerglet Entry = 1 in
2267330f729Sjoergdef CC_PPC32_SVR4_VarArg : CallingConv<[
2277330f729Sjoerg  CCDelegateTo<CC_PPC32_SVR4_Common>
2287330f729Sjoerg]>;
2297330f729Sjoerg
2307330f729Sjoerg// In contrast to CC_PPC32_SVR4_VarArg, this calling convention first tries to
2317330f729Sjoerg// put vector arguments in vector registers before putting them on the stack.
2327330f729Sjoerglet Entry = 1 in
2337330f729Sjoergdef CC_PPC32_SVR4 : CallingConv<[
2347330f729Sjoerg  // The first 12 Vector arguments are passed in AltiVec registers.
2357330f729Sjoerg  CCIfType<[v16i8, v8i16, v4i32, v2i64, v1i128, v4f32, v2f64],
2367330f729Sjoerg           CCIfSubtarget<"hasAltivec()", CCAssignToReg<[V2, V3, V4, V5, V6, V7,
2377330f729Sjoerg                          V8, V9, V10, V11, V12, V13]>>>,
2387330f729Sjoerg
2397330f729Sjoerg  // Float128 types treated as vector arguments.
2407330f729Sjoerg  CCIfType<[f128],
241*82d56013Sjoerg           CCIfSubtarget<"hasAltivec()", CCAssignToReg<[V2, V3, V4, V5, V6, V7,
2427330f729Sjoerg                          V8, V9, V10, V11, V12, V13]>>>,
2437330f729Sjoerg
2447330f729Sjoerg  CCDelegateTo<CC_PPC32_SVR4_Common>
2457330f729Sjoerg]>;
2467330f729Sjoerg
2477330f729Sjoerg// Helper "calling convention" to handle aggregate by value arguments.
2487330f729Sjoerg// Aggregate by value arguments are always placed in the local variable space
2497330f729Sjoerg// of the caller. This calling convention is only used to assign those stack
2507330f729Sjoerg// offsets in the callers stack frame.
2517330f729Sjoerg//
2527330f729Sjoerg// Still, the address of the aggregate copy in the callers stack frame is passed
2537330f729Sjoerg// in a GPR (or in the parameter list area if all GPRs are allocated) from the
2547330f729Sjoerg// caller to the callee. The location for the address argument is assigned by
2557330f729Sjoerg// the CC_PPC32_SVR4 calling convention.
2567330f729Sjoerg//
2577330f729Sjoerg// The only purpose of CC_PPC32_SVR4_Custom_Dummy is to skip arguments which are
2587330f729Sjoerg// not passed by value.
2597330f729Sjoerg
2607330f729Sjoerglet Entry = 1 in
2617330f729Sjoergdef CC_PPC32_SVR4_ByVal : CallingConv<[
2627330f729Sjoerg  CCIfByVal<CCPassByVal<4, 4>>,
2637330f729Sjoerg
2647330f729Sjoerg  CCCustom<"CC_PPC32_SVR4_Custom_Dummy">
2657330f729Sjoerg]>;
2667330f729Sjoerg
2677330f729Sjoergdef CSR_Altivec : CalleeSavedRegs<(add V20, V21, V22, V23, V24, V25, V26, V27,
2687330f729Sjoerg                                       V28, V29, V30, V31)>;
2697330f729Sjoerg
2707330f729Sjoerg// SPE does not use FPRs, so break out the common register set as base.
2717330f729Sjoergdef CSR_SVR432_COMM : CalleeSavedRegs<(add R14, R15, R16, R17, R18, R19, R20,
2727330f729Sjoerg                                          R21, R22, R23, R24, R25, R26, R27,
2737330f729Sjoerg                                          R28, R29, R30, R31, CR2, CR3, CR4
2747330f729Sjoerg                                      )>;
2757330f729Sjoergdef CSR_SVR432 :  CalleeSavedRegs<(add CSR_SVR432_COMM, F14, F15, F16, F17, F18,
2767330f729Sjoerg                                        F19, F20, F21, F22, F23, F24, F25, F26,
2777330f729Sjoerg                                        F27, F28, F29, F30, F31
2787330f729Sjoerg                                   )>;
2797330f729Sjoergdef CSR_SPE : CalleeSavedRegs<(add S14, S15, S16, S17, S18, S19, S20, S21, S22,
2807330f729Sjoerg                                   S23, S24, S25, S26, S27, S28, S29, S30, S31
2817330f729Sjoerg                              )>;
2827330f729Sjoerg
2837330f729Sjoergdef CSR_SVR432_Altivec : CalleeSavedRegs<(add CSR_SVR432, CSR_Altivec)>;
2847330f729Sjoerg
2857330f729Sjoergdef CSR_SVR432_SPE : CalleeSavedRegs<(add CSR_SVR432_COMM, CSR_SPE)>;
2867330f729Sjoerg
2877330f729Sjoergdef CSR_AIX32 : CalleeSavedRegs<(add R13, R14, R15, R16, R17, R18, R19, R20,
2887330f729Sjoerg                                     R21, R22, R23, R24, R25, R26, R27, R28,
2897330f729Sjoerg                                     R29, R30, R31, F14, F15, F16, F17, F18,
2907330f729Sjoerg                                     F19, F20, F21, F22, F23, F24, F25, F26,
2917330f729Sjoerg                                     F27, F28, F29, F30, F31, CR2, CR3, CR4
2927330f729Sjoerg                                )>;
2937330f729Sjoerg
294*82d56013Sjoergdef CSR_AIX32_Altivec : CalleeSavedRegs<(add CSR_AIX32, CSR_Altivec)>;
295*82d56013Sjoerg
296*82d56013Sjoerg// Common CalleeSavedRegs for SVR4 and AIX.
297*82d56013Sjoergdef CSR_PPC64   : CalleeSavedRegs<(add X14, X15, X16, X17, X18, X19, X20,
2987330f729Sjoerg                                        X21, X22, X23, X24, X25, X26, X27, X28,
2997330f729Sjoerg                                        X29, X30, X31, F14, F15, F16, F17, F18,
3007330f729Sjoerg                                        F19, F20, F21, F22, F23, F24, F25, F26,
3017330f729Sjoerg                                        F27, F28, F29, F30, F31, CR2, CR3, CR4
3027330f729Sjoerg                                   )>;
3037330f729Sjoerg
3047330f729Sjoerg
305*82d56013Sjoergdef CSR_PPC64_Altivec : CalleeSavedRegs<(add CSR_PPC64, CSR_Altivec)>;
3067330f729Sjoerg
307*82d56013Sjoergdef CSR_PPC64_R2 : CalleeSavedRegs<(add CSR_PPC64, X2)>;
3087330f729Sjoerg
309*82d56013Sjoergdef CSR_PPC64_R2_Altivec : CalleeSavedRegs<(add CSR_PPC64_Altivec, X2)>;
3107330f729Sjoerg
3117330f729Sjoergdef CSR_NoRegs : CalleeSavedRegs<(add)>;
3127330f729Sjoerg
3137330f729Sjoerg// coldcc calling convection marks most registers as non-volatile.
3147330f729Sjoerg// Do not include r1 since the stack pointer is never considered a CSR.
3157330f729Sjoerg// Do not include r2, since it is the TOC register and is added depending
3167330f729Sjoerg// on whether or not the function uses the TOC and is a non-leaf.
3177330f729Sjoerg// Do not include r0,r11,r13 as they are optional in functional linkage
3187330f729Sjoerg// and value may be altered by inter-library calls.
3197330f729Sjoerg// Do not include r12 as it is used as a scratch register.
3207330f729Sjoerg// Do not include return registers r3, f1, v2.
3217330f729Sjoergdef CSR_SVR32_ColdCC_Common : CalleeSavedRegs<(add (sequence "R%u", 4, 10),
3227330f729Sjoerg                                                (sequence "R%u", 14, 31),
3237330f729Sjoerg                                                (sequence "CR%u", 0, 7))>;
3247330f729Sjoerg
3257330f729Sjoergdef CSR_SVR32_ColdCC : CalleeSavedRegs<(add CSR_SVR32_ColdCC_Common,
3267330f729Sjoerg                                          F0, (sequence "F%u", 2, 31))>;
3277330f729Sjoerg
3287330f729Sjoerg
3297330f729Sjoergdef CSR_SVR32_ColdCC_Altivec : CalleeSavedRegs<(add CSR_SVR32_ColdCC,
3307330f729Sjoerg                                            (sequence "V%u", 0, 1),
3317330f729Sjoerg                                            (sequence "V%u", 3, 31))>;
3327330f729Sjoerg
3337330f729Sjoergdef CSR_SVR32_ColdCC_SPE : CalleeSavedRegs<(add CSR_SVR32_ColdCC_Common,
3347330f729Sjoerg                                            (sequence "S%u", 4, 10),
3357330f729Sjoerg                                            (sequence "S%u", 14, 31))>;
3367330f729Sjoerg
3377330f729Sjoergdef CSR_SVR64_ColdCC : CalleeSavedRegs<(add  (sequence "X%u", 4, 10),
3387330f729Sjoerg                                             (sequence "X%u", 14, 31),
3397330f729Sjoerg                                             F0, (sequence "F%u", 2, 31),
3407330f729Sjoerg                                             (sequence "CR%u", 0, 7))>;
3417330f729Sjoerg
3427330f729Sjoergdef CSR_SVR64_ColdCC_R2: CalleeSavedRegs<(add CSR_SVR64_ColdCC, X2)>;
3437330f729Sjoerg
3447330f729Sjoergdef CSR_SVR64_ColdCC_Altivec : CalleeSavedRegs<(add CSR_SVR64_ColdCC,
3457330f729Sjoerg                                             (sequence "V%u", 0, 1),
3467330f729Sjoerg                                             (sequence "V%u", 3, 31))>;
3477330f729Sjoerg
3487330f729Sjoergdef CSR_SVR64_ColdCC_R2_Altivec : CalleeSavedRegs<(add CSR_SVR64_ColdCC_Altivec, X2)>;
3497330f729Sjoerg
3507330f729Sjoergdef CSR_64_AllRegs: CalleeSavedRegs<(add X0, (sequence "X%u", 3, 10),
3517330f729Sjoerg                                             (sequence "X%u", 14, 31),
3527330f729Sjoerg                                             (sequence "F%u", 0, 31),
3537330f729Sjoerg                                             (sequence "CR%u", 0, 7))>;
3547330f729Sjoerg
3557330f729Sjoergdef CSR_64_AllRegs_Altivec : CalleeSavedRegs<(add CSR_64_AllRegs,
3567330f729Sjoerg                                             (sequence "V%u", 0, 31))>;
3577330f729Sjoerg
358*82d56013Sjoergdef CSR_64_AllRegs_AIX_Dflt_Altivec : CalleeSavedRegs<(add CSR_64_AllRegs,
359*82d56013Sjoerg                                             (sequence "V%u", 0, 19))>;
360*82d56013Sjoerg
3617330f729Sjoergdef CSR_64_AllRegs_VSX : CalleeSavedRegs<(add CSR_64_AllRegs_Altivec,
3627330f729Sjoerg                                         (sequence "VSL%u", 0, 31))>;
3637330f729Sjoerg
364*82d56013Sjoergdef CSR_64_AllRegs_AIX_Dflt_VSX : CalleeSavedRegs<(add CSR_64_AllRegs_Altivec,
365*82d56013Sjoerg                                         (sequence "VSL%u", 0, 19))>;
366