diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h index cf1629fda0af..35fb43162199 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h @@ -17,28 +17,17 @@ #include "AMDGPUMachineFunction.h" #include "MCTargetDesc/AMDGPUMCTargetDesc.h" #include "SIInstrInfo.h" -#include "SIRegisterInfo.h" -#include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/SparseBitVector.h" #include "llvm/CodeGen/MIRYamlMapping.h" #include "llvm/CodeGen/PseudoSourceValue.h" -#include "llvm/CodeGen/TargetInstrInfo.h" -#include "llvm/MC/MCRegisterInfo.h" -#include "llvm/Support/ErrorHandling.h" -#include <array> -#include <cassert> -#include <utility> -#include <vector> +#include "llvm/Support/raw_ostream.h" namespace llvm { class MachineFrameInfo; class MachineFunction; class TargetRegisterClass; +class SIMachineFunctionInfo; +class SIRegisterInfo; class AMDGPUPseudoSourceValue : public PseudoSourceValue { public: @@ -76,6 +65,8 @@ public: static bool classof(const PseudoSourceValue *V) { return V->kind() == PSVBuffer; } + + void printCustom(raw_ostream &OS) const override { OS << "BufferResource"; } }; class AMDGPUImagePseudoSourceValue final : public AMDGPUPseudoSourceValue { @@ -87,6 +78,8 @@ public: static bool classof(const PseudoSourceValue *V) { return V->kind() == PSVImage; } + + void printCustom(raw_ostream &OS) const override { OS << "ImageResource"; } }; class AMDGPUGWSResourcePseudoSourceValue final : public AMDGPUPseudoSourceValue { @@ -277,12 +270,18 @@ struct SIMachineFunctionInfo final : public yaml::MachineFunctionInfo { uint64_t ExplicitKernArgSize = 0; unsigned MaxKernArgAlign = 0; unsigned LDSSize = 0; + Align DynLDSAlign; bool IsEntryFunction = false; bool NoSignedZerosFPMath = false; bool MemoryBound = false; bool WaveLimiter = false; + bool HasSpilledSGPRs = false; + bool HasSpilledVGPRs = false; uint32_t HighBitsOf32BitAddress = 0; + // TODO: 10 may be a better default since it's the maximum. + unsigned Occupancy = 0; + StringValue ScratchRSrcReg = "$private_rsrc_reg"; StringValue FrameOffsetReg = "$fp_reg"; StringValue StackPtrOffsetReg = "$sp_reg"; @@ -304,10 +303,13 @@ template <> struct MappingTraits<SIMachineFunctionInfo> { UINT64_C(0)); YamlIO.mapOptional("maxKernArgAlign", MFI.MaxKernArgAlign, 0u); YamlIO.mapOptional("ldsSize", MFI.LDSSize, 0u); + YamlIO.mapOptional("dynLDSAlign", MFI.DynLDSAlign, Align()); YamlIO.mapOptional("isEntryFunction", MFI.IsEntryFunction, false); YamlIO.mapOptional("noSignedZerosFPMath", MFI.NoSignedZerosFPMath, false); YamlIO.mapOptional("memoryBound", MFI.MemoryBound, false); YamlIO.mapOptional("waveLimiter", MFI.WaveLimiter, false); + YamlIO.mapOptional("hasSpilledSGPRs", MFI.HasSpilledSGPRs, false); + YamlIO.mapOptional("hasSpilledVGPRs", MFI.HasSpilledVGPRs, false); YamlIO.mapOptional("scratchRSrcReg", MFI.ScratchRSrcReg, StringValue("$private_rsrc_reg")); YamlIO.mapOptional("frameOffsetReg", MFI.FrameOffsetReg, @@ -318,6 +320,7 @@ template <> struct MappingTraits<SIMachineFunctionInfo> { YamlIO.mapOptional("mode", MFI.Mode, SIMode()); YamlIO.mapOptional("highBitsOf32BitAddress", MFI.HighBitsOf32BitAddress, 0u); + YamlIO.mapOptional("occupancy", MFI.Occupancy, 0); } }; @@ -370,10 +373,8 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction { // unit. Minimum - first, maximum - second. std::pair<unsigned, unsigned> WavesPerEU = {0, 0}; - DenseMap<const Value *, - std::unique_ptr<const AMDGPUBufferPseudoSourceValue>> BufferPSVs; - DenseMap<const Value *, - std::unique_ptr<const AMDGPUImagePseudoSourceValue>> ImagePSVs; + std::unique_ptr<const AMDGPUBufferPseudoSourceValue> BufferPSV; + std::unique_ptr<const AMDGPUImagePseudoSourceValue> ImagePSV; std::unique_ptr<const AMDGPUGWSResourcePseudoSourceValue> GWSResourcePSV; private: @@ -684,9 +685,9 @@ public: return ArgInfo.getPreloadedValue(Value); } - Register getPreloadedReg(AMDGPUFunctionArgInfo::PreloadedValue Value) const { + MCRegister getPreloadedReg(AMDGPUFunctionArgInfo::PreloadedValue Value) const { auto Arg = std::get<0>(ArgInfo.getPreloadedValue(Value)); - return Arg ? Arg->getRegister() : Register(); + return Arg ? Arg->getRegister() : MCRegister(); } unsigned getGITPtrHigh() const { @@ -884,22 +885,18 @@ public: return LDSWaveSpillSize; } - const AMDGPUBufferPseudoSourceValue *getBufferPSV(const SIInstrInfo &TII, - const Value *BufferRsrc) { - assert(BufferRsrc); - auto PSV = BufferPSVs.try_emplace( - BufferRsrc, - std::make_unique<AMDGPUBufferPseudoSourceValue>(TII)); - return PSV.first->second.get(); + const AMDGPUBufferPseudoSourceValue *getBufferPSV(const SIInstrInfo &TII) { + if (!BufferPSV) + BufferPSV = std::make_unique<AMDGPUBufferPseudoSourceValue>(TII); + + return BufferPSV.get(); } - const AMDGPUImagePseudoSourceValue *getImagePSV(const SIInstrInfo &TII, - const Value *ImgRsrc) { - assert(ImgRsrc); - auto PSV = ImagePSVs.try_emplace( - ImgRsrc, - std::make_unique<AMDGPUImagePseudoSourceValue>(TII)); - return PSV.first->second.get(); + const AMDGPUImagePseudoSourceValue *getImagePSV(const SIInstrInfo &TII) { + if (!ImagePSV) + ImagePSV = std::make_unique<AMDGPUImagePseudoSourceValue>(TII); + + return ImagePSV.get(); } const AMDGPUGWSResourcePseudoSourceValue *getGWSPSV(const SIInstrInfo &TII) { |
