[llvm] [AArch64][Win] Emit SEH instructions for the swift async context-related instructions in the prologue and the epilogue. (PR #66967)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 20:15:41 PDT 2023
================
@@ -1613,11 +1628,22 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
bool HaveInitialContext = Attrs.hasAttrSomewhere(Attribute::SwiftAsync);
if (HaveInitialContext)
MBB.addLiveIn(AArch64::X22);
+ Register Reg = HaveInitialContext ? AArch64::X22 : AArch64::XZR;
BuildMI(MBB, MBBI, DL, TII->get(AArch64::StoreSwiftAsyncContext))
- .addUse(HaveInitialContext ? AArch64::X22 : AArch64::XZR)
+ .addUse(Reg)
.addUse(AArch64::SP)
.addImm(FPOffset - 8)
.setMIFlags(MachineInstr::FrameSetup);
+ if (NeedsWinCFI) {
+ // WinCFI and arm64e, where StoreSwiftAsyncContext is expanded
+ // to multiple instructions, should be mutually-exclusive.
+ assert(Subtarget.getTargetTriple().getArchName() != "arm64e");
+ BuildMI(MBB, MBBI, DL, TII->get(AArch64::SEH_SaveReg))
+ .addImm(RegInfo->getSEHRegNum(Reg))
----------------
efriedma-quic wrote:
Two questions here:
- Does this not explode if "Reg" is xzr? That isn't something I would expect to be supported...
- If we're treating this store as a save of x22, is there a corresponding restore of x22 somewhere?
https://github.com/llvm/llvm-project/pull/66967
More information about the llvm-commits
mailing list