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;
54 bool EnableIRStructurizer;
55 bool EnablePromoteAlloca;
57 unsigned WavefrontSize;
61 InstrItineraryData InstrItins;
64 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
66 const AMDGPUInstrInfo *getInstrInfo() const {
67 return InstrInfo.get();
70 const InstrItineraryData &getInstrItineraryData() const {
74 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
76 bool is64bit() const {
80 bool hasVertexCache() const {
81 return HasVertexCache;
84 short getTexVTXClauseSize() const {
85 return TexVTXClauseSize;
88 Generation getGeneration() const {
92 bool hasHWFP64() const {
96 bool hasCaymanISA() const {
100 bool hasBFE() const {
101 return (getGeneration() >= EVERGREEN);
104 bool hasBFI() const {
105 return (getGeneration() >= EVERGREEN);
108 bool hasBFM() const {
112 bool hasBCNT(unsigned Size) const {
114 return (getGeneration() >= EVERGREEN);
117 return (getGeneration() >= SOUTHERN_ISLANDS);
120 bool hasMulU24() const {
121 return (getGeneration() >= EVERGREEN);
124 bool hasMulI24() const {
125 return (getGeneration() >= SOUTHERN_ISLANDS ||
129 bool IsIRStructurizerEnabled() const {
130 return EnableIRStructurizer;
133 bool isPromoteAllocaEnabled() const {
134 return EnablePromoteAlloca;
137 bool isIfCvtEnabled() const {
141 unsigned getWavefrontSize() const {
142 return WavefrontSize;
145 unsigned getStackEntrySize() const;
147 bool hasCFAluBug() const {
148 assert(getGeneration() <= NORTHERN_ISLANDS);
152 int getLocalMemorySize() const {
153 return LocalMemorySize;
156 bool enableMachineScheduler() const override {
157 return getGeneration() <= NORTHERN_ISLANDS;
160 // Helper functions to simplify if statements
161 bool isTargetELF() const {
165 StringRef getDeviceName() const {
169 bool dumpCode() const {
172 bool r600ALUEncoding() const {
177 } // End namespace llvm
179 #endif // AMDGPUSUBTARGET_H