Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame^] | 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 "AMDILDevice.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 | |
| 27 | namespace llvm { |
| 28 | |
| 29 | class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo { |
| 30 | private: |
| 31 | bool CapsOverride[AMDGPUDeviceInfo::MaxNumberCapabilities]; |
| 32 | const AMDGPUDevice *Device; |
| 33 | size_t DefaultSize[3]; |
| 34 | std::string DevName; |
| 35 | bool Is64bit; |
| 36 | bool Is32on64bit; |
| 37 | bool DumpCode; |
| 38 | bool R600ALUInst; |
| 39 | |
| 40 | InstrItineraryData InstrItins; |
| 41 | |
| 42 | public: |
| 43 | AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS); |
| 44 | virtual ~AMDGPUSubtarget(); |
| 45 | |
| 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; |
| 58 | bool dumpCode() const { return DumpCode; } |
| 59 | bool r600ALUEncoding() const { return R600ALUInst; } |
| 60 | |
| 61 | }; |
| 62 | |
| 63 | } // End namespace llvm |
| 64 | |
| 65 | #endif // AMDGPUSUBTARGET_H |