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 // This file declares the AMDGPU specific subclass of TargetSubtarget. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef _AMDGPUSUBTARGET_H_ 15 #define _AMDGPUSUBTARGET_H_ 16 #include "AMDILDevice.h" 17 #include "llvm/ADT/StringExtras.h" 18 #include "llvm/ADT/StringRef.h" 19 #include "llvm/Target/TargetSubtargetInfo.h" 20 21 #define GET_SUBTARGETINFO_HEADER 22 #include "AMDGPUGenSubtargetInfo.inc" 23 24 #define MAX_CB_SIZE (1 << 16) 25 26 namespace llvm { 27 28 class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo 29 { 30 private: 31 bool CapsOverride[AMDGPUDeviceInfo::MaxNumberCapabilities]; 32 const AMDGPUDevice *mDevice; 33 size_t mDefaultSize[3]; 34 size_t mMinimumSize[3]; 35 std::string mDevName; 36 bool mIs64bit; 37 bool mIs32on64bit; 38 bool mDumpCode; 39 40 InstrItineraryData InstrItins; 41 42 public: 43 AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS); 44 virtual ~AMDGPUSubtarget(); 45 getInstrItineraryData()46 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } 47 virtual void ParseSubtargetFeatures(llvm::StringRef CPU, llvm::StringRef FS); 48 49 bool isOverride(AMDGPUDeviceInfo::Caps) const; 50 bool is64bit() const; 51 52 // Helper functions to simplify if statements 53 bool isTargetELF() const; 54 const AMDGPUDevice* device() const; 55 std::string getDataLayout() const; 56 std::string getDeviceName() const; 57 virtual size_t getDefaultSize(uint32_t dim) const; dumpCode()58 bool dumpCode() const { return mDumpCode; } 59 60 }; 61 62 } // End namespace llvm 63 64 #endif // AMDGPUSUBTARGET_H_ 65