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 "AMDGPUInstrInfo.h"
19 #include "llvm/ADT/StringExtras.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Target/TargetSubtargetInfo.h"
23 #define GET_SUBTARGETINFO_HEADER
24 #include "AMDGPUGenSubtargetInfo.inc"
26 #define MAX_CB_SIZE (1 << 16)
30 class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
32 std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
50 short TexVTXClauseSize;
56 bool EnableIRStructurizer;
57 bool EnablePromoteAlloca;
59 unsigned WavefrontSize;
63 InstrItineraryData InstrItins;
66 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
68 const AMDGPUInstrInfo *getInstrInfo() const {
69 return InstrInfo.get();
72 const InstrItineraryData &getInstrItineraryData() const {
76 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
78 bool is64bit() const {
82 bool hasVertexCache() const {
83 return HasVertexCache;
86 short getTexVTXClauseSize() const {
87 return TexVTXClauseSize;
90 Generation getGeneration() const {
94 bool hasHWFP64() const {
98 bool hasCaymanISA() const {
102 bool hasFP32Denormals() const {
103 return FP32Denormals;
106 bool hasFP64Denormals() const {
107 return FP64Denormals;
110 bool hasBFE() const {
111 return (getGeneration() >= EVERGREEN);
114 bool hasBFI() const {
115 return (getGeneration() >= EVERGREEN);
118 bool hasBFM() const {
122 bool hasBCNT(unsigned Size) const {
124 return (getGeneration() >= EVERGREEN);
127 return (getGeneration() >= SOUTHERN_ISLANDS);
130 bool hasMulU24() const {
131 return (getGeneration() >= EVERGREEN);
134 bool hasMulI24() const {
135 return (getGeneration() >= SOUTHERN_ISLANDS ||
139 bool IsIRStructurizerEnabled() const {
140 return EnableIRStructurizer;
143 bool isPromoteAllocaEnabled() const {
144 return EnablePromoteAlloca;
147 bool isIfCvtEnabled() const {
151 unsigned getWavefrontSize() const {
152 return WavefrontSize;
155 unsigned getStackEntrySize() const;
157 bool hasCFAluBug() const {
158 assert(getGeneration() <= NORTHERN_ISLANDS);
162 int getLocalMemorySize() const {
163 return LocalMemorySize;
166 bool enableMachineScheduler() const override {
167 return getGeneration() <= NORTHERN_ISLANDS;
170 // Helper functions to simplify if statements
171 bool isTargetELF() const {
175 StringRef getDeviceName() const {
179 bool dumpCode() const {
182 bool r600ALUEncoding() const {
187 } // End namespace llvm
189 #endif // AMDGPUSUBTARGET_H