clang 18.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 "clang/Basic/Cuda.h"
16#include "clang/Driver/Driver.h"
21#include "llvm/Support/Alignment.h"
22#include "llvm/Support/FileSystem.h"
23#include "llvm/Support/Path.h"
24#include "llvm/TargetParser/TargetParser.h"
25
26using namespace clang::driver;
27using namespace clang::driver::toolchains;
28using namespace clang::driver::tools;
29using namespace clang;
30using namespace llvm::opt;
31
32#if defined(_WIN32) || defined(_WIN64)
33#define NULL_FILE "nul"
34#else
35#define NULL_FILE "/dev/null"
36#endif
37
38static bool shouldSkipSanitizeOption(const ToolChain &TC,
39 const llvm::opt::ArgList &DriverArgs,
40 StringRef TargetID,
41 const llvm::opt::Arg *A) {
42 // For actions without targetID, do nothing.
43 if (TargetID.empty())
44 return false;
45 Option O = A->getOption();
46 if (!O.matches(options::OPT_fsanitize_EQ))
47 return false;
48
49 if (!DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
50 options::OPT_fno_gpu_sanitize, true))
51 return true;
52
53 auto &Diags = TC.getDriver().getDiags();
54
55 // For simplicity, we only allow -fsanitize=address
56 SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
57 if (K != SanitizerKind::Address)
58 return true;
59
60 llvm::StringMap<bool> FeatureMap;
61 auto OptionalGpuArch = parseTargetID(TC.getTriple(), TargetID, &FeatureMap);
62
63 assert(OptionalGpuArch && "Invalid Target ID");
64 (void)OptionalGpuArch;
65 auto Loc = FeatureMap.find("xnack");
66 if (Loc == FeatureMap.end() || !Loc->second) {
67 Diags.Report(
68 clang::diag::warn_drv_unsupported_option_for_offload_arch_req_feature)
69 << A->getAsString(DriverArgs) << TargetID << "xnack+";
70 return true;
71 }
72 return false;
73}
74
75void AMDGCN::Linker::constructLlvmLinkCommand(Compilation &C,
76 const JobAction &JA,
77 const InputInfoList &Inputs,
78 const InputInfo &Output,
79 const llvm::opt::ArgList &Args) const {
80 // Construct llvm-link command.
81 // The output from llvm-link is a bitcode file.
82 ArgStringList LlvmLinkArgs;
83
84 assert(!Inputs.empty() && "Must have at least one input.");
85
86 LlvmLinkArgs.append({"-o", Output.getFilename()});
87 for (auto Input : Inputs)
88 LlvmLinkArgs.push_back(Input.getFilename());
89
90 // Look for archive of bundled bitcode in arguments, and add temporary files
91 // for the extracted archive of bitcode to inputs.
92 auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
93 AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LlvmLinkArgs, "amdgcn",
94 TargetID, /*IsBitCodeSDL=*/true);
95
96 const char *LlvmLink =
97 Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
98 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
99 LlvmLink, LlvmLinkArgs, Inputs,
100 Output));
101}
102
103void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
104 const InputInfoList &Inputs,
105 const InputInfo &Output,
106 const llvm::opt::ArgList &Args) const {
107 // Construct lld command.
108 // The output from ld.lld is an HSA code object file.
109 ArgStringList LldArgs{"-flavor",
110 "gnu",
111 "-m",
112 "elf64_amdgpu",
113 "--no-undefined",
114 "-shared",
115 "-plugin-opt=-amdgpu-internalize-symbols"};
116
117 auto &TC = getToolChain();
118 auto &D = TC.getDriver();
119 assert(!Inputs.empty() && "Must have at least one input.");
120 bool IsThinLTO = D.getLTOMode(/*IsOffload=*/true) == LTOK_Thin;
121 addLTOOptions(TC, Args, LldArgs, Output, Inputs[0], IsThinLTO);
122
123 // Extract all the -m options
124 std::vector<llvm::StringRef> Features;
125 amdgpu::getAMDGPUTargetFeatures(D, TC.getTriple(), Args, Features);
126
127 // Add features to mattr such as cumode
128 std::string MAttrString = "-plugin-opt=-mattr=";
129 for (auto OneFeature : unifyTargetFeatures(Features)) {
130 MAttrString.append(Args.MakeArgString(OneFeature));
131 if (OneFeature != Features.back())
132 MAttrString.append(",");
133 }
134 if (!Features.empty())
135 LldArgs.push_back(Args.MakeArgString(MAttrString));
136
137 // ToDo: Remove this option after AMDGPU backend supports ISA-level linking.
138 // Since AMDGPU backend currently does not support ISA-level linking, all
139 // called functions need to be imported.
140 if (IsThinLTO)
141 LldArgs.push_back(Args.MakeArgString("-plugin-opt=-force-import-all"));
142
143 if (C.getDriver().isSaveTempsEnabled())
144 LldArgs.push_back("-save-temps");
145
146 addLinkerCompressDebugSectionsOption(TC, Args, LldArgs);
147
148 // Given that host and device linking happen in separate processes, the device
149 // linker doesn't always have the visibility as to which device symbols are
150 // needed by a program, especially for the device symbol dependencies that are
151 // introduced through the host symbol resolution.
152 // For example: host_A() (A.obj) --> host_B(B.obj) --> device_kernel_B()
153 // (B.obj) In this case, the device linker doesn't know that A.obj actually
154 // depends on the kernel functions in B.obj. When linking to static device
155 // library, the device linker may drop some of the device global symbols if
156 // they aren't referenced. As a workaround, we are adding to the
157 // --whole-archive flag such that all global symbols would be linked in.
158 LldArgs.push_back("--whole-archive");
159
160 for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) {
161 StringRef ArgVal = Arg->getValue(1);
162 auto SplitArg = ArgVal.split("-mllvm=");
163 if (!SplitArg.second.empty()) {
164 LldArgs.push_back(
165 Args.MakeArgString(Twine("-plugin-opt=") + SplitArg.second));
166 } else {
167 LldArgs.push_back(Args.MakeArgString(ArgVal));
168 }
169 Arg->claim();
170 }
171
172 LldArgs.append({"-o", Output.getFilename()});
173 for (auto Input : Inputs)
174 LldArgs.push_back(Input.getFilename());
175
176 // Look for archive of bundled bitcode in arguments, and add temporary files
177 // for the extracted archive of bitcode to inputs.
178 auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
179 AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LldArgs, "amdgcn",
180 TargetID, /*IsBitCodeSDL=*/true);
181
182 LldArgs.push_back("--no-whole-archive");
183
184 const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
185 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
186 Lld, LldArgs, Inputs, Output));
187}
188
189// For amdgcn the inputs of the linker job are device bitcode and output is
190// either an object file or bitcode (-emit-llvm). It calls llvm-link, opt,
191// llc, then lld steps.
193 const InputInfo &Output,
194 const InputInfoList &Inputs,
195 const ArgList &Args,
196 const char *LinkingOutput) const {
197 if (Inputs.size() > 0 &&
198 Inputs[0].getType() == types::TY_Image &&
199 JA.getType() == types::TY_Object)
201 Args, JA, *this);
202
203 if (JA.getType() == types::TY_HIP_FATBIN)
204 return HIP::constructHIPFatbinCommand(C, JA, Output.getFilename(), Inputs,
205 Args, *this);
206
207 if (JA.getType() == types::TY_LLVM_BC)
208 return constructLlvmLinkCommand(C, JA, Inputs, Output, Args);
209
210 return constructLldCommand(C, JA, Inputs, Output, Args);
211}
212
213HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
214 const ToolChain &HostTC, const ArgList &Args)
215 : ROCMToolChain(D, Triple, Args), HostTC(HostTC) {
216 // Lookup binaries into the driver directory, this is used to
217 // discover the clang-offload-bundler executable.
218 getProgramPaths().push_back(getDriver().Dir);
219
220 // Diagnose unsupported sanitizer options only once.
221 if (!Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
222 true))
223 return;
224 for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) {
225 SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
226 if (K != SanitizerKind::Address)
227 D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
228 << A->getAsString(Args) << getTriple().str();
229 }
230}
231
233 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
234 Action::OffloadKind DeviceOffloadingKind) const {
235 HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
236
237 assert(DeviceOffloadingKind == Action::OFK_HIP &&
238 "Only HIP offloading kinds are supported for GPUs.");
239
240 CC1Args.push_back("-fcuda-is-device");
241
242 if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
243 false))
244 CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
245
246 StringRef MaxThreadsPerBlock =
247 DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ);
248 if (!MaxThreadsPerBlock.empty()) {
249 std::string ArgStr =
250 (Twine("--gpu-max-threads-per-block=") + MaxThreadsPerBlock).str();
251 CC1Args.push_back(DriverArgs.MakeArgStringRef(ArgStr));
252 }
253
254 CC1Args.push_back("-fcuda-allow-variadic-functions");
255
256 // Default to "hidden" visibility, as object level linking will not be
257 // supported for the foreseeable future.
258 if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
259 options::OPT_fvisibility_ms_compat)) {
260 CC1Args.append({"-fvisibility=hidden"});
261 CC1Args.push_back("-fapply-global-visibility-to-externs");
262 }
263
264 for (auto BCFile : getDeviceLibs(DriverArgs)) {
265 CC1Args.push_back(BCFile.ShouldInternalize ? "-mlink-builtin-bitcode"
266 : "-mlink-bitcode-file");
267 CC1Args.push_back(DriverArgs.MakeArgString(BCFile.Path));
268 }
269}
270
271llvm::opt::DerivedArgList *
272HIPAMDToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
273 StringRef BoundArch,
274 Action::OffloadKind DeviceOffloadKind) const {
275 DerivedArgList *DAL =
276 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
277 if (!DAL)
278 DAL = new DerivedArgList(Args.getBaseArgs());
279
280 const OptTable &Opts = getDriver().getOpts();
281
282 for (Arg *A : Args) {
283 if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A))
284 DAL->append(A);
285 }
286
287 if (!BoundArch.empty()) {
288 DAL->eraseArg(options::OPT_mcpu_EQ);
289 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_mcpu_EQ), BoundArch);
290 checkTargetID(*DAL);
291 }
292
293 return DAL;
294}
295
297 assert(getTriple().getArch() == llvm::Triple::amdgcn);
298 return new tools::AMDGCN::Linker(*this);
299}
300
301void HIPAMDToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {
303}
304
306HIPAMDToolChain::GetCXXStdlibType(const ArgList &Args) const {
307 return HostTC.GetCXXStdlibType(Args);
308}
309
310void HIPAMDToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
311 ArgStringList &CC1Args) const {
312 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
313}
314
316 const ArgList &Args, ArgStringList &CC1Args) const {
318}
319
321 ArgStringList &CC1Args) const {
322 HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
323}
324
325void HIPAMDToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs,
326 ArgStringList &CC1Args) const {
327 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
328}
329
331 // The HIPAMDToolChain only supports sanitizers in the sense that it allows
332 // sanitizer arguments on the command line if they are supported by the host
333 // toolchain. The HIPAMDToolChain will actually ignore any command line
334 // arguments for any of these "supported" sanitizers. That means that no
335 // sanitization of device code is actually supported at this time.
336 //
337 // This behavior is necessary because the host and device toolchains
338 // invocations often share the command line, so the device toolchain must
339 // tolerate flags meant only for the host toolchain.
341}
342
344 const ArgList &Args) const {
345 return HostTC.computeMSVCVersion(D, Args);
346}
347
349HIPAMDToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
351 if (DriverArgs.hasArg(options::OPT_nogpulib))
352 return {};
353 ArgStringList LibraryPaths;
354
355 // Find in --hip-device-lib-path and HIP_LIBRARY_PATH.
356 for (StringRef Path : RocmInstallation->getRocmDeviceLibPathArg())
357 LibraryPaths.push_back(DriverArgs.MakeArgString(Path));
358
359 addDirectoryList(DriverArgs, LibraryPaths, "", "HIP_DEVICE_LIB_PATH");
360
361 // Maintain compatability with --hip-device-lib.
362 auto BCLibArgs = DriverArgs.getAllArgValues(options::OPT_hip_device_lib_EQ);
363 if (!BCLibArgs.empty()) {
364 llvm::for_each(BCLibArgs, [&](StringRef BCName) {
365 StringRef FullName;
366 for (StringRef LibraryPath : LibraryPaths) {
367 SmallString<128> Path(LibraryPath);
368 llvm::sys::path::append(Path, BCName);
369 FullName = Path;
370 if (llvm::sys::fs::exists(FullName)) {
371 BCLibs.push_back(FullName);
372 return;
373 }
374 }
375 getDriver().Diag(diag::err_drv_no_such_file) << BCName;
376 });
377 } else {
378 if (!RocmInstallation->hasDeviceLibrary()) {
379 getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
380 return {};
381 }
382 StringRef GpuArch = getGPUArch(DriverArgs);
383 assert(!GpuArch.empty() && "Must have an explicit GPU arch.");
384
385 // If --hip-device-lib is not set, add the default bitcode libraries.
386 if (DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
387 options::OPT_fno_gpu_sanitize, true) &&
388 getSanitizerArgs(DriverArgs).needsAsanRt()) {
389 auto AsanRTL = RocmInstallation->getAsanRTLPath();
390 if (AsanRTL.empty()) {
391 unsigned DiagID = getDriver().getDiags().getCustomDiagID(
393 "AMDGPU address sanitizer runtime library (asanrtl) is not found. "
394 "Please install ROCm device library which supports address "
395 "sanitizer");
396 getDriver().Diag(DiagID);
397 return {};
398 } else
399 BCLibs.emplace_back(AsanRTL, /*ShouldInternalize=*/false);
400 }
401
402 // Add the HIP specific bitcode library.
403 BCLibs.push_back(RocmInstallation->getHIPPath());
404
405 // Add common device libraries like ocml etc.
406 for (StringRef N : getCommonDeviceLibNames(DriverArgs, GpuArch.str()))
407 BCLibs.emplace_back(N);
408
409 // Add instrument lib.
410 auto InstLib =
411 DriverArgs.getLastArgValue(options::OPT_gpu_instrument_lib_EQ);
412 if (InstLib.empty())
413 return BCLibs;
414 if (llvm::sys::fs::exists(InstLib))
415 BCLibs.push_back(InstLib);
416 else
417 getDriver().Diag(diag::err_drv_no_such_file) << InstLib;
418 }
419
420 return BCLibs;
421}
422
424 const llvm::opt::ArgList &DriverArgs) const {
425 auto PTID = getParsedTargetID(DriverArgs);
426 if (PTID.OptionalTargetID && !PTID.OptionalGPUArch) {
427 getDriver().Diag(clang::diag::err_drv_bad_target_id)
428 << *PTID.OptionalTargetID;
429 }
430}
static bool shouldSkipSanitizeOption(const ToolChain &TC, const llvm::opt::ArgList &DriverArgs, StringRef TargetID, const llvm::opt::Arg *A)
Definition: HIPAMD.cpp:38
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1542
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Definition: Diagnostic.h:868
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:390
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:144
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:388
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:1035
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:261
const Driver & getDriver() const
Definition: ToolChain.h:245
path_list & getProgramPaths()
Definition: ToolChain.h:290
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:348
const llvm::Triple & getTriple() const
Definition: ToolChain.h:247
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:1203
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1361
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1344
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:274
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:1107
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:1028
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:1023
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1308
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:764
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:770
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Gnu.h:291
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: HIPAMD.cpp:330
Tool * buildLinker() const override
Definition: HIPAMD.cpp:296
HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple, const ToolChain &HostTC, const llvm::opt::ArgList &Args)
Definition: HIPAMD.cpp:213
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:272
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:232
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:310
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use MCU GCC toolchain includes.
Definition: HIPAMD.cpp:320
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:315
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: HIPAMD.cpp:325
void checkTargetID(const llvm::opt::ArgList &DriverArgs) const override
Check and diagnose invalid target ID specified by -mcpu.
Definition: HIPAMD.cpp:423
VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const override
On Windows, returns the MSVC compatibility version.
Definition: HIPAMD.cpp:343
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override
Add warning options that need to be passed to cc1 for this target.
Definition: HIPAMD.cpp:301
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: HIPAMD.cpp:306
llvm::SmallVector< BitCodeLibraryInfo, 12 > getDeviceLibs(const llvm::opt::ArgList &Args) const override
Get paths for device libraries.
Definition: HIPAMD.cpp:349
llvm::SmallVector< std::string, 12 > getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs, const std::string &GPUArch, bool isOpenMP=false) const
Definition: AMDGPU.cpp:915
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:192
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 getAMDGPUTargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
Definition: AMDGPU.cpp:573
SmallVector< StringRef > unifyTargetFeatures(ArrayRef< StringRef > Features)
If there are multiple +xxx or -xxx features, keep the last one.
Definition: CommonArgs.cpp:190
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:306
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
std::optional< llvm::StringRef > parseTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch, llvm::StringMap< bool > *FeatureMap)
Parse a target ID to get processor and feature map.
Definition: TargetID.cpp:105
@ C
Languages that the frontend can parse and compile.
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