aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-06 21:21:39 +0000
committerJustin Lebar <jlebar@google.com>2016-07-06 21:21:39 +0000
commit629076178a5eed7f6650eb429a61cc0653be9924 (patch)
treea83dc16f3a21cd2e1444fa689512f1c5e1d31461 /clang/lib/Driver/Tools.cpp
parentef1aaac3ccb01e43fb02584a5a1d08faf822189f (diff)
downloadllvm-629076178a5eed7f6650eb429a61cc0653be9924.zip
llvm-629076178a5eed7f6650eb429a61cc0653be9924.tar.gz
llvm-629076178a5eed7f6650eb429a61cc0653be9924.tar.bz2
[CUDA] Add utility functions for dealing with CUDA versions / architectures.
Summary: Currently our handling of CUDA architectures is scattered all around clang. This patch centralizes it. A key advantage of this centralization is that you can now write a C++ switch on e.g. CudaArch and get a compile error if you don't handle one of the enum values. Reviewers: tra Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21867 llvm-svn: 274681
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 2425619..14ed0d4 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -11222,9 +11222,10 @@ void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA,
auto* A = cast<const CudaDeviceAction>(II.getAction());
// We need to pass an Arch of the form "sm_XX" for cubin files and
// "compute_XX" for ptx.
- const char *Arch = (II.getType() == types::TY_PP_Asm)
- ? A->getComputeArchName()
- : A->getGpuArchName();
+ const char *Arch =
+ (II.getType() == types::TY_PP_Asm)
+ ? CudaVirtualArchToString(VirtualArchForCudaArch(A->getGpuArch()))
+ : CudaArchToString(A->getGpuArch());
CmdArgs.push_back(Args.MakeArgString(llvm::Twine("--image=profile=") +
Arch + ",file=" + II.getFilename()));
}