1 //====-- PTXSubtarget.h - Define Subtarget for the PTX ---------*- 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 //===----------------------------------------------------------------------===//
10 // This file declares the PTX specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_SUBTARGET_H
15 #define PTX_SUBTARGET_H
17 #include "llvm/Target/TargetSubtarget.h"
20 class PTXSubtarget : public TargetSubtarget {
24 * Enumeration of Shader Models supported by the back-end.
26 enum PTXShaderModelEnum {
27 PTX_SM_1_0, /*< Shader Model 1.0 */
28 PTX_SM_1_3, /*< Shader Model 1.3 */
29 PTX_SM_2_0 /*< Shader Model 2.0 */
33 * Enumeration of PTX versions supported by the back-end.
35 * Currently, PTX 2.0 is the minimum supported version.
38 PTX_VERSION_2_0, /*< PTX Version 2.0 */
39 PTX_VERSION_2_1, /*< PTX Version 2.1 */
40 PTX_VERSION_2_2, /*< PTX Version 2.2 */
41 PTX_VERSION_2_3 /*< PTX Version 2.3 */
44 /// Shader Model supported on the target GPU.
45 PTXShaderModelEnum PTXShaderModel;
47 /// PTX Language Version.
48 PTXVersionEnum PTXVersion;
50 // The native .f64 type is supported on the hardware.
53 // Support the fused-multiply add (FMA) and multiply-add (MAD) instructions
56 // Use .u64 instead of .u32 for addresses.
60 PTXSubtarget(const std::string &TT, const std::string &FS, bool is64Bit);
62 std::string getTargetString() const;
64 std::string getPTXVersionString() const;
66 bool supportsDouble() const { return SupportsDouble; }
68 bool is64Bit() const { return Is64Bit; }
70 bool supportsFMA() const { return SupportsFMA; }
72 bool supportsSM13() const { return PTXShaderModel >= PTX_SM_1_3; }
74 bool supportsSM20() const { return PTXShaderModel >= PTX_SM_2_0; }
76 bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
78 bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
80 bool supportsPTX23() const { return PTXVersion >= PTX_VERSION_2_3; }
82 std::string ParseSubtargetFeatures(const std::string &FS,
83 const std::string &CPU);
84 }; // class PTXSubtarget
87 #endif // PTX_SUBTARGET_H