blob: 57cd43da4763190b4943f1a5fc7b538d16ba8af3 [file] [log] [blame]
Eric Christopher50880d02010-09-18 18:52:28 +00001//====-- 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
19namespace llvm {
20 class PTXSubtarget : public TargetSubtarget {
21 private:
Justin Holewinski625eec12011-03-15 13:24:15 +000022
23 /**
24 * Enumeration of Shader Models supported by the back-end.
25 */
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000026 enum PTXShaderModelEnum {
Justin Holewinski625eec12011-03-15 13:24:15 +000027 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 */
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000030 };
31
Justin Holewinski625eec12011-03-15 13:24:15 +000032 /**
33 * Enumeration of PTX versions supported by the back-end.
34 *
35 * Currently, PTX 2.0 is the minimum supported version.
36 */
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000037 enum PTXVersionEnum {
Justin Holewinski625eec12011-03-15 13:24:15 +000038 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 */
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000041 };
42
43 /// Shader Model supported on the target GPU.
44 PTXShaderModelEnum PTXShaderModel;
45
46 /// PTX Language Version.
47 PTXVersionEnum PTXVersion;
48
49 // The native .f64 type is supported on the hardware.
50 bool SupportsDouble;
Eric Christopher50880d02010-09-18 18:52:28 +000051
Che-Liang Chiouf48817c2011-03-02 07:36:48 +000052 // Use .u64 instead of .u32 for addresses.
53 bool Use64BitAddresses;
54
Eric Christopher50880d02010-09-18 18:52:28 +000055 public:
56 PTXSubtarget(const std::string &TT, const std::string &FS);
57
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000058 std::string getTargetString() const;
59
60 std::string getPTXVersionString() const;
61
62 bool supportsDouble() const { return SupportsDouble; }
63
Che-Liang Chiouf48817c2011-03-02 07:36:48 +000064 bool use64BitAddresses() const { return Use64BitAddresses; }
65
Justin Holewinskifca9efc2011-03-10 16:57:18 +000066 bool supportsSM13() const { return PTXShaderModel >= PTX_SM_1_3; }
67
68 bool supportsSM20() const { return PTXShaderModel >= PTX_SM_2_0; }
69
Justin Holewinskifca9efc2011-03-10 16:57:18 +000070 bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
71
Justin Holewinski625eec12011-03-15 13:24:15 +000072 bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
73
Eric Christopher50880d02010-09-18 18:52:28 +000074 std::string ParseSubtargetFeatures(const std::string &FS,
75 const std::string &CPU);
76 }; // class PTXSubtarget
77} // namespace llvm
78
79#endif // PTX_SUBTARGET_H