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 AMDGPUSUBTARGET_H
16 #define 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 EnableIRStructurizer;
60 bool EnablePromoteAlloca;
62 unsigned WavefrontSize;
67 AMDGPUFrameLowering FrameLowering;
68 std::unique_ptr<AMDGPUTargetLowering> TLInfo;
69 std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
70 InstrItineraryData InstrItins;
73 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS, TargetMachine &TM);
74 AMDGPUSubtarget &initializeSubtargetDependencies(StringRef GPU, StringRef FS);
76 const AMDGPUFrameLowering *getFrameLowering() const override {
77 return &FrameLowering;
79 const AMDGPUInstrInfo *getInstrInfo() const override {
80 return InstrInfo.get();
82 const AMDGPURegisterInfo *getRegisterInfo() const override {
83 return &InstrInfo->getRegisterInfo();
85 AMDGPUTargetLowering *getTargetLowering() const override {
88 const DataLayout *getDataLayout() const override { return &DL; }
89 const InstrItineraryData *getInstrItineraryData() const override {
93 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
95 bool is64bit() const {
99 bool hasVertexCache() const {
100 return HasVertexCache;
103 short getTexVTXClauseSize() const {
104 return TexVTXClauseSize;
107 Generation getGeneration() const {
111 bool hasHWFP64() const {
115 bool hasCaymanISA() const {
119 bool hasFP32Denormals() const {
120 return FP32Denormals;
123 bool hasFP64Denormals() const {
124 return FP64Denormals;
127 bool hasBFE() const {
128 return (getGeneration() >= EVERGREEN);
131 bool hasBFI() const {
132 return (getGeneration() >= EVERGREEN);
135 bool hasBFM() const {
139 bool hasBCNT(unsigned Size) const {
141 return (getGeneration() >= EVERGREEN);
144 return (getGeneration() >= SOUTHERN_ISLANDS);
149 bool hasMulU24() const {
150 return (getGeneration() >= EVERGREEN);
153 bool hasMulI24() const {
154 return (getGeneration() >= SOUTHERN_ISLANDS ||
158 bool hasFFBL() const {
159 return (getGeneration() >= EVERGREEN);
162 bool hasFFBH() const {
163 return (getGeneration() >= EVERGREEN);
166 bool IsIRStructurizerEnabled() const {
167 return EnableIRStructurizer;
170 bool isPromoteAllocaEnabled() const {
171 return EnablePromoteAlloca;
174 bool isIfCvtEnabled() const {
178 unsigned getWavefrontSize() const {
179 return WavefrontSize;
182 unsigned getStackEntrySize() const;
184 bool hasCFAluBug() const {
185 assert(getGeneration() <= NORTHERN_ISLANDS);
189 int getLocalMemorySize() const {
190 return LocalMemorySize;
193 bool enableMachineScheduler() const override {
194 return getGeneration() <= NORTHERN_ISLANDS;
197 // Helper functions to simplify if statements
198 bool isTargetELF() const {
202 StringRef getDeviceName() const {
206 bool dumpCode() const {
209 bool r600ALUEncoding() const {
214 } // End namespace llvm
216 #endif // AMDGPUSUBTARGET_H