[PATCH] D123963: AMDGPU: Make PSV instances static members
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 07:39:58 PDT 2022
arsenm updated this revision to Diff 433397.
arsenm added a comment.
Herald added subscribers: kosarev, jsilvanus.
Don't use unique_ptr since it's no longer dependent on the subtarget
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123963/new/
https://reviews.llvm.org/D123963
Files:
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
Index: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
===================================================================
--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
+++ llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
@@ -389,9 +389,9 @@
// unit. Minimum - first, maximum - second.
std::pair<unsigned, unsigned> WavesPerEU = {0, 0};
- std::unique_ptr<const AMDGPUBufferPseudoSourceValue> BufferPSV;
- std::unique_ptr<const AMDGPUImagePseudoSourceValue> ImagePSV;
- std::unique_ptr<const AMDGPUGWSResourcePseudoSourceValue> GWSResourcePSV;
+ const AMDGPUBufferPseudoSourceValue BufferPSV;
+ const AMDGPUImagePseudoSourceValue ImagePSV;
+ const AMDGPUGWSResourcePseudoSourceValue GWSResourcePSV;
private:
unsigned NumUserSGPRs = 0;
@@ -932,27 +932,17 @@
const AMDGPUBufferPseudoSourceValue *
getBufferPSV(const AMDGPUTargetMachine &TM) {
- if (!BufferPSV)
- BufferPSV = std::make_unique<AMDGPUBufferPseudoSourceValue>(TM);
-
- return BufferPSV.get();
+ return &BufferPSV;
}
const AMDGPUImagePseudoSourceValue *
getImagePSV(const AMDGPUTargetMachine &TM) {
- if (!ImagePSV)
- ImagePSV = std::make_unique<AMDGPUImagePseudoSourceValue>(TM);
-
- return ImagePSV.get();
+ return &ImagePSV;
}
const AMDGPUGWSResourcePseudoSourceValue *
getGWSPSV(const AMDGPUTargetMachine &TM) {
- if (!GWSResourcePSV) {
- GWSResourcePSV = std::make_unique<AMDGPUGWSResourcePseudoSourceValue>(TM);
- }
-
- return GWSResourcePSV.get();
+ return &GWSResourcePSV;
}
unsigned getOccupancy() const {
Index: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -31,6 +31,9 @@
SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
: AMDGPUMachineFunction(MF),
+ BufferPSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
+ ImagePSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
+ GWSResourcePSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
PrivateSegmentBuffer(false),
DispatchPtr(false),
QueuePtr(false),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123963.433397.patch
Type: text/x-patch
Size: 2241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/7d20a796/attachment.bin>
More information about the llvm-commits
mailing list