[PATCH] D119912: Hoist getTotalNumVGPRs into AMDGPUBaseInfo for use in both codegen and MC
Jacob Lambert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 19:12:04 PST 2022
lamb-j created this revision.
lamb-j added reviewers: kzhuravl, arsenm, rampitec.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely.
lamb-j requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119912
Files:
llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
===================================================================
--- llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+++ llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
@@ -775,6 +775,8 @@
bool hasGFX10_3Insts(const MCSubtargetInfo &STI);
bool isGFX90A(const MCSubtargetInfo &STI);
bool hasArchitectedFlatScratch(const MCSubtargetInfo &STI);
+int getTotalNumVGPRs(bool has90AInsts, int32_t ArgNumAGPR,
+ int32_t ArgNumVGPR);
/// Is Reg - scalar register
bool isSGPR(unsigned Reg, const MCRegisterInfo* TRI);
Index: llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+++ llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
@@ -1521,6 +1521,13 @@
return STI.getFeatureBits()[AMDGPU::FeatureArchitectedFlatScratch];
}
+int32_t getTotalNumVGPRs(bool has90AInsts, int32_t ArgNumAGPR,
+ int32_t ArgNumVGPR) {
+ if (has90AInsts && ArgNumAGPR)
+ return alignTo(ArgNumVGPR, 4) + ArgNumAGPR;
+ return std::max(ArgNumVGPR, ArgNumAGPR);
+}
+
bool isSGPR(unsigned Reg, const MCRegisterInfo* TRI) {
const MCRegisterClass SGPRClass = TRI->getRegClass(AMDGPU::SReg_32RegClassID);
const unsigned FirstSubReg = TRI->getSubReg(Reg, AMDGPU::sub0);
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -87,9 +87,8 @@
int32_t AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::getTotalNumVGPRs(
const GCNSubtarget &ST, int32_t ArgNumAGPR, int32_t ArgNumVGPR) const {
- if (ST.hasGFX90AInsts() && ArgNumAGPR)
- return alignTo(ArgNumVGPR, 4) + ArgNumAGPR;
- return std::max(ArgNumVGPR, ArgNumAGPR);
+ return llvm::AMDGPU::getTotalNumVGPRs(
+ ST.hasGFX90AInsts(), ArgNumAGPR, ArgNumVGPR);
}
int32_t AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo::getTotalNumVGPRs(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119912.409121.patch
Type: text/x-patch
Size: 2096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/8b04003b/attachment.bin>
More information about the llvm-commits
mailing list