[llvm] [AMDGPU][NFCI] Reorder AGPRs to allow skipping over them (PR #105633)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 02:20:41 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())
----------------
Pierre-vh wrote:
Not sure how reliable this check is, maybe it should also check for a target feature ?
https://github.com/llvm/llvm-project/pull/105633
More information about the llvm-commits
mailing list