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 unsigned WavefrontSize;
68 AMDGPUFrameLowering FrameLowering;
69 std::unique_ptr<AMDGPUTargetLowering> TLInfo;
70 std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
71 InstrItineraryData InstrItins;
74 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS, TargetMachine &TM);
75 AMDGPUSubtarget &initializeSubtargetDependencies(StringRef GPU, StringRef FS);
77 const AMDGPUFrameLowering *getFrameLowering() const override {
78 return &FrameLowering;
80 const AMDGPUInstrInfo *getInstrInfo() const override {
81 return InstrInfo.get();
83 const AMDGPURegisterInfo *getRegisterInfo() const override {
84 return &InstrInfo->getRegisterInfo();
86 AMDGPUTargetLowering *getTargetLowering() const override {
89 const DataLayout *getDataLayout() const override { return &DL; }
90 const InstrItineraryData *getInstrItineraryData() const override {
94 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
96 bool is64bit() const {
100 bool hasVertexCache() const {
101 return HasVertexCache;
104 short getTexVTXClauseSize() const {
105 return TexVTXClauseSize;
108 Generation getGeneration() const {
112 bool hasHWFP64() const {
116 bool hasCaymanISA() const {
120 bool hasFP32Denormals() const {
121 return FP32Denormals;
124 bool hasFP64Denormals() const {
125 return FP64Denormals;
128 bool hasFlatAddressSpace() const {
129 return FlatAddressSpace;
132 bool hasBFE() const {
133 return (getGeneration() >= EVERGREEN);
136 bool hasBFI() const {
137 return (getGeneration() >= EVERGREEN);
140 bool hasBFM() const {
144 bool hasBCNT(unsigned Size) const {
146 return (getGeneration() >= EVERGREEN);
149 return (getGeneration() >= SOUTHERN_ISLANDS);
154 bool hasMulU24() const {
155 return (getGeneration() >= EVERGREEN);
158 bool hasMulI24() const {
159 return (getGeneration() >= SOUTHERN_ISLANDS ||
163 bool hasFFBL() const {
164 return (getGeneration() >= EVERGREEN);
167 bool hasFFBH() const {
168 return (getGeneration() >= EVERGREEN);
171 bool IsIRStructurizerEnabled() const {
172 return EnableIRStructurizer;
175 bool isPromoteAllocaEnabled() const {
176 return EnablePromoteAlloca;
179 bool isIfCvtEnabled() const {
183 unsigned getWavefrontSize() const {
184 return WavefrontSize;
187 unsigned getStackEntrySize() const;
189 bool hasCFAluBug() const {
190 assert(getGeneration() <= NORTHERN_ISLANDS);
194 int getLocalMemorySize() const {
195 return LocalMemorySize;
198 bool enableMachineScheduler() const override {
199 return getGeneration() <= NORTHERN_ISLANDS;
202 // Helper functions to simplify if statements
203 bool isTargetELF() const {
207 StringRef getDeviceName() const {
211 bool dumpCode() const {
214 bool r600ALUEncoding() const {
219 } // End namespace llvm