aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2021-01-19 17:35:23 -0500
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2021-02-08 22:26:12 -0500
commit98c21289f1d239f39fa549ae01b17efffce6a7c0 (patch)
treecc8eb3680295790b767180801402c32caf6a1bbf /clang/lib/Frontend/CompilerInvocation.cpp
parent7dc324aafa2b17a4f9a992b9727a3642505053a6 (diff)
downloadllvm-98c21289f1d239f39fa549ae01b17efffce6a7c0.zip
llvm-98c21289f1d239f39fa549ae01b17efffce6a7c0.tar.gz
llvm-98c21289f1d239f39fa549ae01b17efffce6a7c0.tar.bz2
[CUDA][HIP] Add -fuse-cuid
This patch added a distinct CUID for each input file, which is represented by InputAction. clang initially creates an InputAction for each input file for the host compilation. In CUDA/HIP action builder, each InputAction is given a CUID and cloned for each GPU arch, and the CUID is also cloned. In this way, we guarantee the corresponding device and host compilation for the same file shared the same CUID. On the other hand, different compilation units have different CUID. -fuse-cuid=random|hash|none is added to control the method to generate CUID. The default is hash. -cuid=X is also added to specify CUID explicitly, which overrides -fuse-cuid. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D95007
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index e131804..189e7c6 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2741,6 +2741,11 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
+
+ if (auto *A = Args.getLastArg(OPT_cuid_EQ)) {
+ Opts.CUID = std::string(A->getValue());
+ }
+
if (Opts.ObjC) {
if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
StringRef value = arg->getValue();