[llvm] [AMDGPU][NFCI] Reorder AGPRs to allow skipping over them (PR #105633)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 12:05:16 PDT 2024
================
@@ -3365,6 +3365,24 @@ SIRegisterInfo::getConstrainedRegClassForOperand(const MachineOperand &MO,
return nullptr;
}
+unsigned SIRegisterInfo::getNumSupportedRegs(const MachineFunction &MF) const {
+#ifndef NDEBUG
+ for (unsigned K = AMDGPU::AGPR0; K < AMDGPU::NUM_TARGET_REGS; ++K) {
+ // Skip lo16 registers, they're "fake" and don't have a regclass assigned.
+ if (K >= AMDGPU::AGPR0_HI16 && K <= AMDGPU::AGPR255_HI16)
+ continue;
+ if (!isAGPR(MF.getRegInfo(), K))
+ report_fatal_error("register at index " + Twine(K) + " is not an AGPR!");
+ }
+#endif
+
+ // Don't include AGPRs on functions that don't have them.
+ // This cuts about 4000 register (almost half of all registers) off.
+ return ST.hasMAIInsts() && MF.getInfo<SIMachineFunctionInfo>()->usesAGPRs(MF)
----------------
arsenm wrote:
I would hope hasMAIInsts is redundant with usesAGPRs, but this check is a mess anyway
https://github.com/llvm/llvm-project/pull/105633
More information about the llvm-commits
mailing list