Skip to content

Commit cfe5168

Browse files
committed
AMDGPU: Make PSV instances static members
1 parent 222bd83 commit cfe5168

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ using namespace llvm;
3131

3232
SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
3333
: AMDGPUMachineFunction(MF),
34+
BufferPSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
35+
ImagePSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
36+
GWSResourcePSV(static_cast<const AMDGPUTargetMachine &>(MF.getTarget())),
3437
PrivateSegmentBuffer(false),
3538
DispatchPtr(false),
3639
QueuePtr(false),

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction {
389389
// unit. Minimum - first, maximum - second.
390390
std::pair<unsigned, unsigned> WavesPerEU = {0, 0};
391391

392-
std::unique_ptr<const AMDGPUBufferPseudoSourceValue> BufferPSV;
393-
std::unique_ptr<const AMDGPUImagePseudoSourceValue> ImagePSV;
394-
std::unique_ptr<const AMDGPUGWSResourcePseudoSourceValue> GWSResourcePSV;
392+
const AMDGPUBufferPseudoSourceValue BufferPSV;
393+
const AMDGPUImagePseudoSourceValue ImagePSV;
394+
const AMDGPUGWSResourcePseudoSourceValue GWSResourcePSV;
395395

396396
private:
397397
unsigned NumUserSGPRs = 0;
@@ -923,27 +923,17 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction {
923923

924924
const AMDGPUBufferPseudoSourceValue *
925925
getBufferPSV(const AMDGPUTargetMachine &TM) {
926-
if (!BufferPSV)
927-
BufferPSV = std::make_unique<AMDGPUBufferPseudoSourceValue>(TM);
928-
929-
return BufferPSV.get();
926+
return &BufferPSV;
930927
}
931928

932929
const AMDGPUImagePseudoSourceValue *
933930
getImagePSV(const AMDGPUTargetMachine &TM) {
934-
if (!ImagePSV)
935-
ImagePSV = std::make_unique<AMDGPUImagePseudoSourceValue>(TM);
936-
937-
return ImagePSV.get();
931+
return &ImagePSV;
938932
}
939933

940934
const AMDGPUGWSResourcePseudoSourceValue *
941935
getGWSPSV(const AMDGPUTargetMachine &TM) {
942-
if (!GWSResourcePSV) {
943-
GWSResourcePSV = std::make_unique<AMDGPUGWSResourcePseudoSourceValue>(TM);
944-
}
945-
946-
return GWSResourcePSV.get();
936+
return &GWSResourcePSV;
947937
}
948938

949939
unsigned getOccupancy() const {

0 commit comments

Comments
 (0)