[llvm] [AMDGPU][NFCI] Reorder AGPRs to allow skipping over them (PR #105633)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 05:24:08 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 targets that don't have them.
+ // This cuts about 4000 register (almost half of all registers) off.
+ return MF.getInfo<SIMachineFunctionInfo>()->mayUseAGPRs(MF.getFunction())
----------------
arsenm wrote:
Although actually usesAGPRs should just always be false for the no-AGPR targets, so it should be sufficient
https://github.com/llvm/llvm-project/pull/105633
More information about the llvm-commits
mailing list