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 AMDGPUIntrinsicInfo IntrinsicInfo;
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 { return &FrameLowering; }
78 const AMDGPUIntrinsicInfo *getIntrinsicInfo() const { return &IntrinsicInfo; }
79 const AMDGPUInstrInfo *getInstrInfo() const { return InstrInfo.get(); }
80 const AMDGPURegisterInfo *getRegisterInfo() const {
81 return &InstrInfo->getRegisterInfo();
83 AMDGPUTargetLowering *getTargetLowering() const { return TLInfo.get(); }
84 const DataLayout *getDataLayout() const { return &DL; }
85 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
87 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
89 bool is64bit() const {
93 bool hasVertexCache() const {
94 return HasVertexCache;
97 short getTexVTXClauseSize() const {
98 return TexVTXClauseSize;
101 Generation getGeneration() const {
105 bool hasHWFP64() const {
109 bool hasCaymanISA() const {
113 bool hasFP32Denormals() const {
114 return FP32Denormals;
117 bool hasFP64Denormals() const {
118 return FP64Denormals;
121 bool hasBFE() const {
122 return (getGeneration() >= EVERGREEN);
125 bool hasBFI() const {
126 return (getGeneration() >= EVERGREEN);
129 bool hasBFM() const {
133 bool hasBCNT(unsigned Size) const {
135 return (getGeneration() >= EVERGREEN);
138 return (getGeneration() >= SOUTHERN_ISLANDS);
143 bool hasMulU24() const {
144 return (getGeneration() >= EVERGREEN);
147 bool hasMulI24() const {
148 return (getGeneration() >= SOUTHERN_ISLANDS ||
152 bool hasFFBL() const {
153 return (getGeneration() >= EVERGREEN);
156 bool hasFFBH() const {
157 return (getGeneration() >= EVERGREEN);
160 bool IsIRStructurizerEnabled() const {
161 return EnableIRStructurizer;
164 bool isPromoteAllocaEnabled() const {
165 return EnablePromoteAlloca;
168 bool isIfCvtEnabled() const {
172 unsigned getWavefrontSize() const {
173 return WavefrontSize;
176 unsigned getStackEntrySize() const;
178 bool hasCFAluBug() const {
179 assert(getGeneration() <= NORTHERN_ISLANDS);
183 int getLocalMemorySize() const {
184 return LocalMemorySize;
187 bool enableMachineScheduler() const override {
188 return getGeneration() <= NORTHERN_ISLANDS;
191 // Helper functions to simplify if statements
192 bool isTargetELF() const {
196 StringRef getDeviceName() const {
200 bool dumpCode() const {
203 bool r600ALUEncoding() const {
208 } // End namespace llvm
210 #endif // AMDGPUSUBTARGET_H