Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Target / PTX / PTXSubtarget.h
blob0921f1f22c49b472165aa7e55bb8a5fd6e4e8c42
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 TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_SUBTARGET_H
15 #define PTX_SUBTARGET_H
17 #include "llvm/Target/TargetSubtargetInfo.h"
19 #define GET_SUBTARGETINFO_HEADER
20 #include "PTXGenSubtargetInfo.inc"
22 namespace llvm {
23 class StringRef;
25 class PTXSubtarget : public PTXGenSubtargetInfo {
26 public:
28 /**
29 * Enumeration of Shader Models supported by the back-end.
31 enum PTXTargetEnum {
32 PTX_COMPUTE_1_0, /*< Compute Compatibility 1.0 */
33 PTX_COMPUTE_1_1, /*< Compute Compatibility 1.1 */
34 PTX_COMPUTE_1_2, /*< Compute Compatibility 1.2 */
35 PTX_COMPUTE_1_3, /*< Compute Compatibility 1.3 */
36 PTX_COMPUTE_2_0, /*< Compute Compatibility 2.0 */
37 PTX_LAST_COMPUTE,
39 PTX_SM_1_0, /*< Shader Model 1.0 */
40 PTX_SM_1_1, /*< Shader Model 1.1 */
41 PTX_SM_1_2, /*< Shader Model 1.2 */
42 PTX_SM_1_3, /*< Shader Model 1.3 */
43 PTX_SM_2_0, /*< Shader Model 2.0 */
44 PTX_SM_2_1, /*< Shader Model 2.1 */
45 PTX_SM_2_2, /*< Shader Model 2.2 */
46 PTX_SM_2_3, /*< Shader Model 2.3 */
47 PTX_LAST_SM
50 /**
51 * Enumeration of PTX versions supported by the back-end.
53 * Currently, PTX 2.0 is the minimum supported version.
55 enum PTXVersionEnum {
56 PTX_VERSION_2_0, /*< PTX Version 2.0 */
57 PTX_VERSION_2_1, /*< PTX Version 2.1 */
58 PTX_VERSION_2_2, /*< PTX Version 2.2 */
59 PTX_VERSION_2_3 /*< PTX Version 2.3 */
62 private:
64 /// Shader Model supported on the target GPU.
65 PTXTargetEnum PTXTarget;
67 /// PTX Language Version.
68 PTXVersionEnum PTXVersion;
70 // The native .f64 type is supported on the hardware.
71 bool SupportsDouble;
73 // Support the fused-multiply add (FMA) and multiply-add (MAD)
74 // instructions
75 bool SupportsFMA;
77 // Use .u64 instead of .u32 for addresses.
78 bool Is64Bit;
80 public:
82 PTXSubtarget(const std::string &TT, const std::string &CPU,
83 const std::string &FS, bool is64Bit);
85 // Target architecture accessors
86 std::string getTargetString() const;
88 std::string getPTXVersionString() const;
90 bool supportsDouble() const { return SupportsDouble; }
92 bool is64Bit() const { return Is64Bit; }
94 bool supportsFMA() const { return SupportsFMA; }
96 bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
98 bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
100 bool supportsPTX23() const { return PTXVersion >= PTX_VERSION_2_3; }
102 bool fdivNeedsRoundingMode() const {
103 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
104 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
107 bool fmadNeedsRoundingMode() const {
108 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
109 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
112 bool useParamSpaceForDeviceArgs() const {
113 return (PTXTarget >= PTX_SM_2_0 && PTXTarget < PTX_LAST_SM) ||
114 (PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
117 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
118 }; // class PTXSubtarget
119 } // namespace llvm
121 #endif // PTX_SUBTARGET_H