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 { return &FrameLowering; }
77 const AMDGPUInstrInfo *getInstrInfo() const { return InstrInfo.get(); }
78 const AMDGPURegisterInfo *getRegisterInfo() const {
79 return &InstrInfo->getRegisterInfo();
81 AMDGPUTargetLowering *getTargetLowering() const { return TLInfo.get(); }
82 const DataLayout *getDataLayout() const { return &DL; }
83 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
85 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
87 bool is64bit() const {
91 bool hasVertexCache() const {
92 return HasVertexCache;
95 short getTexVTXClauseSize() const {
96 return TexVTXClauseSize;
99 Generation getGeneration() const {
103 bool hasHWFP64() const {
107 bool hasCaymanISA() const {
111 bool hasFP32Denormals() const {
112 return FP32Denormals;
115 bool hasFP64Denormals() const {
116 return FP64Denormals;
119 bool hasBFE() const {
120 return (getGeneration() >= EVERGREEN);
123 bool hasBFI() const {
124 return (getGeneration() >= EVERGREEN);
127 bool hasBFM() const {
131 bool hasBCNT(unsigned Size) const {
133 return (getGeneration() >= EVERGREEN);
136 return (getGeneration() >= SOUTHERN_ISLANDS);
141 bool hasMulU24() const {
142 return (getGeneration() >= EVERGREEN);
145 bool hasMulI24() const {
146 return (getGeneration() >= SOUTHERN_ISLANDS ||
150 bool hasFFBL() const {
151 return (getGeneration() >= EVERGREEN);
154 bool hasFFBH() const {
155 return (getGeneration() >= EVERGREEN);
158 bool IsIRStructurizerEnabled() const {
159 return EnableIRStructurizer;
162 bool isPromoteAllocaEnabled() const {
163 return EnablePromoteAlloca;
166 bool isIfCvtEnabled() const {
170 unsigned getWavefrontSize() const {
171 return WavefrontSize;
174 unsigned getStackEntrySize() const;
176 bool hasCFAluBug() const {
177 assert(getGeneration() <= NORTHERN_ISLANDS);
181 int getLocalMemorySize() const {
182 return LocalMemorySize;
185 bool enableMachineScheduler() const override {
186 return getGeneration() <= NORTHERN_ISLANDS;
189 // Helper functions to simplify if statements
190 bool isTargetELF() const {
194 StringRef getDeviceName() const {
198 bool dumpCode() const {
201 bool r600ALUEncoding() const {
206 } // End namespace llvm
208 #endif // AMDGPUSUBTARGET_H