clang 20.0.0git
HIPAMD.cpp
Go to the documentation of this file.
1//===--- HIPAMD.cpp - HIP Tool and ToolChain Implementations ----*- 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 "HIPAMD.h"
10#include "AMDGPU.h"
11#include "CommonArgs.h"
12#include "HIPUtility.h"
13#include "SPIRV.h"
14#include "clang/Basic/Cuda.h"
17#include "clang/Driver/Driver.h"
22#include "llvm/Support/Alignment.h"
23#include "llvm/Support/FileSystem.h"
24#include "llvm/Support/Path.h"
25#include "llvm/TargetParser/TargetParser.h"
26
27using namespace clang::driver;
28using namespace clang::driver::toolchains;
29using namespace clang::driver::tools;
30using namespace clang;
31using namespace llvm::opt;
32
33#if defined(_WIN32) || defined(_WIN64)
34#define NULL_FILE "nul"
35#else
36#define NULL_FILE "/dev/null"
37#endif
38
39void AMDGCN::Linker::constructLlvmLinkCommand(Compilation &C,
40 const JobAction &JA,
41 const InputInfoList &Inputs,
42 const InputInfo &Output,
43 const llvm::opt::ArgList &Args) const {
44 // Construct llvm-link command.
45 // The output from llvm-link is a bitcode file.
46 ArgStringList LlvmLinkArgs;
47
48 assert(!Inputs.empty() && "Must have at least one input.");
49
50 LlvmLinkArgs.append({"-o", Output.getFilename()});
51 for (auto Input : Inputs)
52 LlvmLinkArgs.push_back(Input.getFilename());
53
54 // Look for archive of bundled bitcode in arguments, and add temporary files
55 // for the extracted archive of bitcode to inputs.
56 auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
57 AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LlvmLinkArgs, "amdgcn",
58 TargetID, /*IsBitCodeSDL=*/true);
59
60 const char *LlvmLink =
61 Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
62 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
63 LlvmLink, LlvmLinkArgs, Inputs,
64 Output));
65}
66
67void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
68 const InputInfoList &Inputs,
69 const InputInfo &Output,
70 const llvm::opt::ArgList &Args) const {
71 // Construct lld command.
72 // The output from ld.lld is an HSA code object file.
73 ArgStringList LldArgs{"-flavor",
74 "gnu",
75 "-m",
76 "elf64_amdgpu",
77 "--no-undefined",
78 "-shared",
79 "-plugin-opt=-amdgpu-internalize-symbols"};
80 if (Args.hasArg(options::OPT_hipstdpar))
81 LldArgs.push_back("-plugin-opt=-amdgpu-enable-hipstdpar");
82
83 auto &TC = getToolChain();
84 auto &D = TC.getDriver();
85 assert(!Inputs.empty() && "Must have at least one input.");
86 bool IsThinLTO = D.getOffloadLTOMode() == LTOK_Thin;
87 addLTOOptions(TC, Args, LldArgs, Output, Inputs[0], IsThinLTO);
88
89 // Extract all the -m options
90 std::vector<llvm::StringRef> Features;
91 amdgpu::getAMDGPUTargetFeatures(D, TC.getTriple(), Args, Features);
92
93 // Add features to mattr such as cumode
94 std::string MAttrString = "-plugin-opt=-mattr=";
95 for (auto OneFeature : unifyTargetFeatures(Features)) {
96 MAttrString.append(Args.MakeArgString(OneFeature));
97 if (OneFeature != Features.back())
98 MAttrString.append(",");
99 }
100 if (!Features.empty())
101 LldArgs.push_back(Args.MakeArgString(MAttrString));
102
103 // ToDo: Remove this option after AMDGPU backend supports ISA-level linking.
104 // Since AMDGPU backend currently does not support ISA-level linking, all
105 // called functions need to be imported.
106 if (IsThinLTO)
107 LldArgs.push_back(Args.MakeArgString("-plugin-opt=-force-import-all"));
108
109 for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
110 LldArgs.push_back(
111 Args.MakeArgString(Twine("-plugin-opt=") + A->getValue(0)));
112 }
113
114 if (C.getDriver().isSaveTempsEnabled())
115 LldArgs.push_back("-save-temps");
116
117 addLinkerCompressDebugSectionsOption(TC, Args, LldArgs);
118
119 // Given that host and device linking happen in separate processes, the device
120 // linker doesn't always have the visibility as to which device symbols are
121 // needed by a program, especially for the device symbol dependencies that are
122 // introduced through the host symbol resolution.
123 // For example: host_A() (A.obj) --> host_B(B.obj) --> device_kernel_B()
124 // (B.obj) In this case, the device linker doesn't know that A.obj actually
125 // depends on the kernel functions in B.obj. When linking to static device
126 // library, the device linker may drop some of the device global symbols if
127 // they aren't referenced. As a workaround, we are adding to the
128 // --whole-archive flag such that all global symbols would be linked in.
129 LldArgs.push_back("--whole-archive");
130
131 for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) {
132 StringRef ArgVal = Arg->getValue(1);
133 auto SplitArg = ArgVal.split("-mllvm=");
134 if (!SplitArg.second.empty()) {
135 LldArgs.push_back(
136 Args.MakeArgString(Twine("-plugin-opt=") + SplitArg.second));
137 } else {
138 LldArgs.push_back(Args.MakeArgString(ArgVal));
139 }
140 Arg->claim();
141 }
142
143 LldArgs.append({"-o", Output.getFilename()});
144 for (auto Input : Inputs)
145 LldArgs.push_back(Input.getFilename());
146
147 // Look for archive of bundled bitcode in arguments, and add temporary files
148 // for the extracted archive of bitcode to inputs.
149 auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
150 AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LldArgs, "amdgcn",
151 TargetID, /*IsBitCodeSDL=*/true);
152
153 LldArgs.push_back("--no-whole-archive");
154
155 const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
156 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
157 Lld, LldArgs, Inputs, Output));
158}
159
160// For SPIR-V the inputs for the job are device AMDGCN SPIR-V flavoured bitcode
161// and the output is either a compiled SPIR-V binary or bitcode (-emit-llvm). It
162// calls llvm-link and then the llvm-spirv translator. Once the SPIR-V BE will
163// be promoted from experimental, we will switch to using that. TODO: consider
164// if we want to run any targeted optimisations over IR here, over generic
165// SPIR-V.
166void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
167 Compilation &C, const JobAction &JA, const InputInfoList &Inputs,
168 const InputInfo &Output, const llvm::opt::ArgList &Args) const {
169 assert(!Inputs.empty() && "Must have at least one input.");
170
171 constructLlvmLinkCommand(C, JA, Inputs, Output, Args);
172
173 // Linked BC is now in Output
174
175 // Emit SPIR-V binary.
176 llvm::opt::ArgStringList TrArgs{
177 "--spirv-max-version=1.6",
178 "--spirv-ext=+all",
179 "--spirv-allow-extra-diexpressions",
180 "--spirv-allow-unknown-intrinsics",
181 "--spirv-lower-const-expr",
182 "--spirv-preserve-auxdata",
183 "--spirv-debug-info-version=nonsemantic-shader-200"};
184 SPIRV::constructTranslateCommand(C, *this, JA, Output, Output, TrArgs);
185}
186
187// For amdgcn the inputs of the linker job are device bitcode and output is
188// either an object file or bitcode (-emit-llvm). It calls llvm-link, opt,
189// llc, then lld steps.
191 const InputInfo &Output,
192 const InputInfoList &Inputs,
193 const ArgList &Args,
194 const char *LinkingOutput) const {
195 if (Inputs.size() > 0 &&
196 Inputs[0].getType() == types::TY_Image &&
197 JA.getType() == types::TY_Object)
199 Args, JA, *this);
200
201 if (JA.getType() == types::TY_HIP_FATBIN)
202 return HIP::constructHIPFatbinCommand(C, JA, Output.getFilename(), Inputs,
203 Args, *this);
204
205 if (JA.getType() == types::TY_LLVM_BC)
206 return constructLlvmLinkCommand(C, JA, Inputs, Output, Args);
207
208 if (getToolChain().getEffectiveTriple().isSPIRV())
209 return constructLinkAndEmitSpirvCommand(C, JA, Inputs, Output, Args);
210
211 return constructLldCommand(C, JA, Inputs, Output, Args);
212}
213
214HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
215 const ToolChain &HostTC, const ArgList &Args)
216 : ROCMToolChain(D, Triple, Args), HostTC(HostTC) {
217 // Lookup binaries into the driver directory, this is used to
218 // discover the clang-offload-bundler executable.
219 getProgramPaths().push_back(getDriver().Dir);
220
221 // Diagnose unsupported sanitizer options only once.
222 if (!Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
223 true))
224 return;
225 for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) {
226 SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
227 if (K != SanitizerKind::Address)
228 D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
229 << A->getAsString(Args) << getTriple().str();
230 }
231}
232
234 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
235 Action::OffloadKind DeviceOffloadingKind) const {
236 HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
237
238 assert(DeviceOffloadingKind == Action::OFK_HIP &&
239 "Only HIP offloading kinds are supported for GPUs.");
240
241 CC1Args.append({"-fcuda-is-device", "-fno-threadsafe-statics"});
242
243 if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
244 false))
245 CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
246 if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar))
247 CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"});
248
249 StringRef MaxThreadsPerBlock =
250 DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ);
251 if (!MaxThreadsPerBlock.empty()) {
252 std::string ArgStr =
253 (Twine("--gpu-max-threads-per-block=") + MaxThreadsPerBlock).str();
254 CC1Args.push_back(DriverArgs.MakeArgStringRef(ArgStr));
255 }
256
257 CC1Args.push_back("-fcuda-allow-variadic-functions");
258
259 // Default to "hidden" visibility, as object level linking will not be
260 // supported for the foreseeable future.
261 if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
262 options::OPT_fvisibility_ms_compat)) {
263 CC1Args.append({"-fvisibility=hidden"});
264 CC1Args.push_back("-fapply-global-visibility-to-externs");
265 }
266
267 if (getEffectiveTriple().isSPIRV()) {
268 // For SPIR-V we embed the command-line into the generated binary, in order
269 // to retrieve it at JIT time and be able to do target specific compilation
270 // with options that match the user-supplied ones.
271 if (!DriverArgs.hasArg(options::OPT_fembed_bitcode_marker))
272 CC1Args.push_back("-fembed-bitcode=marker");
273 return; // No DeviceLibs for SPIR-V.
274 }
275
276 for (auto BCFile : getDeviceLibs(DriverArgs)) {
277 CC1Args.push_back(BCFile.ShouldInternalize ? "-mlink-builtin-bitcode"
278 : "-mlink-bitcode-file");
279 CC1Args.push_back(DriverArgs.MakeArgString(BCFile.Path));
280 }
281}
282
283llvm::opt::DerivedArgList *
284HIPAMDToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
285 StringRef BoundArch,
286 Action::OffloadKind DeviceOffloadKind) const {
287 DerivedArgList *DAL =
288 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
289 if (!DAL)
290 DAL = new DerivedArgList(Args.getBaseArgs());
291
292 const OptTable &Opts = getDriver().getOpts();
293
294 for (Arg *A : Args) {
295 if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A))
296 DAL->append(A);
297 }
298
299 if (!BoundArch.empty()) {
300 DAL->eraseArg(options::OPT_mcpu_EQ);
301 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_mcpu_EQ), BoundArch);
302 checkTargetID(*DAL);
303 }
304
305 return DAL;
306}
307
309 assert(getTriple().getArch() == llvm::Triple::amdgcn ||
310 getTriple().getArch() == llvm::Triple::spirv64);
311 return new tools::AMDGCN::Linker(*this);
312}
313
314void HIPAMDToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {
317}
318
320HIPAMDToolChain::GetCXXStdlibType(const ArgList &Args) const {
321 return HostTC.GetCXXStdlibType(Args);
322}
323
324void HIPAMDToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
325 ArgStringList &CC1Args) const {
326 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
327}
328
330 const ArgList &Args, ArgStringList &CC1Args) const {
332}
333
335 ArgStringList &CC1Args) const {
336 HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
337}
338
339void HIPAMDToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs,
340 ArgStringList &CC1Args) const {
341 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
342}
343
345 // The HIPAMDToolChain only supports sanitizers in the sense that it allows
346 // sanitizer arguments on the command line if they are supported by the host
347 // toolchain. The HIPAMDToolChain will actually ignore any command line
348 // arguments for any of these "supported" sanitizers. That means that no
349 // sanitization of device code is actually supported at this time.
350 //
351 // This behavior is necessary because the host and device toolchains
352 // invocations often share the command line, so the device toolchain must
353 // tolerate flags meant only for the host toolchain.
355}
356
358 const ArgList &Args) const {
359 return HostTC.computeMSVCVersion(D, Args);
360}
361
363HIPAMDToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
365 if (DriverArgs.hasArg(options::OPT_nogpulib) ||
366 getGPUArch(DriverArgs) == "amdgcnspirv")
367 return {};
368 ArgStringList LibraryPaths;
369
370 // Find in --hip-device-lib-path and HIP_LIBRARY_PATH.
371 for (StringRef Path : RocmInstallation->getRocmDeviceLibPathArg())
372 LibraryPaths.push_back(DriverArgs.MakeArgString(Path));
373
374 addDirectoryList(DriverArgs, LibraryPaths, "", "HIP_DEVICE_LIB_PATH");
375
376 // Maintain compatability with --hip-device-lib.
377 auto BCLibArgs = DriverArgs.getAllArgValues(options::OPT_hip_device_lib_EQ);
378 if (!BCLibArgs.empty()) {
379 llvm::for_each(BCLibArgs, [&](StringRef BCName) {
380 StringRef FullName;
381 for (StringRef LibraryPath : LibraryPaths) {
382 SmallString<128> Path(LibraryPath);
383 llvm::sys::path::append(Path, BCName);
384 FullName = Path;
385 if (llvm::sys::fs::exists(FullName)) {
386 BCLibs.push_back(FullName);
387 return;
388 }
389 }
390 getDriver().Diag(diag::err_drv_no_such_file) << BCName;
391 });
392 } else {
393 if (!RocmInstallation->hasDeviceLibrary()) {
394 getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
395 return {};
396 }
397 StringRef GpuArch = getGPUArch(DriverArgs);
398 assert(!GpuArch.empty() && "Must have an explicit GPU arch.");
399
400 // If --hip-device-lib is not set, add the default bitcode libraries.
401 if (DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
402 options::OPT_fno_gpu_sanitize, true) &&
403 getSanitizerArgs(DriverArgs).needsAsanRt()) {
404 auto AsanRTL = RocmInstallation->getAsanRTLPath();
405 if (AsanRTL.empty()) {
406 unsigned DiagID = getDriver().getDiags().getCustomDiagID(
408 "AMDGPU address sanitizer runtime library (asanrtl) is not found. "
409 "Please install ROCm device library which supports address "
410 "sanitizer");
411 getDriver().Diag(DiagID);
412 return {};
413 } else
414 BCLibs.emplace_back(AsanRTL, /*ShouldInternalize=*/false);
415 }
416
417 // Add the HIP specific bitcode library.
418 BCLibs.push_back(RocmInstallation->getHIPPath());
419
420 // Add common device libraries like ocml etc.
421 for (StringRef N : getCommonDeviceLibNames(DriverArgs, GpuArch.str()))
422 BCLibs.emplace_back(N);
423
424 // Add instrument lib.
425 auto InstLib =
426 DriverArgs.getLastArgValue(options::OPT_gpu_instrument_lib_EQ);
427 if (InstLib.empty())
428 return BCLibs;
429 if (llvm::sys::fs::exists(InstLib))
430 BCLibs.push_back(InstLib);
431 else
432 getDriver().Diag(diag::err_drv_no_such_file) << InstLib;
433 }
434
435 return BCLibs;
436}
437
439 const llvm::opt::ArgList &DriverArgs) const {
440 auto PTID = getParsedTargetID(DriverArgs);
441 if (PTID.OptionalTargetID && !PTID.OptionalGPUArch &&
442 PTID.OptionalTargetID != "amdgcnspirv")
443 getDriver().Diag(clang::diag::err_drv_bad_target_id)
444 << *PTID.OptionalTargetID;
445}
const Decl * D
IndirectLocalPath & Path
int32_t FullName
Definition: SemaARM.cpp:1135
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Definition: Diagnostic.h:896
types::ID getType() const
Definition: Action.h:148
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
DiagnosticsEngine & getDiags() const
Definition: Driver.h:403
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:144
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:401
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
const char * getFilename() const
Definition: InputInfo.h:83
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:1167
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:268
const Driver & getDriver() const
Definition: ToolChain.h:252
path_list & getProgramPaths()
Definition: ToolChain.h:297
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:358
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:282
const llvm::Triple & getTriple() const
Definition: ToolChain.h:254
virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: ToolChain.cpp:1335
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1510
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1493
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:378
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:1239
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:1160
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:1155
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1456
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
const ToolChain & getToolChain() const
Definition: Tool.h:52
StringRef getGPUArch(const llvm::opt::ArgList &DriverArgs) const
Get GPU arch from -mcpu without checking.
Definition: AMDGPU.cpp:874
bool shouldSkipSanitizeOption(const ToolChain &TC, const llvm::opt::ArgList &DriverArgs, StringRef TargetID, const llvm::opt::Arg *A) const
Should skip sanitize options.
Definition: AMDGPU.cpp:1067
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override
Common warning options shared by AMDGPU HIP, OpenCL and OpenMP toolchains.
Definition: AMDGPU.cpp:867
ParsedTargetIDType getParsedTargetID(const llvm::opt::ArgList &DriverArgs) const
Get target ID, GPU arch, and target ID features if the target ID is specified and valid.
Definition: AMDGPU.cpp:880
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Gnu.h:290
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: HIPAMD.cpp:344
Tool * buildLinker() const override
Definition: HIPAMD.cpp:308
HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple, const ToolChain &HostTC, const llvm::opt::ArgList &Args)
Definition: HIPAMD.cpp:214
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: HIPAMD.cpp:284
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: HIPAMD.cpp:233
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: HIPAMD.cpp:324
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use MCU GCC toolchain includes.
Definition: HIPAMD.cpp:334
void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CC1Args) const override
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: HIPAMD.cpp:329
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: HIPAMD.cpp:339
void checkTargetID(const llvm::opt::ArgList &DriverArgs) const override
Check and diagnose invalid target ID specified by -mcpu.
Definition: HIPAMD.cpp:438
VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const override
On Windows, returns the MSVC compatibility version.
Definition: HIPAMD.cpp:357
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override
Common warning options shared by AMDGPU HIP, OpenCL and OpenMP toolchains.
Definition: HIPAMD.cpp:314
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: HIPAMD.cpp:320
llvm::SmallVector< BitCodeLibraryInfo, 12 > getDeviceLibs(const llvm::opt::ArgList &Args) const override
Get paths for device libraries.
Definition: HIPAMD.cpp:363
llvm::SmallVector< std::string, 12 > getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs, const std::string &GPUArch, bool isOpenMP=false) const
Definition: AMDGPU.cpp:1031
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs,...
Definition: HIPAMD.cpp:190
void constructHIPFatbinCommand(Compilation &C, const JobAction &JA, StringRef OutputFileName, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const Tool &T)
void constructGenerateObjFileFromHIPFatBinary(Compilation &C, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, const JobAction &JA, const Tool &T)
void constructTranslateCommand(Compilation &C, const Tool &T, const JobAction &JA, const InputInfo &Output, const InputInfo &Input, const llvm::opt::ArgStringList &Args)
Definition: SPIRV.cpp:21
void getAMDGPUTargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
Definition: AMDGPU.cpp:669
SmallVector< StringRef > unifyTargetFeatures(ArrayRef< StringRef > Features)
If there are multiple +xxx or -xxx features, keep the last one.
Definition: CommonArgs.cpp:383
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)
void addDirectoryList(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const char *ArgName, const char *EnvVar)
EnvVar is split by system delimiter for environment variables.
void addLinkerCompressDebugSectionsOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Definition: CommonArgs.cpp:532
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
The JSON file list parser is used to communicate input to InstallAPI.
SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups)
Parse a single value from a -fsanitize= or -fno-sanitize= value list.
Definition: Sanitizers.cpp:29
static constexpr ResponseFileSupport None()
Returns a ResponseFileSupport indicating that response files are not supported.
Definition: Job.h:78