aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Compilation.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2020-03-23 14:23:09 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2020-03-24 10:13:05 -0400
commit2ae25647d1a363515ecbd193dc66d8ada80dd054 (patch)
tree08207f801b8741be88c05b4981bcf895af7ca8a9 /clang/lib/Driver/Compilation.cpp
parentd381b6a8d3e87d65f4ae9ca4d4333203e01825f5 (diff)
downloadllvm-2ae25647d1a363515ecbd193dc66d8ada80dd054.zip
llvm-2ae25647d1a363515ecbd193dc66d8ada80dd054.tar.gz
llvm-2ae25647d1a363515ecbd193dc66d8ada80dd054.tar.bz2
[CUDA][HIP] Add -Xarch_device and -Xarch_host options
The argument after -Xarch_device will be added to the arguments for CUDA/HIP device compilation and will be removed for host compilation. The argument after -Xarch_host will be added to the arguments for CUDA/HIP host compilation and will be removed for device compilation. Differential Revision: https://reviews.llvm.org/D76520
Diffstat (limited to 'clang/lib/Driver/Compilation.cpp')
-rw-r--r--clang/lib/Driver/Compilation.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp
index 5247757..05ee509 100644
--- a/clang/lib/Driver/Compilation.cpp
+++ b/clang/lib/Driver/Compilation.cpp
@@ -76,16 +76,29 @@ Compilation::getArgsForToolChain(const ToolChain *TC, StringRef BoundArch,
*TranslatedArgs, SameTripleAsHost, AllocatedArgs);
}
+ DerivedArgList *NewDAL = nullptr;
if (!OpenMPArgs) {
+ NewDAL = TC->TranslateXarchArgs(*TranslatedArgs, BoundArch,
+ DeviceOffloadKind, &AllocatedArgs);
+ } else {
+ NewDAL = TC->TranslateXarchArgs(*OpenMPArgs, BoundArch, DeviceOffloadKind,
+ &AllocatedArgs);
+ if (!NewDAL)
+ NewDAL = OpenMPArgs;
+ else
+ delete OpenMPArgs;
+ }
+
+ if (!NewDAL) {
Entry = TC->TranslateArgs(*TranslatedArgs, BoundArch, DeviceOffloadKind);
if (!Entry)
Entry = TranslatedArgs;
} else {
- Entry = TC->TranslateArgs(*OpenMPArgs, BoundArch, DeviceOffloadKind);
+ Entry = TC->TranslateArgs(*NewDAL, BoundArch, DeviceOffloadKind);
if (!Entry)
- Entry = OpenMPArgs;
+ Entry = NewDAL;
else
- delete OpenMPArgs;
+ delete NewDAL;
}
// Add allocated arguments to the final DAL.