clang  15.0.0git
AMDGPUOpenMP.cpp
Go to the documentation of this file.
1 //===- AMDGPUOpenMP.cpp - AMDGPUOpenMP ToolChain Implementation -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "AMDGPUOpenMP.h"
10 #include "AMDGPU.h"
11 #include "CommonArgs.h"
12 #include "ToolChains/ROCm.h"
15 #include "clang/Driver/Driver.h"
17 #include "clang/Driver/InputInfo.h"
18 #include "clang/Driver/Options.h"
19 #include "clang/Driver/Tool.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/Support/FileSystem.h"
22 #include "llvm/Support/FormatAdapters.h"
23 #include "llvm/Support/FormatVariadic.h"
24 #include "llvm/Support/Path.h"
25 
26 using namespace clang::driver;
27 using namespace clang::driver::toolchains;
28 using namespace clang::driver::tools;
29 using namespace clang;
30 using namespace llvm::opt;
31 
32 namespace {
33 
34 static const char *getOutputFileName(Compilation &C, StringRef Base,
35  const char *Postfix,
36  const char *Extension) {
37  const char *OutputFileName;
38  if (C.getDriver().isSaveTempsEnabled()) {
39  OutputFileName =
40  C.getArgs().MakeArgString(Base.str() + Postfix + "." + Extension);
41  } else {
42  std::string TmpName =
43  C.getDriver().GetTemporaryPath(Base.str() + Postfix, Extension);
44  OutputFileName = C.addTempFile(C.getArgs().MakeArgString(TmpName));
45  }
46  return OutputFileName;
47 }
48 
49 static void addLLCOptArg(const llvm::opt::ArgList &Args,
50  llvm::opt::ArgStringList &CmdArgs) {
51  if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
52  StringRef OOpt = "0";
53  if (A->getOption().matches(options::OPT_O4) ||
54  A->getOption().matches(options::OPT_Ofast))
55  OOpt = "3";
56  else if (A->getOption().matches(options::OPT_O0))
57  OOpt = "0";
58  else if (A->getOption().matches(options::OPT_O)) {
59  // Clang and opt support -Os/-Oz; llc only supports -O0, -O1, -O2 and -O3
60  // so we map -Os/-Oz to -O2.
61  // Only clang supports -Og, and maps it to -O1.
62  // We map anything else to -O2.
63  OOpt = llvm::StringSwitch<const char *>(A->getValue())
64  .Case("1", "1")
65  .Case("2", "2")
66  .Case("3", "3")
67  .Case("s", "2")
68  .Case("z", "2")
69  .Case("g", "1")
70  .Default("0");
71  }
72  CmdArgs.push_back(Args.MakeArgString("-O" + OOpt));
73  }
74 }
75 
76 static bool checkSystemForAMDGPU(const ArgList &Args, const AMDGPUToolChain &TC,
77  std::string &GPUArch) {
78  if (auto Err = TC.getSystemGPUArch(Args, GPUArch)) {
79  std::string ErrMsg =
80  llvm::formatv("{0}", llvm::fmt_consume(std::move(Err)));
81  TC.getDriver().Diag(diag::err_drv_undetermined_amdgpu_arch) << ErrMsg;
82  return false;
83  }
84 
85  return true;
86 }
87 } // namespace
88 
89 const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
90  const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC, Compilation &C,
91  const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args,
92  StringRef SubArchName, StringRef OutputFilePrefix) const {
93  ArgStringList CmdArgs;
94 
95  for (const auto &II : Inputs)
96  if (II.isFilename())
97  CmdArgs.push_back(II.getFilename());
98 
99  bool HasLibm = false;
100  if (Args.hasArg(options::OPT_l)) {
101  auto Lm = Args.getAllArgValues(options::OPT_l);
102  for (auto &Lib : Lm) {
103  if (Lib == "m") {
104  HasLibm = true;
105  break;
106  }
107  }
108 
109  if (HasLibm) {
110  // This is not certain to work. The device libs added here, and passed to
111  // llvm-link, are missing attributes that they expect to be inserted when
112  // passed to mlink-builtin-bitcode. The amdgpu backend does not generate
113  // conservatively correct code when attributes are missing, so this may
114  // be the root cause of miscompilations. Passing via mlink-builtin-bitcode
115  // ultimately hits CodeGenModule::addDefaultFunctionDefinitionAttributes
116  // on each function, see D28538 for context.
117  // Potential workarounds:
118  // - unconditionally link all of the device libs to every translation
119  // unit in clang via mlink-builtin-bitcode
120  // - build a libm bitcode file as part of the DeviceRTL and explictly
121  // mlink-builtin-bitcode the rocm device libs components at build time
122  // - drop this llvm-link fork in favour or some calls into LLVM, chosen
123  // to do basically the same work as llvm-link but with that call first
124  // - write an opt pass that sets that on every function it sees and pipe
125  // the device-libs bitcode through that on the way to this llvm-link
127  AMDGPUOpenMPTC.getCommonDeviceLibNames(Args, SubArchName.str());
128  llvm::for_each(BCLibs, [&](StringRef BCFile) {
129  CmdArgs.push_back(Args.MakeArgString(BCFile));
130  });
131  }
132  }
133 
134  AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, CmdArgs, "amdgcn",
135  SubArchName, /*isBitCodeSDL=*/true,
136  /*postClangLink=*/false);
137  // Add an intermediate output file.
138  CmdArgs.push_back("-o");
139  const char *OutputFileName =
140  getOutputFileName(C, OutputFilePrefix, "-linked", "bc");
141  CmdArgs.push_back(OutputFileName);
142  const char *Exec =
143  Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
144  C.addCommand(std::make_unique<Command>(
145  JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs,
146  InputInfo(&JA, Args.MakeArgString(OutputFileName))));
147 
148  // If we linked in libm definitions late we run another round of optimizations
149  // to inline the definitions and fold what is foldable.
150  if (HasLibm) {
151  ArgStringList OptCmdArgs;
152  const char *OptOutputFileName =
153  getOutputFileName(C, OutputFilePrefix, "-linked-opt", "bc");
154  addLLCOptArg(Args, OptCmdArgs);
155  OptCmdArgs.push_back(OutputFileName);
156  OptCmdArgs.push_back("-o");
157  OptCmdArgs.push_back(OptOutputFileName);
158  const char *OptExec =
159  Args.MakeArgString(getToolChain().GetProgramPath("opt"));
160  C.addCommand(std::make_unique<Command>(
161  JA, *this, ResponseFileSupport::AtFileCurCP(), OptExec, OptCmdArgs,
162  InputInfo(&JA, Args.MakeArgString(OutputFileName)),
163  InputInfo(&JA, Args.MakeArgString(OptOutputFileName))));
164  OutputFileName = OptOutputFileName;
165  }
166 
167  return OutputFileName;
168 }
169 
170 const char *AMDGCN::OpenMPLinker::constructLlcCommand(
171  Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
172  const llvm::opt::ArgList &Args, llvm::StringRef SubArchName,
173  llvm::StringRef OutputFilePrefix, const char *InputFileName,
174  bool OutputIsAsm) const {
175  // Construct llc command.
176  ArgStringList LlcArgs;
177  // The input to llc is the output from opt.
178  LlcArgs.push_back(InputFileName);
179  // Pass optimization arg to llc.
180  addLLCOptArg(Args, LlcArgs);
181  LlcArgs.push_back("-mtriple=amdgcn-amd-amdhsa");
182  LlcArgs.push_back(Args.MakeArgString("-mcpu=" + SubArchName));
183  LlcArgs.push_back(
184  Args.MakeArgString(Twine("-filetype=") + (OutputIsAsm ? "asm" : "obj")));
185 
186  for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
187  LlcArgs.push_back(A->getValue(0));
188  }
189 
190  // Add output filename
191  LlcArgs.push_back("-o");
192  const char *LlcOutputFile =
193  getOutputFileName(C, OutputFilePrefix, "", OutputIsAsm ? "s" : "o");
194  LlcArgs.push_back(LlcOutputFile);
195  const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
196  C.addCommand(std::make_unique<Command>(
197  JA, *this, ResponseFileSupport::AtFileCurCP(), Llc, LlcArgs, Inputs,
198  InputInfo(&JA, Args.MakeArgString(LlcOutputFile))));
199  return LlcOutputFile;
200 }
201 
202 void AMDGCN::OpenMPLinker::constructLldCommand(
203  Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
204  const InputInfo &Output, const llvm::opt::ArgList &Args,
205  const char *InputFileName) const {
206  // Construct lld command.
207  // The output from ld.lld is an HSA code object file.
208  ArgStringList LldArgs{"-flavor", "gnu", "--no-undefined",
209  "-shared", "-o", Output.getFilename(),
210  InputFileName};
211 
212  const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
213  C.addCommand(std::make_unique<Command>(
214  JA, *this, ResponseFileSupport::AtFileCurCP(), Lld, LldArgs, Inputs,
215  InputInfo(&JA, Args.MakeArgString(Output.getFilename()))));
216 }
217 
218 // For amdgcn the inputs of the linker job are device bitcode and output is
219 // object file. It calls llvm-link, opt, llc, then lld steps.
220 void AMDGCN::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
221  const InputInfo &Output,
222  const InputInfoList &Inputs,
223  const ArgList &Args,
224  const char *LinkingOutput) const {
225  const ToolChain &TC = getToolChain();
226  assert(getToolChain().getTriple().isAMDGCN() && "Unsupported target");
227 
228  const toolchains::AMDGPUOpenMPToolChain &AMDGPUOpenMPTC =
229  static_cast<const toolchains::AMDGPUOpenMPToolChain &>(TC);
230 
231  std::string GPUArch = Args.getLastArgValue(options::OPT_march_EQ).str();
232  if (GPUArch.empty()) {
233  if (!checkSystemForAMDGPU(Args, AMDGPUOpenMPTC, GPUArch))
234  return;
235  }
236 
237  // Prefix for temporary file name.
238  std::string Prefix;
239  for (const auto &II : Inputs)
240  if (II.isFilename())
241  Prefix = llvm::sys::path::stem(II.getFilename()).str() + "-" + GPUArch;
242  assert(Prefix.length() && "no linker inputs are files ");
243 
244  // Each command outputs different files.
245  const char *LLVMLinkCommand = constructLLVMLinkCommand(
246  AMDGPUOpenMPTC, C, JA, Inputs, Args, GPUArch, Prefix);
247 
248  // Produce readable assembly if save-temps is enabled.
249  if (C.getDriver().isSaveTempsEnabled())
250  constructLlcCommand(C, JA, Inputs, Args, GPUArch, Prefix, LLVMLinkCommand,
251  /*OutputIsAsm=*/true);
252  const char *LlcCommand = constructLlcCommand(C, JA, Inputs, Args, GPUArch,
253  Prefix, LLVMLinkCommand);
254  constructLldCommand(C, JA, Inputs, Output, Args, LlcCommand);
255 }
256 
258  const llvm::Triple &Triple,
259  const ToolChain &HostTC,
260  const ArgList &Args)
261  : ROCMToolChain(D, Triple, Args), HostTC(HostTC) {
262  // Lookup binaries into the driver directory, this is used to
263  // discover the clang-offload-bundler executable.
264  getProgramPaths().push_back(getDriver().Dir);
265 }
266 
268  const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
269  Action::OffloadKind DeviceOffloadingKind) const {
270  HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
271 
272  std::string GPUArch = DriverArgs.getLastArgValue(options::OPT_march_EQ).str();
273  if (GPUArch.empty()) {
274  if (!checkSystemForAMDGPU(DriverArgs, *this, GPUArch))
275  return;
276  }
277 
278  assert(DeviceOffloadingKind == Action::OFK_OpenMP &&
279  "Only OpenMP offloading kinds are supported.");
280 
281  CC1Args.push_back("-target-cpu");
282  CC1Args.push_back(DriverArgs.MakeArgStringRef(GPUArch));
283  CC1Args.push_back("-fcuda-is-device");
284 
285  if (DriverArgs.hasArg(options::OPT_nogpulib))
286  return;
287 
288  // Link the bitcode library late if we're using device LTO.
289  if (getDriver().isUsingLTO(/* IsOffload */ true))
290  return;
291 
292  addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, GPUArch, getTriple());
293 }
294 
295 llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(
296  const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
297  Action::OffloadKind DeviceOffloadKind) const {
298  DerivedArgList *DAL =
299  HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
300  if (!DAL)
301  DAL = new DerivedArgList(Args.getBaseArgs());
302 
303  const OptTable &Opts = getDriver().getOpts();
304 
305  if (DeviceOffloadKind == Action::OFK_OpenMP) {
306  for (Arg *A : Args)
307  if (!llvm::is_contained(*DAL, A))
308  DAL->append(A);
309 
310  if (!DAL->hasArg(options::OPT_march_EQ)) {
311  std::string Arch = BoundArch.str();
312  if (BoundArch.empty())
313  checkSystemForAMDGPU(Args, *this, Arch);
314  DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), Arch);
315  }
316 
317  return DAL;
318  }
319 
320  for (Arg *A : Args) {
321  DAL->append(A);
322  }
323 
324  if (!BoundArch.empty()) {
325  DAL->eraseArg(options::OPT_march_EQ);
326  DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ),
327  BoundArch);
328  }
329 
330  return DAL;
331 }
332 
334  assert(getTriple().isAMDGCN());
335  return new tools::AMDGCN::OpenMPLinker(*this);
336 }
337 
339  ArgStringList &CC1Args) const {
341 }
342 
344 AMDGPUOpenMPToolChain::GetCXXStdlibType(const ArgList &Args) const {
345  return HostTC.GetCXXStdlibType(Args);
346 }
347 
349  const ArgList &DriverArgs, ArgStringList &CC1Args) const {
350  HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
351 }
352 
354  ArgStringList &CC1Args) const {
355  HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
356 }
357 
359  // The AMDGPUOpenMPToolChain only supports sanitizers in the sense that it
360  // allows sanitizer arguments on the command line if they are supported by the
361  // host toolchain. The AMDGPUOpenMPToolChain will actually ignore any command
362  // line arguments for any of these "supported" sanitizers. That means that no
363  // sanitization of device code is actually supported at this time.
364  //
365  // This behavior is necessary because the host and device toolchains
366  // invocations often share the command line, so the device toolchain must
367  // tolerate flags meant only for the host toolchain.
369 }
370 
371 VersionTuple
373  const ArgList &Args) const {
374  return HostTC.computeMSVCVersion(D, Args);
375 }
clang::driver::toolchains
Definition: AIX.h:55
clang::driver::ToolChain::getProgramPaths
path_list & getProgramPaths()
Definition: ToolChain.h:269
Driver.h
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::toolchains::AMDGPUOpenMPToolChain::AddIAMCUIncludeArgs
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use MCU GCC toolchain includes.
Definition: AMDGPUOpenMP.cpp:353
clang::driver::toolchains::AMDGPUOpenMPToolChain::TranslateArgs
llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch, Action::OffloadKind DeviceOffloadKind) const override
TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may w...
Definition: AMDGPUOpenMP.cpp:295
clang::driver::ToolChain::computeMSVCVersion
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1120
AMDGPUOpenMP.h
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::toolchains::AMDGPUOpenMPToolChain::GetCXXStdlibType
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: AMDGPUOpenMP.cpp:344
clang::driver::tools
Definition: AIX.h:17
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:55
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:228
clang::driver::ToolChain::addClangWarningOptions
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:808
clang::driver::Driver::getOpts
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:358
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::Action::OFK_OpenMP
@ OFK_OpenMP
Definition: Action.h:96
InputInfo.h
clang::driver::Driver::Diag
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:132
clang::driver::tools::AddStaticDeviceLibsLinking
void AddStaticDeviceLibsLinking(Compilation &C, const Tool &T, const JobAction &JA, const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL, bool postClangLink)
Definition: CommonArgs.cpp:1857
DiagnosticDriver.h
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
Options.h
clang::driver::toolchains::AMDGPUOpenMPToolChain::AMDGPUOpenMPToolChain
AMDGPUOpenMPToolChain(const Driver &D, const llvm::Triple &Triple, const ToolChain &HostTC, const llvm::opt::ArgList &Args)
Definition: AMDGPUOpenMP.cpp:257
llvm::opt
Definition: DiagnosticOptions.h:19
clang::driver::toolchains::AMDGPUOpenMPToolChain::addClangWarningOptions
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override
Add warning options that need to be passed to cc1 for this target.
Definition: AMDGPUOpenMP.cpp:338
DriverDiagnostic.h
clang::driver::ResponseFileSupport::AtFileCurCP
static constexpr ResponseFileSupport AtFileCurCP()
Definition: Job.h:92
clang::driver::ToolChain::AddClangSystemIncludeArgs
virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add the clang cc1 arguments for system include paths.
Definition: ToolChain.cpp:799
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
Tool.h
clang::driver::tools::AMDGCN::OpenMPLinker
Definition: AMDGPUOpenMP.h:28
clang::driver::ToolChain::getTriple
const llvm::Triple & getTriple() const
Definition: ToolChain.h:230
clang::driver::toolchains::AMDGPUOpenMPToolChain::buildLinker
Tool * buildLinker() const override
Definition: AMDGPUOpenMP.cpp:333
Base
AMDGPU.h
clang::driver::toolchains::AMDGPUOpenMPToolChain::getSupportedSanitizers
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: AMDGPUOpenMP.cpp:358
clang::driver::tools::addOpenMPDeviceRTL
void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, StringRef BitcodeSuffix, const llvm::Triple &Triple)
Definition: CommonArgs.cpp:2050
clang::driver::toolchains::AMDGPUOpenMPToolChain
Definition: AMDGPUOpenMP.h:68
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1067
ROCm.h
clang::driver::toolchains::AMDGPUOpenMPToolChain::addClangTargetOptions
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const override
Add options that need to be passed to cc1 for this target.
Definition: AMDGPUOpenMP.cpp:267
Compilation.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::toolchains::ROCMToolChain::getCommonDeviceLibNames
llvm::SmallVector< std::string, 12 > getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs, const std::string &GPUArch, bool isOpenMP=false) const
Definition: AMDGPU.cpp:922
clang::driver::toolchains::AMDGPUOpenMPToolChain::AddClangSystemIncludeArgs
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: AMDGPUOpenMP.cpp:348
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::ToolChain::GetCXXStdlibType
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:880
clang::driver::ToolChain::AddIAMCUIncludeArgs
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1103
clang::driver::InputInfo::getFilename
const char * getFilename() const
Definition: InputInfo.h:83
CommonArgs.h
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:71
clang::driver::ToolChain::TranslateArgs
virtual llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch, Action::OffloadKind DeviceOffloadKind) const
TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may w...
Definition: ToolChain.h:313
clang::driver::toolchains::ROCMToolChain
Definition: AMDGPU.h:133
clang::driver::ToolChain::addClangTargetOptions
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:804
clang::driver::toolchains::AMDGPUOpenMPToolChain::computeMSVCVersion
VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const override
On Windows, returns the MSVC compatibility version.
Definition: AMDGPUOpenMP.cpp:372
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:88
clang::driver
Definition: Action.h:31
clang::driver::JobAction
Definition: Action.h:395
clang::driver::toolchains::AMDGPUToolChain::getSystemGPUArch
llvm::Error getSystemGPUArch(const llvm::opt::ArgList &Args, std::string &GPUArch) const
Uses amdgpu_arch tool to get arch of the system GPU.
Definition: AMDGPU.cpp:793
clang::driver::toolchains::AMDGPUOpenMPToolChain::HostTC
const ToolChain & HostTC
Definition: AMDGPUOpenMP.h:100
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::driver::toolchains::AMDGPUToolChain
Definition: AMDGPU.h:49