clang 20.0.0git
HIPAMD.h
Go to the documentation of this file.
1//===--- HIPAMD.h - HIP 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#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPAMD_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPAMD_H
11
12#include "AMDGPU.h"
13#include "clang/Driver/Tool.h"
15
16namespace clang {
17namespace driver {
18
19namespace tools {
20
21namespace AMDGCN {
22// Runs llvm-link/opt/llc/lld, which links multiple LLVM bitcode, together with
23// device library, then compiles it to ISA in a shared object.
24class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
25public:
26 Linker(const ToolChain &TC) : Tool("AMDGCN::Linker", "amdgcn-link", TC) {}
27
28 bool hasIntegratedCPP() const override { return false; }
29
30 void ConstructJob(Compilation &C, const JobAction &JA,
31 const InputInfo &Output, const InputInfoList &Inputs,
32 const llvm::opt::ArgList &TCArgs,
33 const char *LinkingOutput) const override;
34
35private:
36 void constructLldCommand(Compilation &C, const JobAction &JA,
37 const InputInfoList &Inputs, const InputInfo &Output,
38 const llvm::opt::ArgList &Args) const;
39 void constructLlvmLinkCommand(Compilation &C, const JobAction &JA,
40 const InputInfoList &Inputs,
41 const InputInfo &Output,
42 const llvm::opt::ArgList &Args) const;
43 void constructLinkAndEmitSpirvCommand(Compilation &C, const JobAction &JA,
44 const InputInfoList &Inputs,
45 const InputInfo &Output,
46 const llvm::opt::ArgList &Args) const;
47};
48
49} // end namespace AMDGCN
50} // end namespace tools
51
52namespace toolchains {
53
54class LLVM_LIBRARY_VISIBILITY HIPAMDToolChain final : public ROCMToolChain {
55public:
56 HIPAMDToolChain(const Driver &D, const llvm::Triple &Triple,
57 const ToolChain &HostTC, const llvm::opt::ArgList &Args);
58
59 const llvm::Triple *getAuxTriple() const override {
60 return &HostTC.getTriple();
61 }
62
63 llvm::opt::DerivedArgList *
64 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
65 Action::OffloadKind DeviceOffloadKind) const override;
66 void
67 addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
68 llvm::opt::ArgStringList &CC1Args,
69 Action::OffloadKind DeviceOffloadKind) const override;
70 void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
71 CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
72 void
73 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
74 llvm::opt::ArgStringList &CC1Args) const override;
75 void AddClangCXXStdlibIncludeArgs(
76 const llvm::opt::ArgList &Args,
77 llvm::opt::ArgStringList &CC1Args) const override;
78 void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
79 llvm::opt::ArgStringList &CC1Args) const override;
80 void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
81 llvm::opt::ArgStringList &CC1Args) const override;
83 getDeviceLibs(const llvm::opt::ArgList &Args) const override;
84
85 SanitizerMask getSupportedSanitizers() const override;
86
87 VersionTuple
88 computeMSVCVersion(const Driver *D,
89 const llvm::opt::ArgList &Args) const override;
90
91 unsigned GetDefaultDwarfVersion() const override { return 5; }
92
94 void checkTargetID(const llvm::opt::ArgList &DriverArgs) const override;
95
96protected:
97 Tool *buildLinker() const override;
98};
99
100} // end namespace toolchains
101} // end namespace driver
102} // end namespace clang
103
104#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPAMD_H
const Decl * D
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
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
const llvm::Triple & getTriple() const
Definition: ToolChain.h:254
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
unsigned GetDefaultDwarfVersion() const override
Definition: HIPAMD.h:91
const llvm::Triple * getAuxTriple() const override
Get the toolchain's aux triple, if it has one.
Definition: HIPAMD.h:59
Linker(const ToolChain &TC)
Definition: HIPAMD.h:26
bool hasIntegratedCPP() const override
Definition: HIPAMD.h:28
The JSON file list parser is used to communicate input to InstallAPI.