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