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/IR/DataLayout.h"
24 #include "llvm/ADT/StringExtras.h"
25 #include "llvm/ADT/StringRef.h"
26 #include "llvm/Target/TargetSubtargetInfo.h"
28 #define GET_SUBTARGETINFO_HEADER
29 #include "AMDGPUGenSubtargetInfo.inc"
31 #define MAX_CB_SIZE (1 << 16)
35 class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
53 short TexVTXClauseSize;
59 bool FlatAddressSpace;
60 bool EnableIRStructurizer;
61 bool EnablePromoteAlloca;
63 bool EnableLoadStoreOpt;
64 unsigned WavefrontSize;
69 AMDGPUFrameLowering FrameLowering;
70 std::unique_ptr<AMDGPUTargetLowering> TLInfo;
71 std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
72 InstrItineraryData InstrItins;
75 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS, TargetMachine &TM);
76 AMDGPUSubtarget &initializeSubtargetDependencies(StringRef GPU, StringRef FS);
78 const AMDGPUFrameLowering *getFrameLowering() const override {
79 return &FrameLowering;
81 const AMDGPUInstrInfo *getInstrInfo() const override {
82 return InstrInfo.get();
84 const AMDGPURegisterInfo *getRegisterInfo() const override {
85 return &InstrInfo->getRegisterInfo();
87 AMDGPUTargetLowering *getTargetLowering() const override {
90 const DataLayout *getDataLayout() const override { return &DL; }
91 const InstrItineraryData *getInstrItineraryData() const override {
95 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
97 bool is64bit() const {
101 bool hasVertexCache() const {
102 return HasVertexCache;
105 short getTexVTXClauseSize() const {
106 return TexVTXClauseSize;
109 Generation getGeneration() const {
113 bool hasHWFP64() const {
117 bool hasCaymanISA() const {
121 bool hasFP32Denormals() const {
122 return FP32Denormals;
125 bool hasFP64Denormals() const {
126 return FP64Denormals;
129 bool hasFlatAddressSpace() const {
130 return FlatAddressSpace;
133 bool hasBFE() const {
134 return (getGeneration() >= EVERGREEN);
137 bool hasBFI() const {
138 return (getGeneration() >= EVERGREEN);
141 bool hasBFM() const {
145 bool hasBCNT(unsigned Size) const {
147 return (getGeneration() >= EVERGREEN);
150 return (getGeneration() >= SOUTHERN_ISLANDS);
155 bool hasMulU24() const {
156 return (getGeneration() >= EVERGREEN);
159 bool hasMulI24() const {
160 return (getGeneration() >= SOUTHERN_ISLANDS ||
164 bool hasFFBL() const {
165 return (getGeneration() >= EVERGREEN);
168 bool hasFFBH() const {
169 return (getGeneration() >= EVERGREEN);
172 bool IsIRStructurizerEnabled() const {
173 return EnableIRStructurizer;
176 bool isPromoteAllocaEnabled() const {
177 return EnablePromoteAlloca;
180 bool isIfCvtEnabled() const {
184 bool loadStoreOptEnabled() const {
185 return EnableLoadStoreOpt;
188 unsigned getWavefrontSize() const {
189 return WavefrontSize;
192 unsigned getStackEntrySize() const;
194 bool hasCFAluBug() const {
195 assert(getGeneration() <= NORTHERN_ISLANDS);
199 int getLocalMemorySize() const {
200 return LocalMemorySize;
203 bool enableMachineScheduler() const override {
204 return getGeneration() <= NORTHERN_ISLANDS;
207 // Helper functions to simplify if statements
208 bool isTargetELF() const {
212 StringRef getDeviceName() const {
216 bool dumpCode() const {
219 bool r600ALUEncoding() const {
224 } // End namespace llvm