[llvm] cfe5168 - AMDGPU: Make PSV instances static members
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 07:14:53 PDT 2022
Author: Matt Arsenault
Date: 2022-06-07T10:14:48-04:00
New Revision: cfe516849907da762c40d7dea2b6c2256d264c48
URL: https://github.com/llvm/llvm-project/commit/cfe516849907da762c40d7dea2b6c2256d264c48
DIFF: https://github.com/llvm/llvm-project/commit/cfe516849907da762c40d7dea2b6c2256d264c48.diff
LOG: AMDGPU: Make PSV instances static members
Added:
Modified:
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
index d0772602a98d..32c2059261bc 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -31,6 +31,9 @@ using namespace llvm;
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),
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
index 19338596e3b0..75a4b8ecdcd7 100644
--- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
@@ -389,9 +389,9 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction {
// 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;
@@ -923,27 +923,17 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction {
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 {
More information about the llvm-commits
mailing list