AMDGPUSubtarget.h revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
1//=====-- AMDGPUSubtarget.h - Define Subtarget for the AMDIL ---*- C++ -*-====// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//==-----------------------------------------------------------------------===// 9// 10/// \file 11/// \brief AMDGPU specific subclass of TargetSubtarget. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef AMDGPUSUBTARGET_H 16#define AMDGPUSUBTARGET_H 17#include "AMDGPU.h" 18#include "llvm/ADT/StringExtras.h" 19#include "llvm/ADT/StringRef.h" 20#include "llvm/Target/TargetSubtargetInfo.h" 21 22#define GET_SUBTARGETINFO_HEADER 23#include "AMDGPUGenSubtargetInfo.inc" 24 25#define MAX_CB_SIZE (1 << 16) 26 27namespace llvm { 28 29class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo { 30public: 31 enum Generation { 32 R600 = 0, 33 R700, 34 EVERGREEN, 35 NORTHERN_ISLANDS, 36 SOUTHERN_ISLANDS, 37 SEA_ISLANDS 38 }; 39 40private: 41 std::string DevName; 42 bool Is64bit; 43 bool Is32on64bit; 44 bool DumpCode; 45 bool R600ALUInst; 46 bool HasVertexCache; 47 short TexVTXClauseSize; 48 enum Generation Gen; 49 bool FP64; 50 bool CaymanISA; 51 bool EnableIRStructurizer; 52 bool EnableIfCvt; 53 unsigned WavefrontSize; 54 bool CFALUBug; 55 56 InstrItineraryData InstrItins; 57 58public: 59 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS); 60 61 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } 62 void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 63 64 bool is64bit() const; 65 bool hasVertexCache() const; 66 short getTexVTXClauseSize() const; 67 enum Generation getGeneration() const; 68 bool hasHWFP64() const; 69 bool hasCaymanISA() const; 70 71 bool hasBFE() const { 72 return (getGeneration() >= EVERGREEN); 73 } 74 75 bool hasBFM() const { 76 return hasBFE(); 77 } 78 79 bool hasMulU24() const { 80 return (getGeneration() >= EVERGREEN); 81 } 82 83 bool hasMulI24() const { 84 return (getGeneration() >= SOUTHERN_ISLANDS || 85 hasCaymanISA()); 86 } 87 88 bool IsIRStructurizerEnabled() const; 89 bool isIfCvtEnabled() const; 90 unsigned getWavefrontSize() const; 91 unsigned getStackEntrySize() const; 92 bool hasCFAluBug() const; 93 94 bool enableMachineScheduler() const override { 95 return getGeneration() <= NORTHERN_ISLANDS; 96 } 97 98 // Helper functions to simplify if statements 99 bool isTargetELF() const; 100 std::string getDeviceName() const; 101 bool dumpCode() const { return DumpCode; } 102 bool r600ALUEncoding() const { return R600ALUInst; } 103 104}; 105 106} // End namespace llvm 107 108#endif // AMDGPUSUBTARGET_H 109