summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2017-01-05 16:52:29 +0000
committerJustin Lebar <jlebar@google.com>2017-01-05 16:52:29 +0000
commit58891907fe67f270dcb4ed29671f094b4920d234 (patch)
tree8d9ca92e38da3bc37ed17f29edfbe173f0f4b6ca /clang/lib/Driver/ToolChains.cpp
parentdda1d844fb655e9f2c7447f330e8e73614581474 (diff)
downloadbcm5719-llvm-58891907fe67f270dcb4ed29671f094b4920d234.tar.gz
bcm5719-llvm-58891907fe67f270dcb4ed29671f094b4920d234.zip
[Driver] Driver changes to support CUDA compilation on Windows.
Summary: For the most part this is straightforward: Just add a CudaInstallation object to the MSVC and MinGW toolchains. CudaToolChain has to override computeMSVCVersion so that Clang::constructJob passes the right version flag to cc1. We have to modify IsWindowsMSVC and friends in Clang::constructJob to be true when compiling CUDA device code on Windows for the same reason. Depends on: D28319 Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28320 llvm-svn: 291131
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 8815c132016..789a2f0525b 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -1810,14 +1810,21 @@ CudaInstallationDetector::CudaInstallationDetector(
: D(D) {
SmallVector<std::string, 4> CudaPathCandidates;
- if (Args.hasArg(options::OPT_cuda_path_EQ))
+ // In decreasing order so we prefer newer versions to older versions.
+ std::initializer_list<const char *> Versions = {"8.0", "7.5", "7.0"};
+
+ if (Args.hasArg(options::OPT_cuda_path_EQ)) {
CudaPathCandidates.push_back(
Args.getLastArgValue(options::OPT_cuda_path_EQ));
- else {
+ } else if (HostTriple.isOSWindows()) {
+ for (const char *Ver : Versions)
+ CudaPathCandidates.push_back(
+ D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" +
+ Ver);
+ } else {
CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda");
- CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-8.0");
- CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.5");
- CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.0");
+ for (const char *Ver : Versions)
+ CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-" + Ver);
}
for (const auto &CudaPath : CudaPathCandidates) {
@@ -5021,6 +5028,11 @@ SanitizerMask CudaToolChain::getSupportedSanitizers() const {
return HostTC.getSupportedSanitizers();
}
+VersionTuple CudaToolChain::computeMSVCVersion(const Driver *D,
+ const ArgList &Args) const {
+ return HostTC.computeMSVCVersion(D, Args);
+}
+
/// XCore tool chain
XCoreToolChain::XCoreToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
OpenPOWER on IntegriCloud