clang 17.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,
95 /*IsBitCodeSDL=*/true,
96 /*PostClangLink=*/false);
97
98 const char *LlvmLink =
99 Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
100 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
101 LlvmLink, LlvmLinkArgs, Inputs,
102 Output));
103}
104
105void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
106 const InputInfoList &Inputs,
107 const InputInfo &Output,
108 const llvm::opt::ArgList &Args) const {
109 // Construct lld command.
110 // The output from ld.lld is an HSA code object file.
111 ArgStringList LldArgs{"-flavor",
112 "gnu",
113 "-m",
114 "elf64_amdgpu",
115 "--no-undefined",
116 "-shared",
117 "-plugin-opt=-amdgpu-internalize-symbols"};
118
119 auto &TC = getToolChain();
120 auto &D = TC.getDriver();
121 assert(!Inputs.empty() && "Must have at least one input.");
122 bool IsThinLTO = D.getLTOMode(/*IsOffload=*/true) == LTOK_Thin;
123 addLTOOptions(TC, Args, LldArgs, Output, Inputs[0], IsThinLTO);
124
125 // Extract all the -m options
126 std::vector<llvm::StringRef> Features;
127 amdgpu::getAMDGPUTargetFeatures(D, TC.getTriple(), Args, Features);
128
129 // Add features to mattr such as cumode
130 std::string MAttrString = "-plugin-opt=-mattr=";
131 for (auto OneFeature : unifyTargetFeatures(Features)) {
132 MAttrString.append(Args.MakeArgString(OneFeature));
133 if (OneFeature != Features.back())
134 MAttrString.append(",");
135 }
136 if (!Features.empty())
137 LldArgs.push_back(Args.MakeArgString(MAttrString));
138
139 // ToDo: Remove this option after AMDGPU backend supports ISA-level linking.
140 // Since AMDGPU backend currently does not support ISA-level linking, all
141 // called functions need to be imported.
142 if (IsThinLTO)
143 LldArgs.push_back(Args.MakeArgString("-plugin-opt=-force-import-all"));
144
145 for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
146 LldArgs.push_back(
147 Args.MakeArgString(Twine("-plugin-opt=") + A->getValue(0)));
148 }
149
150 if (C.getDriver().isSaveTempsEnabled())
151 LldArgs.push_back("-save-temps");
152
153 addLinkerCompressDebugSectionsOption(TC, Args, LldArgs);
154
155 for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker)) {
156 LldArgs.push_back(Arg->getValue(1));
157 Arg->claim();
158 }
159
160 LldArgs.append({"-o", Output.getFilename()});
161 for (auto Input : Inputs)
162 LldArgs.push_back(Input.getFilename());
163
164 // Look for archive of bundled bitcode in arguments, and add temporary files
165 // for the extracted archive of bitcode to inputs.
166 auto TargetID = Args.getLastArgValue(options::OPT_mcpu_EQ);
167 AddStaticDeviceLibsLinking(C, *this, JA, Inputs, Args, LldArgs, "amdgcn",
168 TargetID,
169 /*IsBitCodeSDL=*/true,
170 /*PostClangLink=*/false);
171
172 const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
173 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
174 Lld, LldArgs, Inputs, Output));
175}
176
177// For amdgcn the inputs of the linker job are device bitcode and output is
178// either an object file or bitcode (-emit-llvm). It calls llvm-link, opt,
179// llc, then lld steps.
181 const InputInfo &Output,
182 const InputInfoList &Inputs,
183 const ArgList &Args,
184 const char *LinkingOutput) const {
185 if (Inputs.size() > 0 &&
186 Inputs[0].getType() == types::TY_Image &&
187 JA.getType() == types::TY_Object)
189 Args, JA, *this);
190
191 if (JA.getType() == types::TY_HIP_FATBIN)
192 return HIP::constructHIPFatbinCommand(C, JA, Output.getFilename(), Inputs,
193 Args, *this);
194
195 if (JA.getType() == types::TY_LLVM_BC)
196 return constructLlvmLinkCommand(C, JA, Inputs, Output, Args);
197
198 return constructLldCommand(C, JA, Inputs, Output, Args);
199}
200
201HIPAMDToolChain::HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
202 const ToolChain &HostTC, const ArgList &Args)
203 : ROCMToolChain(D, Triple, Args), HostTC(HostTC) {
204 // Lookup binaries into the driver directory, this is used to
205 // discover the clang-offload-bundler executable.
206 getProgramPaths().push_back(getDriver().Dir);
207
208 // Diagnose unsupported sanitizer options only once.
209 if (!Args.hasFlag(options::OPT_fgpu_sanitize, options::OPT_fno_gpu_sanitize,
210 true))
211 return;
212 for (auto *A : Args.filtered(options::OPT_fsanitize_EQ)) {
213 SanitizerMask K = parseSanitizerValue(A->getValue(), /*AllowGroups=*/false);
214 if (K != SanitizerKind::Address)
215 D.getDiags().Report(clang::diag::warn_drv_unsupported_option_for_target)
216 << A->getAsString(Args) << getTriple().str();
217 }
218}
219
221 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
222 Action::OffloadKind DeviceOffloadingKind) const {
223 HostTC.addClangTargetOptions(DriverArgs, CC1Args, DeviceOffloadingKind);
224
225 assert(DeviceOffloadingKind == Action::OFK_HIP &&
226 "Only HIP offloading kinds are supported for GPUs.");
227
228 CC1Args.push_back("-fcuda-is-device");
229
230 if (DriverArgs.hasFlag(options::OPT_fcuda_approx_transcendentals,
231 options::OPT_fno_cuda_approx_transcendentals, false))
232 CC1Args.push_back("-fcuda-approx-transcendentals");
233
234 if (!DriverArgs.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
235 false))
236 CC1Args.append({"-mllvm", "-amdgpu-internalize-symbols"});
237
238 StringRef MaxThreadsPerBlock =
239 DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ);
240 if (!MaxThreadsPerBlock.empty()) {
241 std::string ArgStr =
242 (Twine("--gpu-max-threads-per-block=") + MaxThreadsPerBlock).str();
243 CC1Args.push_back(DriverArgs.MakeArgStringRef(ArgStr));
244 }
245
246 CC1Args.push_back("-fcuda-allow-variadic-functions");
247
248 // Default to "hidden" visibility, as object level linking will not be
249 // supported for the foreseeable future.
250 if (!DriverArgs.hasArg(options::OPT_fvisibility_EQ,
251 options::OPT_fvisibility_ms_compat)) {
252 CC1Args.append({"-fvisibility=hidden"});
253 CC1Args.push_back("-fapply-global-visibility-to-externs");
254 }
255
256 for (auto BCFile : getDeviceLibs(DriverArgs)) {
257 CC1Args.push_back(BCFile.ShouldInternalize ? "-mlink-builtin-bitcode"
258 : "-mlink-bitcode-file");
259 CC1Args.push_back(DriverArgs.MakeArgString(BCFile.Path));
260 }
261}
262
263llvm::opt::DerivedArgList *
264HIPAMDToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
265 StringRef BoundArch,
266 Action::OffloadKind DeviceOffloadKind) const {
267 DerivedArgList *DAL =
268 HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
269 if (!DAL)
270 DAL = new DerivedArgList(Args.getBaseArgs());
271
272 const OptTable &Opts = getDriver().getOpts();
273
274 for (Arg *A : Args) {
275 if (!shouldSkipSanitizeOption(*this, Args, BoundArch, A))
276 DAL->append(A);
277 }
278
279 if (!BoundArch.empty()) {
280 DAL->eraseArg(options::OPT_mcpu_EQ);
281 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_mcpu_EQ), BoundArch);
282 checkTargetID(*DAL);
283 }
284
285 return DAL;
286}
287
289 assert(getTriple().getArch() == llvm::Triple::amdgcn);
290 return new tools::AMDGCN::Linker(*this);
291}
292
293void HIPAMDToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {
295}
296
298HIPAMDToolChain::GetCXXStdlibType(const ArgList &Args) const {
299 return HostTC.GetCXXStdlibType(Args);
300}
301
302void HIPAMDToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
303 ArgStringList &CC1Args) const {
304 HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
305}
306
308 const ArgList &Args, ArgStringList &CC1Args) const {
310}
311
313 ArgStringList &CC1Args) const {
314 HostTC.AddIAMCUIncludeArgs(Args, CC1Args);
315}
316
317void HIPAMDToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs,
318 ArgStringList &CC1Args) const {
319 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
320}
321
323 // The HIPAMDToolChain only supports sanitizers in the sense that it allows
324 // sanitizer arguments on the command line if they are supported by the host
325 // toolchain. The HIPAMDToolChain will actually ignore any command line
326 // arguments for any of these "supported" sanitizers. That means that no
327 // sanitization of device code is actually supported at this time.
328 //
329 // This behavior is necessary because the host and device toolchains
330 // invocations often share the command line, so the device toolchain must
331 // tolerate flags meant only for the host toolchain.
333}
334
336 const ArgList &Args) const {
337 return HostTC.computeMSVCVersion(D, Args);
338}
339
341HIPAMDToolChain::getDeviceLibs(const llvm::opt::ArgList &DriverArgs) const {
343 if (DriverArgs.hasArg(options::OPT_nogpulib))
344 return {};
345 ArgStringList LibraryPaths;
346
347 // Find in --hip-device-lib-path and HIP_LIBRARY_PATH.
348 for (StringRef Path : RocmInstallation->getRocmDeviceLibPathArg())
349 LibraryPaths.push_back(DriverArgs.MakeArgString(Path));
350
351 addDirectoryList(DriverArgs, LibraryPaths, "", "HIP_DEVICE_LIB_PATH");
352
353 // Maintain compatability with --hip-device-lib.
354 auto BCLibArgs = DriverArgs.getAllArgValues(options::OPT_hip_device_lib_EQ);
355 if (!BCLibArgs.empty()) {
356 llvm::for_each(BCLibArgs, [&](StringRef BCName) {
357 StringRef FullName;
358 for (StringRef LibraryPath : LibraryPaths) {
359 SmallString<128> Path(LibraryPath);
360 llvm::sys::path::append(Path, BCName);
361 FullName = Path;
362 if (llvm::sys::fs::exists(FullName)) {
363 BCLibs.push_back(FullName);
364 return;
365 }
366 }
367 getDriver().Diag(diag::err_drv_no_such_file) << BCName;
368 });
369 } else {
370 if (!RocmInstallation->hasDeviceLibrary()) {
371 getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
372 return {};
373 }
374 StringRef GpuArch = getGPUArch(DriverArgs);
375 assert(!GpuArch.empty() && "Must have an explicit GPU arch.");
376
377 // If --hip-device-lib is not set, add the default bitcode libraries.
378 if (DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
379 options::OPT_fno_gpu_sanitize, true) &&
380 getSanitizerArgs(DriverArgs).needsAsanRt()) {
381 auto AsanRTL = RocmInstallation->getAsanRTLPath();
382 if (AsanRTL.empty()) {
383 unsigned DiagID = getDriver().getDiags().getCustomDiagID(
385 "AMDGPU address sanitizer runtime library (asanrtl) is not found. "
386 "Please install ROCm device library which supports address "
387 "sanitizer");
388 getDriver().Diag(DiagID);
389 return {};
390 } else
391 BCLibs.emplace_back(AsanRTL, /*ShouldInternalize=*/false);
392 }
393
394 // Add the HIP specific bitcode library.
395 BCLibs.push_back(RocmInstallation->getHIPPath());
396
397 // Add common device libraries like ocml etc.
398 for (StringRef N : getCommonDeviceLibNames(DriverArgs, GpuArch.str()))
399 BCLibs.emplace_back(N);
400
401 // Add instrument lib.
402 auto InstLib =
403 DriverArgs.getLastArgValue(options::OPT_gpu_instrument_lib_EQ);
404 if (InstLib.empty())
405 return BCLibs;
406 if (llvm::sys::fs::exists(InstLib))
407 BCLibs.push_back(InstLib);
408 else
409 getDriver().Diag(diag::err_drv_no_such_file) << InstLib;
410 }
411
412 return BCLibs;
413}
414
416 const llvm::opt::ArgList &DriverArgs) const {
417 auto PTID = getParsedTargetID(DriverArgs);
418 if (PTID.OptionalTargetID && !PTID.OptionalGPUArch) {
419 getDriver().Diag(clang::diag::err_drv_bad_target_id)
420 << *PTID.OptionalTargetID;
421 }
422}
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:91
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:882
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:252
const Driver & getDriver() const
Definition: ToolChain.h:236
path_list & getProgramPaths()
Definition: ToolChain.h:281
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:325
const llvm::Triple & getTriple() const
Definition: ToolChain.h:238
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:1050
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1207
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1190
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:175
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:954
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:875
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:870
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1155
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:725
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:731
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Gnu.h:291
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: HIPAMD.cpp:322
Tool * buildLinker() const override
Definition: HIPAMD.cpp:288
HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple, const ToolChain &HostTC, const llvm::opt::ArgList &Args)
Definition: HIPAMD.cpp:201
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:264
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:220
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:302
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use MCU GCC toolchain includes.
Definition: HIPAMD.cpp:312
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:307
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: HIPAMD.cpp:317
void checkTargetID(const llvm::opt::ArgList &DriverArgs) const override
Check and diagnose invalid target ID specified by -mcpu.
Definition: HIPAMD.cpp:415
VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const override
On Windows, returns the MSVC compatibility version.
Definition: HIPAMD.cpp:335
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override
Add warning options that need to be passed to cc1 for this target.
Definition: HIPAMD.cpp:293
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: HIPAMD.cpp:298
llvm::SmallVector< BitCodeLibraryInfo, 12 > getDeviceLibs(const llvm::opt::ArgList &Args) const override
Get paths for device libraries.
Definition: HIPAMD.cpp:341
llvm::SmallVector< std::string, 12 > getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs, const std::string &GPUArch, bool isOpenMP=false) const
Definition: AMDGPU.cpp:876
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:180
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:555
SmallVector< StringRef > unifyTargetFeatures(ArrayRef< StringRef > Features)
If there are multiple +xxx or -xxx features, keep the last one.
Definition: CommonArgs.cpp:189
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)
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:307
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