[clang] [llvm] [AArch64][SME] Save VG for unwind info when changing streaming-mode (PR #83301)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 07:54:13 PDT 2024


================
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
    case AArch64::COALESCER_BARRIER_FPR128:
      MI.eraseFromParent();
      return true;
+   case AArch64::VGSavePseudo:
+   case AArch64::VGRestorePseudo: {
+     MachineFunction &MF = *MBB.getParent();
+     SMEAttrs FuncAttrs(MF.getFunction());
+     bool LocallyStreaming =
+         FuncAttrs.hasStreamingBody() && !FuncAttrs.hasStreamingInterface();
+     const AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
+
+     if (!AFI->requiresVGSpill(MF))
+       return false;
+
+     int64_t VGFrameIdx =
+         LocallyStreaming ? AFI->getStreamingVGIdx() : AFI->getVGIdx();
+     assert(VGFrameIdx != std::numeric_limits<int>::max() &&
+            "Expected FrameIdx for VG");
+
+     const TargetSubtargetInfo &STI = MF.getSubtarget();
+     const TargetInstrInfo &TII = *STI.getInstrInfo();
----------------
sdesmalen-arm wrote:

nit: `TII` is already available as a member of `AArch64ExpandPseudo`, no need to get it again.

https://github.com/llvm/llvm-project/pull/83301


More information about the llvm-commits mailing list