[PATCH] D123963: AMDGPU: Make PSV instances static members

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 14:56:32 PDT 2022


arsenm created this revision.
arsenm added a reviewer: AMDGPU.
Herald added subscribers: hsmhsm, foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

I don't think this is exactly kosher, but allows us to use the default
copy constructor for MFI instances. Technically these depend on
per-function state since TII is per subtarget, and therefore
per-function. However, TII is only used for one target hook with no
subtarget dependent behavior (which probably should be moved to the
TargetMachine). This also introduces global destructors.


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
@@ -388,9 +388,10 @@
   // 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;
+  static std::unique_ptr<const AMDGPUBufferPseudoSourceValue> BufferPSV;
+  static std::unique_ptr<const AMDGPUImagePseudoSourceValue> ImagePSV;
+  static std::unique_ptr<const AMDGPUGWSResourcePseudoSourceValue>
+      GWSResourcePSV;
 
 private:
   unsigned NumUserSGPRs = 0;
Index: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -29,6 +29,13 @@
 
 using namespace llvm;
 
+std::unique_ptr<const AMDGPUBufferPseudoSourceValue>
+    SIMachineFunctionInfo::BufferPSV;
+std::unique_ptr<const AMDGPUImagePseudoSourceValue>
+    SIMachineFunctionInfo::ImagePSV;
+std::unique_ptr<const AMDGPUGWSResourcePseudoSourceValue>
+    SIMachineFunctionInfo::GWSResourcePSV;
+
 SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
   : AMDGPUMachineFunction(MF),
     PrivateSegmentBuffer(false),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123963.423477.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220418/bbb6d44d/attachment.bin>


More information about the llvm-commits mailing list