[flang-commits] [clang] [flang] [Flang][Driver] Introduce -fopenmp-targets offloading option (PR #100152)

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Wed Jul 24 07:07:51 PDT 2024


================
@@ -492,6 +493,18 @@ void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
     if (Args.hasArg(options::OPT_nogpulib))
       CmdArgs.push_back("-nogpulib");
   }
+
+  // For all the host OpenMP offloading compile jobs we need to pass the targets
+  // information using -fopenmp-targets= option.
+  if (JA.isHostOffloading(Action::OFK_OpenMP)) {
+    SmallString<128> Targets("-fopenmp-targets=");
+
+    SmallVector<std::string, 4> Triples;
+    auto TCRange = C.getOffloadToolChains<Action::OFK_OpenMP>();
+    std::transform(TCRange.first, TCRange.second, std::back_inserter(Triples),
+                   [](auto TC) { return TC.second->getTripleString(); });
----------------
Meinersbur wrote:

I was going to suggest `llvm::append_range` and `llvm::map` here, but it seems `TCRange` is a weird type.

https://github.com/llvm/llvm-project/pull/100152


More information about the flang-commits mailing list