Silence -Wunused-variable in release builds.
[llvm/stm8.git] / lib / Target / PTX / PTXSubtarget.cpp
bloba8a2ef7309a5251e62724e30dbb894502aa3ebbc
1 //===- PTXSubtarget.cpp - PTX Subtarget Information ---------------*- 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 implements the PTX specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "PTXSubtarget.h"
15 #include "PTX.h"
16 #include "llvm/Support/ErrorHandling.h"
17 #include "llvm/Target/TargetRegistry.h"
19 #define GET_SUBTARGETINFO_ENUM
20 #define GET_SUBTARGETINFO_MC_DESC
21 #define GET_SUBTARGETINFO_TARGET_DESC
22 #define GET_SUBTARGETINFO_CTOR
23 #include "PTXGenSubtargetInfo.inc"
25 using namespace llvm;
27 PTXSubtarget::PTXSubtarget(const std::string &TT, const std::string &CPU,
28 const std::string &FS, bool is64Bit)
29 : PTXGenSubtargetInfo(TT, CPU, FS),
30 PTXTarget(PTX_COMPUTE_1_0),
31 PTXVersion(PTX_VERSION_2_0),
32 SupportsDouble(false),
33 SupportsFMA(true),
34 Is64Bit(is64Bit) {
35 std::string TARGET = CPU;
36 if (TARGET.empty())
37 TARGET = "generic";
38 ParseSubtargetFeatures(TARGET, FS);
41 std::string PTXSubtarget::getTargetString() const {
42 switch(PTXTarget) {
43 default: llvm_unreachable("Unknown PTX target");
44 case PTX_SM_1_0: return "sm_10";
45 case PTX_SM_1_1: return "sm_11";
46 case PTX_SM_1_2: return "sm_12";
47 case PTX_SM_1_3: return "sm_13";
48 case PTX_SM_2_0: return "sm_20";
49 case PTX_SM_2_1: return "sm_21";
50 case PTX_SM_2_2: return "sm_22";
51 case PTX_SM_2_3: return "sm_23";
52 case PTX_COMPUTE_1_0: return "compute_10";
53 case PTX_COMPUTE_1_1: return "compute_11";
54 case PTX_COMPUTE_1_2: return "compute_12";
55 case PTX_COMPUTE_1_3: return "compute_13";
56 case PTX_COMPUTE_2_0: return "compute_20";
60 std::string PTXSubtarget::getPTXVersionString() const {
61 switch(PTXVersion) {
62 default: llvm_unreachable("Unknown PTX version");
63 case PTX_VERSION_2_0: return "2.0";
64 case PTX_VERSION_2_1: return "2.1";
65 case PTX_VERSION_2_2: return "2.2";
66 case PTX_VERSION_2_3: return "2.3";
71 MCSubtargetInfo *createPTXMCSubtargetInfo(StringRef TT, StringRef CPU,
72 StringRef FS) {
73 MCSubtargetInfo *X = new MCSubtargetInfo();
74 InitPTXMCSubtargetInfo(X, CPU, FS);
75 return X;
78 extern "C" void LLVMInitializePTXMCSubtargetInfo() {
79 TargetRegistry::RegisterMCSubtargetInfo(ThePTX32Target,
80 createPTXMCSubtargetInfo);
81 TargetRegistry::RegisterMCSubtargetInfo(ThePTX64Target,
82 createPTXMCSubtargetInfo);