Index: llvm/lib/Target/AArch64/AArch64CallingConvention.td =================================================================== --- llvm/lib/Target/AArch64/AArch64CallingConvention.td +++ llvm/lib/Target/AArch64/AArch64CallingConvention.td @@ -377,12 +377,6 @@ D8, D9, D10, D11, D12, D13, D14, D15)>; -// Darwin puts the frame-record at the top of the callee-save area. -def CSR_Darwin_AArch64_AAPCS : CalleeSavedRegs<(add LR, FP, X19, X20, X21, X22, - X23, X24, X25, X26, X27, X28, - D8, D9, D10, D11, - D12, D13, D14, D15)>; - // Win64 has unwinding codes for an (FP,LR) pair, save_fplr and save_fplr_x. // We put FP before LR, so that frame lowering logic generates (FP,LR) pairs, // and not (LR,FP) pairs. @@ -421,33 +415,7 @@ def CSR_AArch64_AAPCS_ThisReturn : CalleeSavedRegs<(add CSR_AArch64_AAPCS, X0)>; def CSR_AArch64_AAPCS_SwiftError - : CalleeSavedRegs<(sub CSR_Darwin_AArch64_AAPCS, X21)>; - -// The function used by Darwin to obtain the address of a thread-local variable -// guarantees more than a normal AAPCS function. x16 and x17 are used on the -// fast path for calculation, but other registers except X0 (argument/return) -// and LR (it is a call, after all) are preserved. -def CSR_AArch64_TLS_Darwin - : CalleeSavedRegs<(add (sub (sequence "X%u", 1, 28), X16, X17), - FP, - (sequence "Q%u", 0, 31))>; - -// We can only handle a register pair with adjacent registers, the register pair -// should belong to the same class as well. Since the access function on the -// fast path calls a function that follows CSR_AArch64_TLS_Darwin, -// CSR_AArch64_CXX_TLS_Darwin should be a subset of CSR_AArch64_TLS_Darwin. -def CSR_AArch64_CXX_TLS_Darwin - : CalleeSavedRegs<(add CSR_Darwin_AArch64_AAPCS, - (sub (sequence "X%u", 1, 28), X15, X16, X17, X18), - (sequence "D%u", 0, 31))>; - -// CSRs that are handled by prologue, epilogue. -def CSR_AArch64_CXX_TLS_Darwin_PE - : CalleeSavedRegs<(add LR, FP)>; - -// CSRs that are handled explicitly via copies. -def CSR_AArch64_CXX_TLS_Darwin_ViaCopy - : CalleeSavedRegs<(sub CSR_AArch64_CXX_TLS_Darwin, LR, FP)>; + : CalleeSavedRegs<(sub CSR_AArch64_AAPCS, X21)>; // The ELF stub used for TLS-descriptor access saves every feasible // register. Only X0 and LR are clobbered. @@ -472,14 +440,57 @@ (sequence "X%u", 18, 28), FP, SP, (sequence "Q%u", 0, 31))>; +// Darwin variants of AAPCS. +// Darwin puts the frame-record at the top of the callee-save area. +def CSR_Darwin_AArch64_AAPCS : CalleeSavedRegs<(add LR, FP, X19, X20, X21, X22, + X23, X24, X25, X26, X27, X28, + D8, D9, D10, D11, + D12, D13, D14, D15)>; + +def CSR_Darwin_AArch64_AAVPCS : CalleeSavedRegs<(add LR, FP, X19, X20, X21, + X22, X23, X24, X25, X26, X27, + X28, (sequence "Q%u", 8, 23))>; +def CSR_Darwin_AArch64_AAPCS_ThisReturn + : CalleeSavedRegs<(add CSR_Darwin_AArch64_AAPCS, X0)>; + +def CSR_Darwin_AArch64_AAPCS_SwiftError + : CalleeSavedRegs<(sub CSR_Darwin_AArch64_AAPCS, X21)>; + +// The function used by Darwin to obtain the address of a thread-local variable +// guarantees more than a normal AAPCS function. x16 and x17 are used on the +// fast path for calculation, but other registers except X0 (argument/return) +// and LR (it is a call, after all) are preserved. +def CSR_Darwin_AArch64_TLS + : CalleeSavedRegs<(add (sub (sequence "X%u", 1, 28), X16, X17), + FP, + (sequence "Q%u", 0, 31))>; + +// We can only handle a register pair with adjacent registers, the register pair +// should belong to the same class as well. Since the access function on the +// fast path calls a function that follows CSR_Darwin_AArch64_TLS, +// CSR_Darwin_AArch64_CXX_TLS should be a subset of CSR_Darwin_AArch64_TLS. +def CSR_Darwin_AArch64_CXX_TLS + : CalleeSavedRegs<(add CSR_Darwin_AArch64_AAPCS, + (sub (sequence "X%u", 1, 28), X15, X16, X17, X18), + (sequence "D%u", 0, 31))>; + +// CSRs that are handled by prologue, epilogue. +def CSR_Darwin_AArch64_CXX_TLS_PE + : CalleeSavedRegs<(add LR, FP)>; + +// CSRs that are handled explicitly via copies. +def CSR_Darwin_AArch64_CXX_TLS_ViaCopy + : CalleeSavedRegs<(sub CSR_Darwin_AArch64_CXX_TLS, LR, FP)>; + +def CSR_Darwin_AArch64_RT_MostRegs + : CalleeSavedRegs<(add CSR_Darwin_AArch64_AAPCS, (sequence "X%u", 9, 15))>; + // Variants of the standard calling conventions for shadow call stack. // These all preserve x18 in addition to any other registers. def CSR_AArch64_NoRegs_SCS : CalleeSavedRegs<(add CSR_AArch64_NoRegs, X18)>; def CSR_AArch64_AllRegs_SCS : CalleeSavedRegs<(add CSR_AArch64_AllRegs, X18)>; -def CSR_AArch64_CXX_TLS_Darwin_SCS - : CalleeSavedRegs<(add CSR_AArch64_CXX_TLS_Darwin, X18)>; def CSR_AArch64_AAPCS_SwiftError_SCS : CalleeSavedRegs<(add CSR_AArch64_AAPCS_SwiftError, X18)>; def CSR_AArch64_RT_MostRegs_SCS Index: llvm/lib/Target/AArch64/AArch64RegisterInfo.h =================================================================== --- llvm/lib/Target/AArch64/AArch64RegisterInfo.h +++ llvm/lib/Target/AArch64/AArch64RegisterInfo.h @@ -44,10 +44,13 @@ /// Code Generation virtual methods... const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override; + const MCPhysReg *getDarwinCalleeSavedRegs(const MachineFunction *MF) const; const MCPhysReg * getCalleeSavedRegsViaCopy(const MachineFunction *MF) const; const uint32_t *getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override; + const uint32_t *getDarwinCallPreservedMask(const MachineFunction &MF, + CallingConv::ID) const; unsigned getCSRFirstUseCost() const override { // The cost will be compared against BlockFrequency where entry has the Index: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp =================================================================== --- llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp +++ llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp @@ -43,24 +43,27 @@ const MCPhysReg * AArch64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { assert(MF && "Invalid MachineFunction pointer."); - if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check) - return CSR_Win_AArch64_CFGuard_Check_SaveList; - if (MF->getSubtarget().isTargetWindows()) - return CSR_Win_AArch64_AAPCS_SaveList; + if (MF->getFunction().getCallingConv() == CallingConv::GHC) // GHC set of callee saved regs is empty as all those regs are // used for passing STG regs around return CSR_AArch64_NoRegs_SaveList; if (MF->getFunction().getCallingConv() == CallingConv::AnyReg) return CSR_AArch64_AllRegs_SaveList; + + // Darwin has its own CSR_AArch64_AAPCS_SaveList, which means most CSR save + // lists depending on that will need to have their Darwin variant as well. + if (MF->getSubtarget().isTargetDarwin()) + return getDarwinCalleeSavedRegs(MF); + + if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check) + return CSR_Win_AArch64_CFGuard_Check_SaveList; + if (MF->getSubtarget().isTargetWindows()) + return CSR_Win_AArch64_AAPCS_SaveList; if (MF->getFunction().getCallingConv() == CallingConv::AArch64_VectorCall) return CSR_AArch64_AAVPCS_SaveList; if (MF->getFunction().getCallingConv() == CallingConv::AArch64_SVE_VectorCall) return CSR_AArch64_SVE_AAPCS_SaveList; - if (MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS) - return MF->getInfo()->isSplitCSR() ? - CSR_AArch64_CXX_TLS_Darwin_PE_SaveList : - CSR_AArch64_CXX_TLS_Darwin_SaveList; if (MF->getSubtarget().getTargetLowering() ->supportSwiftError() && MF->getFunction().getAttributes().hasAttrSomewhere( @@ -68,17 +71,43 @@ return CSR_AArch64_AAPCS_SwiftError_SaveList; if (MF->getFunction().getCallingConv() == CallingConv::PreserveMost) return CSR_AArch64_RT_MostRegs_SaveList; - if (MF->getSubtarget().isTargetDarwin()) - return CSR_Darwin_AArch64_AAPCS_SaveList; return CSR_AArch64_AAPCS_SaveList; } +const MCPhysReg * +AArch64RegisterInfo::getDarwinCalleeSavedRegs(const MachineFunction *MF) const { + assert(MF && "Invalid MachineFunction pointer."); + assert(MF->getSubtarget().isTargetDarwin() && + "Invalid subtarget for getDarwinCalleeSavedRegs"); + + if (MF->getFunction().getCallingConv() == CallingConv::CFGuard_Check) + report_fatal_error( + "Calling convention CFGuard_Check is unsupported on Darwin."); + if (MF->getFunction().getCallingConv() == CallingConv::AArch64_VectorCall) + return CSR_Darwin_AArch64_AAVPCS_SaveList; + if (MF->getFunction().getCallingConv() == CallingConv::AArch64_SVE_VectorCall) + report_fatal_error( + "Calling convention SVE_VectorCall is unsupported on Darwin."); + if (MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS) + return MF->getInfo()->isSplitCSR() + ? CSR_Darwin_AArch64_CXX_TLS_PE_SaveList + : CSR_Darwin_AArch64_CXX_TLS_SaveList; + if (MF->getSubtarget().getTargetLowering() + ->supportSwiftError() && + MF->getFunction().getAttributes().hasAttrSomewhere( + Attribute::SwiftError)) + return CSR_Darwin_AArch64_AAPCS_SwiftError_SaveList; + if (MF->getFunction().getCallingConv() == CallingConv::PreserveMost) + return CSR_Darwin_AArch64_RT_MostRegs_SaveList; + return CSR_Darwin_AArch64_AAPCS_SaveList; +} + const MCPhysReg *AArch64RegisterInfo::getCalleeSavedRegsViaCopy( const MachineFunction *MF) const { assert(MF && "Invalid MachineFunction pointer."); if (MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS && MF->getInfo()->isSplitCSR()) - return CSR_AArch64_CXX_TLS_Darwin_ViaCopy_SaveList; + return CSR_Darwin_AArch64_CXX_TLS_ViaCopy_SaveList; return nullptr; } @@ -112,6 +141,32 @@ return AArch64GenRegisterInfo::getSubClassWithSubReg(RC, Idx); } +const uint32_t * +AArch64RegisterInfo::getDarwinCallPreservedMask(const MachineFunction &MF, + CallingConv::ID CC) const { + assert(MF.getSubtarget().isTargetDarwin() && + "Invalid subtarget for getDarwinCallPreservedMask"); + + if (CC == CallingConv::CXX_FAST_TLS) + return CSR_Darwin_AArch64_CXX_TLS_RegMask; + if (CC == CallingConv::AArch64_VectorCall) + return CSR_Darwin_AArch64_AAVPCS_RegMask; + if (CC == CallingConv::AArch64_SVE_VectorCall) + report_fatal_error( + "Calling convention SVE_VectorCall is unsupported on Darwin."); + if (CC == CallingConv::CFGuard_Check) + report_fatal_error( + "Calling convention CFGuard_Check is unsupported on Darwin."); + if (MF.getSubtarget() + .getTargetLowering() + ->supportSwiftError() && + MF.getFunction().getAttributes().hasAttrSomewhere(Attribute::SwiftError)) + return CSR_Darwin_AArch64_AAPCS_SwiftError_RegMask; + if (CC == CallingConv::PreserveMost) + return CSR_Darwin_AArch64_RT_MostRegs_RegMask; + return CSR_Darwin_AArch64_AAPCS_RegMask; +} + const uint32_t * AArch64RegisterInfo::getCallPreservedMask(const MachineFunction &MF, CallingConv::ID CC) const { @@ -121,9 +176,14 @@ return SCS ? CSR_AArch64_NoRegs_SCS_RegMask : CSR_AArch64_NoRegs_RegMask; if (CC == CallingConv::AnyReg) return SCS ? CSR_AArch64_AllRegs_SCS_RegMask : CSR_AArch64_AllRegs_RegMask; - if (CC == CallingConv::CXX_FAST_TLS) - return SCS ? CSR_AArch64_CXX_TLS_Darwin_SCS_RegMask - : CSR_AArch64_CXX_TLS_Darwin_RegMask; + + // All the following calling conventions are handled differently on Darwin. + if (MF.getSubtarget().isTargetDarwin()) { + if (SCS) + report_fatal_error("ShadowCallStack attribute not supported on Darwin."); + return getDarwinCallPreservedMask(MF, CC); + } + if (CC == CallingConv::AArch64_VectorCall) return SCS ? CSR_AArch64_AAVPCS_SCS_RegMask : CSR_AArch64_AAVPCS_RegMask; if (CC == CallingConv::AArch64_SVE_VectorCall) @@ -145,7 +205,7 @@ const uint32_t *AArch64RegisterInfo::getTLSCallPreservedMask() const { if (TT.isOSDarwin()) - return CSR_AArch64_TLS_Darwin_RegMask; + return CSR_Darwin_AArch64_TLS_RegMask; assert(TT.isOSBinFormatELF() && "Invalid target"); return CSR_AArch64_TLS_ELF_RegMask; @@ -186,6 +246,8 @@ // In case that the calling convention does not use the same register for // both, the function should return NULL (does not currently apply) assert(CC != CallingConv::GHC && "should not be GHC calling convention."); + if (MF.getSubtarget().isTargetDarwin()) + return CSR_Darwin_AArch64_AAPCS_ThisReturn_RegMask; return CSR_AArch64_AAPCS_ThisReturn_RegMask; } Index: llvm/test/CodeGen/AArch64/GlobalISel/arm64-callingconv-ios.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/arm64-callingconv-ios.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/arm64-callingconv-ios.ll @@ -39,7 +39,7 @@ ; CHECK: [[C12:%[0-9]+]]:_(s64) = G_CONSTANT i64 32 ; CHECK: [[PTR_ADD4:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C12]](s64) ; CHECK: G_STORE [[C7]](s64), [[PTR_ADD4]](p0) :: (store 8 into stack + 32, align 1) - ; CHECK: BL @varargs, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 + ; CHECK: BL @varargs, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 ; CHECK: ADJCALLSTACKUP 40, 0, implicit-def $sp, implicit $sp ; CHECK: RET_ReallyLR call void(i32, double, i64, ...) @varargs(i32 42, double 1.0, i64 12, i8 3, i16 1, i32 4, float 1.0, double 2.0) @@ -87,7 +87,7 @@ ; CHECK: [[C15:%[0-9]+]]:_(s64) = G_CONSTANT i64 5 ; CHECK: [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C15]](s64) ; CHECK: G_STORE [[C11]](s8), [[PTR_ADD3]](p0) :: (store 1 into stack + 5) - ; CHECK: BL @i8i16callee, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $w3, implicit $w4, implicit $x5, implicit $x6, implicit $x7, implicit-def $x0 + ; CHECK: BL @i8i16callee, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $w3, implicit $w4, implicit $x5, implicit $x6, implicit $x7, implicit-def $x0 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x0 ; CHECK: ADJCALLSTACKUP 6, 0, implicit-def $sp, implicit $sp ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64) Index: llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll @@ -7,7 +7,7 @@ ; DARWIN-LABEL: name: test_extern_weak ; DARWIN: bb.1 (%ir-block.0): ; DARWIN: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp - ; DARWIN: BL @extern_weak_fn, csr_aarch64_aapcs, implicit-def $lr, implicit $sp + ; DARWIN: BL @extern_weak_fn, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp ; DARWIN: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; DARWIN: RET_ReallyLR tail call void @extern_weak_fn() Index: llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll @@ -6,7 +6,7 @@ define void @tail_call() { ; COMMON-LABEL: name: tail_call ; COMMON: bb.1 (%ir-block.0): - ; COMMON: TCRETURNdi @simple_fn, 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNdi @simple_fn, 0, csr{{.*}}aarch64_aapcs, implicit $sp tail call void @simple_fn() ret void } @@ -18,7 +18,7 @@ ; COMMON: bb.1 (%ir-block.0): ; COMMON: liveins: $x0 ; COMMON: [[COPY:%[0-9]+]]:tcgpr64(p0) = COPY $x0 - ; COMMON: TCRETURNri [[COPY]](p0), 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNri [[COPY]](p0), 0, csr{{.*}}aarch64_aapcs, implicit $sp tail call void %func() ret void } @@ -30,7 +30,7 @@ ; COMMON: liveins: $w0 ; COMMON: [[COPY:%[0-9]+]]:_(s32) = COPY $w0 ; COMMON: $w0 = COPY [[COPY]](s32) - ; COMMON: TCRETURNdi @outgoing_args_fn, 0, csr_aarch64_aapcs, implicit $sp, implicit $w0 + ; COMMON: TCRETURNdi @outgoing_args_fn, 0, csr{{.*}}aarch64_aapcs, implicit $sp, implicit $w0 tail call void @outgoing_args_fn(i32 %a) ret void } @@ -44,7 +44,7 @@ ; COMMON: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 ; COMMON: [[LOAD:%[0-9]+]]:_(<4 x s16>) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load 8 from %fixed-stack.0, align 16) ; COMMON: $d0 = COPY [[LOAD]](<4 x s16>) - ; COMMON: TCRETURNdi @outgoing_stack_args_fn, 0, csr_aarch64_aapcs, implicit $sp, implicit $d0 + ; COMMON: TCRETURNdi @outgoing_stack_args_fn, 0, csr{{.*}}aarch64_aapcs, implicit $sp, implicit $d0 tail call void @outgoing_stack_args_fn(<4 x half> %arg) ret void } @@ -70,7 +70,7 @@ define i32 @test_nonvoid_ret() { ; COMMON-LABEL: name: test_nonvoid_ret ; COMMON: bb.1 (%ir-block.0): - ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr{{.*}}aarch64_aapcs, implicit $sp %call = tail call i32 @nonvoid_ret() ret i32 %call } @@ -85,7 +85,7 @@ ; COMMON: $w0 = COPY [[C]](s32) ; COMMON: $d0 = COPY [[C1]](s64) ; COMMON: $x1 = COPY [[C2]](s64) - ; COMMON: TCRETURNdi @varargs, 0, csr_aarch64_aapcs, implicit $sp, implicit $w0, implicit $d0, implicit $x1 + ; COMMON: TCRETURNdi @varargs, 0, csr{{.*}}aarch64_aapcs, implicit $sp, implicit $w0, implicit $d0, implicit $x1 tail call void(i32, double, i64, ...) @varargs(i32 42, double 1.0, i64 12) ret void } @@ -96,7 +96,7 @@ define void @test_varargs_2() { ; DARWIN-LABEL: name: test_varargs_2 ; DARWIN-NOT: TCRETURNdi @varargs - ; DARWIN: BL @varargs, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 + ; DARWIN: BL @varargs, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 ; DARWIN: ADJCALLSTACKUP 8, 0, implicit-def $sp, implicit $sp ; DARWIN: RET_ReallyLR @@ -121,7 +121,7 @@ define void @test_varargs_3([8 x <2 x double>], <4 x half> %arg) { ; DARWIN-LABEL: name: test_varargs_3 ; DARWIN-NOT: TCRETURNdi @varargs - ; DARWIN: BL @varargs, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 + ; DARWIN: BL @varargs, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit $d0, implicit $x1 ; DARWIN: ADJCALLSTACKUP 8, 0, implicit-def $sp, implicit $sp ; DARWIN: RET_ReallyLR @@ -172,7 +172,7 @@ ; COMMON: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0 ; COMMON: [[LOAD:%[0-9]+]]:_(p0) = G_LOAD [[FRAME_INDEX]](p0) :: (invariant load 8 from %fixed-stack.0, align 16) ; COMMON: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp - ; COMMON: BL @simple_fn, csr_aarch64_aapcs, implicit-def $lr, implicit $sp + ; COMMON: BL @simple_fn, csr{{.*}}aarch64_aapcs, implicit-def $lr, implicit $sp ; COMMON: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; COMMON: RET_ReallyLR tail call void @simple_fn() @@ -186,7 +186,7 @@ ; COMMON: liveins: $x0 ; COMMON: [[COPY:%[0-9]+]]:_(p0) = COPY $x0 ; COMMON: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp - ; COMMON: BL @simple_fn, csr_aarch64_aapcs, implicit-def $lr, implicit $sp + ; COMMON: BL @simple_fn, csr{{.*}}aarch64_aapcs, implicit-def $lr, implicit $sp ; COMMON: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; COMMON: RET_ReallyLR tail call void @simple_fn() @@ -197,7 +197,7 @@ define void @test_mismatched_caller() { ; COMMON-LABEL: name: test_mismatched_caller ; COMMON: bb.1 (%ir-block.0): - ; COMMON: TCRETURNdi @fast_fn, 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNdi @fast_fn, 0, csr{{.*}}aarch64_aapcs, implicit $sp tail call fastcc void @fast_fn() ret void } @@ -207,7 +207,7 @@ define void @test_assume() local_unnamed_addr { ; COMMON-LABEL: name: test_assume ; COMMON: bb.1.entry: - ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr{{.*}}aarch64_aapcs, implicit $sp entry: %x = tail call i32 @nonvoid_ret() %y = icmp ne i32 %x, 0 @@ -222,7 +222,7 @@ ; COMMON: bb.1.entry: ; COMMON: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0.t ; COMMON: LIFETIME_START %stack.0.t - ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr_aarch64_aapcs, implicit $sp + ; COMMON: TCRETURNdi @nonvoid_ret, 0, csr{{.*}}aarch64_aapcs, implicit $sp entry: %t = alloca i8, align 1 call void @llvm.lifetime.start.p0i8(i64 1, i8* %t) @@ -242,11 +242,11 @@ ; COMMON: liveins: $x20 ; COMMON: [[COPY:%[0-9]+]]:_(p0) = COPY $x20 ; COMMON: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp - ; COMMON: BL @pluto, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $x0 + ; COMMON: BL @pluto, csr{{.*}}aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $x0 ; COMMON: [[COPY1:%[0-9]+]]:tcgpr64(p0) = COPY $x0 ; COMMON: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; COMMON: $x20 = COPY [[COPY]](p0) - ; COMMON: TCRETURNri [[COPY1]](p0), 0, csr_aarch64_aapcs, implicit $sp, implicit $x20 + ; COMMON: TCRETURNri [[COPY1]](p0), 0, csr{{.*}}aarch64_aapcs, implicit $sp, implicit $x20 %tmp = call i8* @pluto() %tmp1 = bitcast i8* %tmp to i64 (i64*)* %tmp2 = tail call swiftcc i64 %tmp1(i64* swiftself %arg) @@ -262,7 +262,7 @@ ; COMMON: [[COPY:%[0-9]+]]:_(p0) = COPY $x0 ; COMMON: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0 ; COMMON: $x0 = COPY [[C]](p0) - ; COMMON: TCRETURNdi @must_callee, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0 + ; COMMON: TCRETURNdi @must_callee, 0, csr{{.*}}aarch64_aapcs, implicit $sp, implicit $x0 musttail call void @must_callee(i8* null) ret void } Index: llvm/test/CodeGen/AArch64/GlobalISel/integration-shuffle-vector.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/integration-shuffle-vector.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/integration-shuffle-vector.ll @@ -14,7 +14,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $q0 = COPY [[COPY]] ; CHECK: $q1 = COPY [[COPY1]] - ; CHECK: BL @bar, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $q0, implicit $q1 + ; CHECK: BL @bar, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $q0, implicit $q1 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: RET_ReallyLR %vec = shufflevector <2 x i64> %a, <2 x i64> %b, <4 x i32> Index: llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll +++ llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-exceptions.ll @@ -12,7 +12,7 @@ ; CHECK: successors: %[[GOOD:bb.[0-9]+]]{{.*}}%[[BAD:bb.[0-9]+]] ; CHECK: EH_LABEL ; CHECK: $w0 = COPY -; CHECK: BL @foo, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit-def $w0 +; CHECK: BL @foo, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $w0, implicit-def $w0 ; CHECK: {{%[0-9]+}}:_(s32) = COPY $w0 ; CHECK: EH_LABEL ; CHECK: G_BR %[[GOOD]] Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-et-al.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-et-al.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-et-al.mir @@ -18,7 +18,7 @@ ; CHECK: $x0 = COPY [[COPY]](p0) ; CHECK: $x1 = COPY [[COPY1]](p0) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: BL &memcpy, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: BL &memcpy, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: RET_ReallyLR %0:_(p0) = COPY $x0 @@ -45,7 +45,7 @@ ; CHECK: $x0 = COPY [[COPY]](p0) ; CHECK: $x1 = COPY [[COPY1]](p0) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: TCRETURNdi &memcpy, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: TCRETURNdi &memcpy, 0, csr_darwin_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2 %0:_(p0) = COPY $x0 %1:_(p0) = COPY $x1 %2:_(s32) = COPY $w2 @@ -71,7 +71,7 @@ ; CHECK: $x0 = COPY [[COPY]](p0) ; CHECK: $x1 = COPY [[COPY1]](p0) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: BL &memmove, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: BL &memmove, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: RET_ReallyLR %0:_(p0) = COPY $x0 @@ -100,7 +100,7 @@ ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32) ; CHECK: $w1 = COPY [[COPY3]](s32) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: BL &memset, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit $x2 + ; CHECK: BL &memset, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit $x2 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: RET_ReallyLR %0:_(p0) = COPY $x0 @@ -129,7 +129,7 @@ ; CHECK: $x0 = COPY [[COPY]](p0) ; CHECK: $x1 = COPY [[COPY1]](p0) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: BL &memcpy, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: BL &memcpy, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: $x0 = COPY [[ZEXT]](s64) ; CHECK: RET_ReallyLR implicit $x0 @@ -158,13 +158,13 @@ ; CHECK: $x0 = COPY [[COPY]](p0) ; CHECK: $x1 = COPY [[COPY1]](p0) ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: BL &memcpy, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: BL &memcpy, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp - ; CHECK: TCRETURNdi &memset, 0, csr_aarch64_aapcs, implicit $sp + ; CHECK: TCRETURNdi &memset, 0, csr_darwin_aarch64_aapcs, implicit $sp %0:_(p0) = COPY $x0 %1:_(p0) = COPY $x1 %2:_(s32) = COPY $w2 %4:_(s1) = G_CONSTANT i1 false %3:_(s64) = G_ZEXT %2(s32) G_INTRINSIC_W_SIDE_EFFECTS intrinsic(@llvm.memcpy), %0(p0), %1(p0), %3(s64), 1 - TCRETURNdi &memset, 0, csr_aarch64_aapcs, implicit $sp + TCRETURNdi &memset, 0, csr_darwin_aarch64_aapcs, implicit $sp Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-with-debug-info.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-with-debug-info.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-memcpy-with-debug-info.mir @@ -43,10 +43,10 @@ ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1, debug-location !DILocation(line: 3, column: 1, scope: !5) ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2, debug-location !DILocation(line: 4, column: 1, scope: !5) ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32), debug-location !DILocation(line: 5, column: 1, scope: !5) - ; CHECK: $x0 = COPY [[COPY]](p0) - ; CHECK: $x1 = COPY [[COPY1]](p0) - ; CHECK: $x2 = COPY [[ZEXT]](s64) - ; CHECK: TCRETURNdi &memcpy, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2 + ; CHECK: $x0 = COPY [[COPY]](p0), debug-location !DILocation(line: 6, column: 1, scope: !5) + ; CHECK: $x1 = COPY [[COPY1]](p0), debug-location !DILocation(line: 6, column: 1, scope: !5) + ; CHECK: $x2 = COPY [[ZEXT]](s64), debug-location !DILocation(line: 6, column: 1, scope: !5) + ; CHECK: TCRETURNdi &memcpy, 0, csr_darwin_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2, debug-location !DILocation(line: 6, column: 1, scope: !5) %0:_(p0) = COPY $x0, debug-location !14 %1:_(p0) = COPY $x1, debug-location !DILocation(line: 3, column: 1, scope: !11) %2:_(s32) = COPY $w2, debug-location !DILocation(line: 4, column: 1, scope: !11) Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-pow.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-pow.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-pow.mir @@ -12,14 +12,14 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $d0 = COPY [[COPY]](s64) ; CHECK: $d1 = COPY [[COPY1]](s64) - ; CHECK: BL &pow, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 + ; CHECK: BL &pow, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY $d0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: $x0 = COPY [[COPY4]](s64) ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[COPY2]](s32) ; CHECK: $s1 = COPY [[COPY3]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: $w0 = COPY [[COPY5]](s32) @@ -52,7 +52,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT]](s32) ; CHECK: $s1 = COPY [[FPEXT1]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY2]](s32) @@ -61,7 +61,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT2]](s32) ; CHECK: $s1 = COPY [[FPEXT3]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC1:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY3]](s32) @@ -70,7 +70,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT4]](s32) ; CHECK: $s1 = COPY [[FPEXT5]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC2:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY4]](s32) @@ -79,7 +79,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT6]](s32) ; CHECK: $s1 = COPY [[FPEXT7]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC3:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY5]](s32) @@ -112,7 +112,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT]](s32) ; CHECK: $s1 = COPY [[FPEXT1]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY2]](s32) @@ -121,7 +121,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT2]](s32) ; CHECK: $s1 = COPY [[FPEXT3]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC1:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY3]](s32) @@ -130,7 +130,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT4]](s32) ; CHECK: $s1 = COPY [[FPEXT5]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC2:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY4]](s32) @@ -139,7 +139,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT6]](s32) ; CHECK: $s1 = COPY [[FPEXT7]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC3:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY5]](s32) @@ -148,7 +148,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT8]](s32) ; CHECK: $s1 = COPY [[FPEXT9]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY6:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC4:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY6]](s32) @@ -157,7 +157,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT10]](s32) ; CHECK: $s1 = COPY [[FPEXT11]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY7:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC5:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY7]](s32) @@ -166,7 +166,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT12]](s32) ; CHECK: $s1 = COPY [[FPEXT13]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY8:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC6:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY8]](s32) @@ -175,7 +175,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[FPEXT14]](s32) ; CHECK: $s1 = COPY [[FPEXT15]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY9:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[FPTRUNC7:%[0-9]+]]:_(s16) = G_FPTRUNC [[COPY9]](s32) @@ -206,13 +206,13 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV]](s32) ; CHECK: $s1 = COPY [[UV2]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV1]](s32) ; CHECK: $s1 = COPY [[UV3]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY2]](s32), [[COPY3]](s32) @@ -242,25 +242,25 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV]](s32) ; CHECK: $s1 = COPY [[UV4]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV1]](s32) ; CHECK: $s1 = COPY [[UV5]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV2]](s32) ; CHECK: $s1 = COPY [[UV6]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[UV3]](s32) ; CHECK: $s1 = COPY [[UV7]](s32) - ; CHECK: BL &powf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &powf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[COPY2]](s32), [[COPY3]](s32), [[COPY4]](s32), [[COPY5]](s32) @@ -290,13 +290,13 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $d0 = COPY [[UV]](s64) ; CHECK: $d1 = COPY [[UV2]](s64) - ; CHECK: BL &pow, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 + ; CHECK: BL &pow, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $d0 = COPY [[UV1]](s64) ; CHECK: $d1 = COPY [[UV3]](s64) - ; CHECK: BL &pow, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 + ; CHECK: BL &pow, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[COPY2]](s64), [[COPY3]](s64) Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-rem.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-rem.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-rem.mir @@ -82,7 +82,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $d0 = COPY [[COPY]](s64) ; CHECK: $d1 = COPY [[COPY1]](s64) - ; CHECK: BL &fmod, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 + ; CHECK: BL &fmod, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit-def $d0 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: $x0 = COPY [[COPY2]](s64) @@ -91,7 +91,7 @@ ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp ; CHECK: $s0 = COPY [[TRUNC]](s32) ; CHECK: $s1 = COPY [[TRUNC1]](s32) - ; CHECK: BL &fmodf, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 + ; CHECK: BL &fmodf, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $s1, implicit-def $s0 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY $s0 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp ; CHECK: $w0 = COPY [[COPY3]](s32) Index: llvm/test/CodeGen/AArch64/GlobalISel/legalize-s128-div.mir =================================================================== --- llvm/test/CodeGen/AArch64/GlobalISel/legalize-s128-div.mir +++ llvm/test/CodeGen/AArch64/GlobalISel/legalize-s128-div.mir @@ -34,7 +34,7 @@ ; CHECK: $x1 = COPY [[UV1]](s64) ; CHECK: $x2 = COPY [[UV2]](s64) ; CHECK: $x3 = COPY [[UV3]](s64) - ; CHECK: BL &__udivti3, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $x3, implicit-def $x0, implicit-def $x1 + ; CHECK: BL &__udivti3, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $x3, implicit-def $x0, implicit-def $x1 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x0 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x1 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY2]](s64), [[COPY3]](s64) @@ -75,7 +75,7 @@ ; CHECK: $x1 = COPY [[UV1]](s64) ; CHECK: $x2 = COPY [[UV2]](s64) ; CHECK: $x3 = COPY [[UV3]](s64) - ; CHECK: BL &__divti3, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $x3, implicit-def $x0, implicit-def $x1 + ; CHECK: BL &__divti3, csr_darwin_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2, implicit $x3, implicit-def $x0, implicit-def $x1 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x0 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY $x1 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[COPY2]](s64), [[COPY3]](s64) Index: llvm/test/CodeGen/AArch64/arm64-darwin-cc.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/AArch64/arm64-darwin-cc.ll @@ -0,0 +1,9 @@ +; RUN: sed -e "s,CC,cfguard_checkcc,g" %s | not --crash llc -mtriple=arm64-apple-darwin -o - 2>&1 | FileCheck %s --check-prefix=CFGUARD +; RUN: sed -e "s,CC,aarch64_sve_vector_pcs,g" %s | not --crash llc -mtriple=arm64-apple-darwin -o - 2>&1 | FileCheck %s --check-prefix=SVE_VECTOR_PCS + +define CC void @f0() { + unreachable +} + +; CFGUARD: Calling convention CFGuard_Check is unsupported on Darwin. +; SVE_VECTOR_PCS: Calling convention SVE_VectorCall is unsupported on Darwin. Index: llvm/test/CodeGen/AArch64/shadow-call-stack.ll =================================================================== --- llvm/test/CodeGen/AArch64/shadow-call-stack.ll +++ llvm/test/CodeGen/AArch64/shadow-call-stack.ll @@ -1,4 +1,7 @@ ; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu -mattr=+reserve-x18 | FileCheck %s +; RUN: not --crash llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-darwin 2>&1 | FileCheck %s --check-prefix=DARWIN + +; DARWIN: ShadowCallStack attribute not supported on Darwin. define void @f1() shadowcallstack { ; CHECK: f1: @@ -54,3 +57,4 @@ %res1 = add i32 %res, 1 ret i32 %res } +