clang 24.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"
14#include "clang/Driver/Tool.h"
16
17namespace clang {
18namespace driver {
19
20namespace tools {
21
22namespace AMDGCN {
23// Runs llvm-link/opt/llc/lld, which links multiple LLVM bitcode, together with
24// device library, then compiles it to ISA in a shared object.
25class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
26public:
27 Linker(const ToolChain &TC) : Tool("AMDGCN::Linker", "amdgcn-link", TC) {}
28
29 bool hasIntegratedCPP() const override { return false; }
30
31 void ConstructJob(Compilation &C, const JobAction &JA,
32 const InputInfo &Output, const InputInfoList &Inputs,
33 const llvm::opt::ArgList &TCArgs,
34 const char *LinkingOutput) const override;
35
36private:
37 void constructLldCommand(Compilation &C, const JobAction &JA,
38 const InputInfoList &Inputs, const InputInfo &Output,
39 const llvm::opt::ArgList &Args) const;
41 const InputInfoList &Inputs,
42 const InputInfo &Output,
43 const llvm::opt::ArgList &Args) const;
44 void constructLinkAndEmitSpirvCommand(Compilation &C, const JobAction &JA,
45 const InputInfoList &Inputs,
46 const InputInfo &Output,
47 const llvm::opt::ArgList &Args) const;
48};
49
50} // end namespace AMDGCN
51} // end namespace tools
52
53namespace toolchains {
54
55class LLVM_LIBRARY_VISIBILITY SPIRVAMDToolChain final : public AMDGPUToolChain {
56public:
57 SPIRVAMDToolChain(const Driver &D, const llvm::Triple &Triple,
58 const llvm::opt::ArgList &Args);
59
60 /// SPIR-V uses LTO by default to link device bitcode.
61 LTOKind getDefaultLTOMode() const override { return LTOK_Full; }
62
63protected:
64 Tool *buildLinker() const override;
65};
66
67} // end namespace toolchains
68} // end namespace driver
69} // end namespace clang
70
71#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPAMD_H
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:46
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:95
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:96
Tool - Information on a specific compilation tool.
Definition Tool.h:32
Tool(const char *Name, const char *ShortName, const ToolChain &TC)
Definition Tool.cpp:14
AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, const ToolChain *HostTC=nullptr, Action::OffloadKind Kind=Action::OFK_None, bool ShouldLinkDeviceLibs=false)
AMDGPU Toolchain.
Definition AMDGPU.cpp:678
SPIRVAMDToolChain(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Definition HIPAMD.cpp:227
LTOKind getDefaultLTOMode() const override
SPIR-V uses LTO by default to link device bitcode.
Definition HIPAMD.h:61
Linker(const ToolChain &TC)
Definition HIPAMD.h:27
bool hasIntegratedCPP() const override
Definition HIPAMD.h:29
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)
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
Definition Driver.h:59
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:51
The JSON file list parser is used to communicate input to InstallAPI.