Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 1 | //====-- PTXSubtarget.h - Define Subtarget for the PTX ---------*- 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 PTX specific subclass of TargetSubtarget. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef PTX_SUBTARGET_H |
| 15 | #define PTX_SUBTARGET_H |
| 16 | |
| 17 | #include "llvm/Target/TargetSubtarget.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | class PTXSubtarget : public TargetSubtarget { |
| 21 | private: |
Che-Liang Chiou | fd8978b | 2011-03-02 03:20:28 +0000 | [diff] [blame] | 22 | enum PTXShaderModelEnum { |
| 23 | PTX_SM_1_0, |
| 24 | PTX_SM_1_3, |
| 25 | PTX_SM_2_0 |
| 26 | }; |
| 27 | |
| 28 | enum PTXVersionEnum { |
| 29 | PTX_VERSION_1_4, |
| 30 | PTX_VERSION_2_0, |
| 31 | PTX_VERSION_2_1 |
| 32 | }; |
| 33 | |
| 34 | /// Shader Model supported on the target GPU. |
| 35 | PTXShaderModelEnum PTXShaderModel; |
| 36 | |
| 37 | /// PTX Language Version. |
| 38 | PTXVersionEnum PTXVersion; |
| 39 | |
| 40 | // The native .f64 type is supported on the hardware. |
| 41 | bool SupportsDouble; |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 42 | |
Che-Liang Chiou | f48817c | 2011-03-02 07:36:48 +0000 | [diff] [blame] | 43 | // Use .u64 instead of .u32 for addresses. |
| 44 | bool Use64BitAddresses; |
| 45 | |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 46 | public: |
| 47 | PTXSubtarget(const std::string &TT, const std::string &FS); |
| 48 | |
Che-Liang Chiou | fd8978b | 2011-03-02 03:20:28 +0000 | [diff] [blame] | 49 | std::string getTargetString() const; |
| 50 | |
| 51 | std::string getPTXVersionString() const; |
| 52 | |
| 53 | bool supportsDouble() const { return SupportsDouble; } |
| 54 | |
Che-Liang Chiou | f48817c | 2011-03-02 07:36:48 +0000 | [diff] [blame] | 55 | bool use64BitAddresses() const { return Use64BitAddresses; } |
| 56 | |
Justin Holewinski | fca9efc | 2011-03-10 16:57:18 +0000 | [diff] [blame] | 57 | bool supportsSM13() const { return PTXShaderModel >= PTX_SM_1_3; } |
| 58 | |
| 59 | bool supportsSM20() const { return PTXShaderModel >= PTX_SM_2_0; } |
| 60 | |
| 61 | bool supportsPTX20() const { return PTXVersion >= PTX_VERSION_2_0; } |
| 62 | |
| 63 | bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; } |
| 64 | |
Eric Christopher | 50880d0 | 2010-09-18 18:52:28 +0000 | [diff] [blame] | 65 | std::string ParseSubtargetFeatures(const std::string &FS, |
| 66 | const std::string &CPU); |
| 67 | }; // class PTXSubtarget |
| 68 | } // namespace llvm |
| 69 | |
| 70 | #endif // PTX_SUBTARGET_H |