1 //=====-- AMDGPUSubtarget.h - Define Subtarget for the AMDIL ---*- C++ -*-====//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //==-----------------------------------------------------------------------===//
11 /// \brief AMDGPU specific subclass of TargetSubtarget.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_R600_AMDGPUSUBTARGET_H
16 #define LLVM_LIB_TARGET_R600_AMDGPUSUBTARGET_H
18 #include "AMDGPUFrameLowering.h"
19 #include "AMDGPUInstrInfo.h"
20 #include "AMDGPUIntrinsicInfo.h"
21 #include "AMDGPUSubtarget.h"
22 #include "R600ISelLowering.h"
23 #include "llvm/ADT/StringExtras.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/IR/DataLayout.h"
26 #include "llvm/Target/TargetSubtargetInfo.h"
28 #define GET_SUBTARGETINFO_HEADER
29 #include "AMDGPUGenSubtargetInfo.inc"
33 class SIMachineFunctionInfo;
35 class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
54 short TexVTXClauseSize;
60 bool FlatAddressSpace;
61 bool EnableIRStructurizer;
62 bool EnablePromoteAlloca;
64 bool EnableLoadStoreOpt;
65 unsigned WavefrontSize;
68 bool EnableVGPRSpilling;
71 AMDGPUFrameLowering FrameLowering;
72 std::unique_ptr<AMDGPUTargetLowering> TLInfo;
73 std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
74 InstrItineraryData InstrItins;
78 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS, TargetMachine &TM);
79 AMDGPUSubtarget &initializeSubtargetDependencies(StringRef GPU, StringRef FS);
81 // FIXME: This routine needs to go away. See comments in
82 // AMDGPUTargetMachine.h.
83 const DataLayout *getDataLayout() const { return &DL; }
85 const AMDGPUFrameLowering *getFrameLowering() const override {
86 return &FrameLowering;
88 const AMDGPUInstrInfo *getInstrInfo() const override {
89 return InstrInfo.get();
91 const AMDGPURegisterInfo *getRegisterInfo() const override {
92 return &InstrInfo->getRegisterInfo();
94 AMDGPUTargetLowering *getTargetLowering() const override {
97 const InstrItineraryData *getInstrItineraryData() const override {
101 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
103 bool is64bit() const {
107 bool hasVertexCache() const {
108 return HasVertexCache;
111 short getTexVTXClauseSize() const {
112 return TexVTXClauseSize;
115 Generation getGeneration() const {
119 bool hasHWFP64() const {
123 bool hasCaymanISA() const {
127 bool hasFP32Denormals() const {
128 return FP32Denormals;
131 bool hasFP64Denormals() const {
132 return FP64Denormals;
135 bool hasFlatAddressSpace() const {
136 return FlatAddressSpace;
139 bool hasBFE() const {
140 return (getGeneration() >= EVERGREEN);
143 bool hasBFI() const {
144 return (getGeneration() >= EVERGREEN);
147 bool hasBFM() const {
151 bool hasBCNT(unsigned Size) const {
153 return (getGeneration() >= EVERGREEN);
156 return (getGeneration() >= SOUTHERN_ISLANDS);
161 bool hasMulU24() const {
162 return (getGeneration() >= EVERGREEN);
165 bool hasMulI24() const {
166 return (getGeneration() >= SOUTHERN_ISLANDS ||
170 bool hasFFBL() const {
171 return (getGeneration() >= EVERGREEN);
174 bool hasFFBH() const {
175 return (getGeneration() >= EVERGREEN);
178 bool IsIRStructurizerEnabled() const {
179 return EnableIRStructurizer;
182 bool isPromoteAllocaEnabled() const {
183 return EnablePromoteAlloca;
186 bool isIfCvtEnabled() const {
190 bool loadStoreOptEnabled() const {
191 return EnableLoadStoreOpt;
194 unsigned getWavefrontSize() const {
195 return WavefrontSize;
198 unsigned getStackEntrySize() const;
200 bool hasCFAluBug() const {
201 assert(getGeneration() <= NORTHERN_ISLANDS);
205 int getLocalMemorySize() const {
206 return LocalMemorySize;
209 unsigned getAmdKernelCodeChipID() const;
211 bool enableMachineScheduler() const override {
212 return getGeneration() <= NORTHERN_ISLANDS;
215 // Helper functions to simplify if statements
216 bool isTargetELF() const {
220 StringRef getDeviceName() const {
224 bool dumpCode() const {
227 bool r600ALUEncoding() const {
230 bool isAmdHsaOS() const {
231 return TargetTriple.getOS() == Triple::AMDHSA;
233 bool isVGPRSpillingEnabled(const SIMachineFunctionInfo *MFI) const;
236 } // End namespace llvm