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"
15 #define GET_SUBTARGETINFO_ENUM
16 #define GET_SUBTARGETINFO_TARGET_DESC
17 #define GET_SUBTARGETINFO_CTOR
18 #include "NVPTXGenSubtargetInfo.inc"
22 // Select Driver Interface
23 #include "llvm/Support/CommandLine.h"
25 cl::opt<NVPTX::DrvInterface>
26 DriverInterface(cl::desc("Choose driver interface:"),
28 clEnumValN(NVPTX::NVCL, "drvnvcl", "Nvidia OpenCL driver"),
29 clEnumValN(NVPTX::CUDA, "drvcuda", "Nvidia CUDA driver"),
30 clEnumValN(NVPTX::TEST, "drvtest", "Plain Test"),
32 cl::init(NVPTX::NVCL));
35 NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU,
36 const std::string &FS, bool is64Bit)
37 :NVPTXGenSubtargetInfo(TT, "", FS), // Don't pass CPU to subtarget,
38 // because we don't register all
42 drvInterface = DriverInterface;
44 // Provide the default CPU if none
45 std::string defCPU = "sm_10";
47 // Get the TargetName from the FS if available
48 if (FS.empty() && CPU.empty())
50 else if (!CPU.empty())
53 llvm_unreachable("we are not using FeatureStr");
55 // Set up the SmVersion
56 SmVersion = atoi(TargetName.c_str()+3);