[PATCH] D129435: [Clang] Parse toolchain-specific offloading arguments directly
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 11 12:38:14 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG359e4a824731: [Clang] Parse toolchain-specific offloading arguments directly (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129435/new/
https://reviews.llvm.org/D129435
Files:
clang/lib/Driver/Driver.cpp
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4355,7 +4355,17 @@
return KnownArchs.lookup(TC);
llvm::DenseSet<StringRef> Archs;
- for (auto &Arg : Args) {
+ for (auto *Arg : Args) {
+ // Extract any '--[no-]offload-arch' arguments intended for this toolchain.
+ std::unique_ptr<llvm::opt::Arg> ExtractedArg = nullptr;
+ if (Arg->getOption().matches(options::OPT_Xopenmp_target_EQ) &&
+ ToolChain::getOpenMPTriple(Arg->getValue(0)) == TC->getTriple()) {
+ Arg->claim();
+ unsigned Index = Args.getBaseArgs().MakeIndex(Arg->getValue(1));
+ ExtractedArg = getOpts().ParseOneArg(Args, Index);
+ Arg = ExtractedArg.get();
+ }
+
if (Arg->getOption().matches(options::OPT_offload_arch_EQ)) {
for (StringRef Arch : llvm::split(Arg->getValue(), ","))
Archs.insert(getCanonicalArchString(C, Args, Arch, TC->getTriple()));
@@ -4425,8 +4435,7 @@
// Get the product of all bound architectures and toolchains.
SmallVector<std::pair<const ToolChain *, StringRef>> TCAndArchs;
for (const ToolChain *TC : ToolChains)
- for (StringRef Arch : getOffloadArchs(
- C, C.getArgsForToolChain(TC, "generic", Kind), Kind, TC))
+ for (StringRef Arch : getOffloadArchs(C, Args, Kind, TC))
TCAndArchs.push_back(std::make_pair(TC, Arch));
for (unsigned I = 0, E = TCAndArchs.size(); I != E; ++I)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129435.443721.patch
Type: text/x-patch
Size: 1518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220711/592f41ca/attachment-0001.bin>
More information about the cfe-commits
mailing list