[llvm] [RISCV] Correct the limit of RegPresureSet `GPRAll` (PR #118473)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 08:39:15 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);
----------------
wangpc-pp wrote:
> RegisterClassInfo has computePSetLimit, is something not using that?
Yes, please see my comment above. `TargetRegisterInfo::getRegPressureSetLimit` is used directly in MachineLICM, MachineSink, MachinePipeliner, etc.
https://github.com/llvm/llvm-project/pull/118473
More information about the llvm-commits
mailing list