================
@@ -241,9 +314,34 @@ class PrologEpilogSGPRSpillBuilder {
   ArrayRef<int16_t> SplitParts;
   unsigned NumSubRegs;
   unsigned EltSize = 4;
+  bool IsFramePtrPrologSpill;
+  bool NeedsFrameMoves;
+
+  static bool isExec(Register Reg) {
+    return Reg == AMDGPU::EXEC_LO || Reg == AMDGPU::EXEC;
+  }
+
+  /// If this builder requires SuperReg-based CFI, which is emitted after all
+  /// SubRegs are actually spilled, return the Register which should be used
+  /// as input to getDwarfRegNum. Otherwise, CFI should be generated 
per-SubReg.
+  ///
+  /// Note: Most spills handled by this builder generate CFI after each
+  /// SubReg spill, as each SubReg maps directly to a CFI register via
+  /// getDwarfRegNum(SubReg, false). All other cases currently currently
+  /// correspond to the SuperReg directly.
+  std::optional<Register> getCFISuperReg() const {
+    if (IsFramePtrPrologSpill)
+      return FuncInfo->getFrameOffsetReg();
+    // FIXME: CFI for EXEC needs a fix by accurately computing the spill
+    // offset for both the low and high components.
+    if (isExec(SuperReg))
+      return AMDGPU::EXEC;
+    return std::nullopt;
----------------
arsenm wrote:

```suggestion
  MCRegister getCFISuperReg() const {
    if (IsFramePtrPrologSpill)
      return FuncInfo->getFrameOffsetReg();
    // FIXME: CFI for EXEC needs a fix by accurately computing the spill
    // offset for both the low and high components.
    if (isExec(SuperReg))
      return AMDGPU::EXEC;
    return {};
```

https://github.com/llvm/llvm-project/pull/164723
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to