[llvm] [AMDGPU] Support block load/store for CSR (PR #130013)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 21:06:32 PDT 2025


================
@@ -1694,6 +1694,106 @@ void SIFrameLowering::determineCalleeSavesSGPR(MachineFunction &MF,
   }
 }
 
+static void assignSlotsUsingVGPRBlocks(MachineFunction &MF,
+                                       const GCNSubtarget &ST,
+                                       std::vector<CalleeSavedInfo> &CSI,
+                                       unsigned &MinCSFrameIndex,
+                                       unsigned &MaxCSFrameIndex) {
+  SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
+  MachineFrameInfo &MFI = MF.getFrameInfo();
+  const SIInstrInfo *TII = ST.getInstrInfo();
+  const SIRegisterInfo *TRI = ST.getRegisterInfo();
+
+  assert(std::is_sorted(CSI.begin(), CSI.end(),
+                        [](const CalleeSavedInfo &A, const CalleeSavedInfo &B) {
+                          return A.getReg() < B.getReg();
+                        }) &&
+         "Callee saved registers not sorted");
+
+  auto CanUseBlockOps = [&](const CalleeSavedInfo &CSI) {
+    return !CSI.isSpilledToReg() &&
+           TRI->isVGPR(MF.getRegInfo(), CSI.getReg()) &&
----------------
arsenm wrote:

This can't be a vreg, might as well directly check if the physreg is a VGPR 

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


More information about the llvm-commits mailing list