[llvm] [RISCV] Correct the limit of RegPresureSet `GPRAll` (PR #118473)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 4 08:33:26 PST 2024


================
@@ -934,3 +934,17 @@ bool RISCVRegisterInfo::getRegAllocationHints(
 
   return BaseImplRetVal;
 }
+
+unsigned RISCVRegisterInfo::getRegPressureSetLimit(const MachineFunction &MF,
+                                                   unsigned Idx) const {
+  if (Idx == RISCV::RegisterPressureSets::GPRAll) {
+    unsigned Reserved = 0;
+    BitVector ReservedRegs = getReservedRegs(MF);
+    for (MCPhysReg Reg = RISCV::X0_H; Reg <= RISCV::X31_H; Reg++)
+      if (ReservedRegs.test(Reg))
+        Reserved++;
+
+    return 32 - Reserved;
+  }
+  return RISCVGenRegisterInfo::getRegPressureSetLimit(MF, Idx);
----------------
arsenm wrote:

RegisterClassInfo has computePSetLimit, is something not using that?

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


More information about the llvm-commits mailing list