1 //===- NVPTXSubtarget.cpp - NVPTX Subtarget Information -------------------===//
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 NVPTX specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "NVPTXSubtarget.h"
18 #define DEBUG_TYPE "nvptx-subtarget"
20 #define GET_SUBTARGETINFO_ENUM
21 #define GET_SUBTARGETINFO_TARGET_DESC
22 #define GET_SUBTARGETINFO_CTOR
23 #include "NVPTXGenSubtargetInfo.inc"
25 // Pin the vtable to this file.
26 void NVPTXSubtarget::anchor() {}
28 NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU,
30 // Provide the default CPU if we don't have one.
31 if (CPU.empty() && FS.size())
32 llvm_unreachable("we are not using FeatureStr");
33 TargetName = CPU.empty() ? "sm_20" : CPU;
35 ParseSubtargetFeatures(TargetName, FS);
37 // Set default to PTX 3.2 (CUDA 5.5)
38 if (PTXVersion == 0) {
45 NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
46 const std::string &FS, const TargetMachine &TM,
48 : NVPTXGenSubtargetInfo(TT, CPU, FS), Is64Bit(is64Bit), PTXVersion(0),
49 SmVersion(20), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
50 TLInfo((const NVPTXTargetMachine &)TM, *this), TSInfo(TM.getDataLayout()),
51 FrameLowering(*this) {
55 if (T.getOS() == Triple::NVCL)
56 drvInterface = NVPTX::NVCL;
58 drvInterface = NVPTX::CUDA;