1 //===- PTXSubtarget.cpp - PTX Subtarget Information ---------------*- 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 implements the PTX specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "PTXSubtarget.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"
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),
35 std::string TARGET
= CPU
;
38 ParseSubtargetFeatures(TARGET
, FS
);
41 std::string
PTXSubtarget::getTargetString() const {
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 {
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
,
73 MCSubtargetInfo
*X
= new MCSubtargetInfo();
74 InitPTXMCSubtargetInfo(X
, CPU
, FS
);
78 extern "C" void LLVMInitializePTXMCSubtargetInfo() {
79 TargetRegistry::RegisterMCSubtargetInfo(ThePTX32Target
,
80 createPTXMCSubtargetInfo
);
81 TargetRegistry::RegisterMCSubtargetInfo(ThePTX64Target
,
82 createPTXMCSubtargetInfo
);