[docs] Fix build-docs.sh
[llvm-project.git] / clang / lib / Driver / ToolChains / HIPSPV.h
blob1c4c474cdf69d11b92ca0ed2d6635c39d1050805
1 //===--- HIPSPV.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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPSPV_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPSPV_H
12 #include "SPIRV.h"
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
16 namespace clang {
17 namespace driver {
18 namespace tools {
19 namespace HIPSPV {
21 // Runs llvm-link/opt/llc/lld, which links multiple LLVM bitcode, together with
22 // device library, then compiles it to SPIR-V in a shared object.
23 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
24 public:
25 Linker(const ToolChain &TC) : Tool("HIPSPV::Linker", "hipspv-link", TC) {}
27 bool hasIntegratedCPP() const override { return false; }
29 void ConstructJob(Compilation &C, const JobAction &JA,
30 const InputInfo &Output, const InputInfoList &Inputs,
31 const llvm::opt::ArgList &TCArgs,
32 const char *LinkingOutput) const override;
34 private:
35 void constructLinkAndEmitSpirvCommand(Compilation &C, const JobAction &JA,
36 const InputInfoList &Inputs,
37 const InputInfo &Output,
38 const llvm::opt::ArgList &Args) const;
41 } // namespace HIPSPV
42 } // namespace tools
44 namespace toolchains {
46 class LLVM_LIBRARY_VISIBILITY HIPSPVToolChain final : public ToolChain {
47 public:
48 HIPSPVToolChain(const Driver &D, const llvm::Triple &Triple,
49 const ToolChain &HostTC, const llvm::opt::ArgList &Args);
51 const llvm::Triple *getAuxTriple() const override {
52 return &HostTC.getTriple();
55 void
56 addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
57 llvm::opt::ArgStringList &CC1Args,
58 Action::OffloadKind DeviceOffloadKind) const override;
59 void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
60 CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
61 void
62 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
63 llvm::opt::ArgStringList &CC1Args) const override;
64 void AddClangCXXStdlibIncludeArgs(
65 const llvm::opt::ArgList &Args,
66 llvm::opt::ArgStringList &CC1Args) const override;
67 void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
68 llvm::opt::ArgStringList &CC1Args) const override;
69 void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
70 llvm::opt::ArgStringList &CC1Args) const override;
71 llvm::SmallVector<BitCodeLibraryInfo, 12>
72 getDeviceLibs(const llvm::opt::ArgList &Args) const override;
74 SanitizerMask getSupportedSanitizers() const override;
76 VersionTuple
77 computeMSVCVersion(const Driver *D,
78 const llvm::opt::ArgList &Args) const override;
80 void adjustDebugInfoKind(codegenoptions::DebugInfoKind &DebugInfoKind,
81 const llvm::opt::ArgList &Args) const override;
82 bool IsIntegratedAssemblerDefault() const override { return true; }
83 bool IsMathErrnoDefault() const override { return false; }
84 bool useIntegratedAs() const override { return true; }
85 bool isCrossCompiling() const override { return true; }
86 bool isPICDefault() const override { return false; }
87 bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
88 return false;
90 bool isPICDefaultForced() const override { return false; }
91 bool SupportsProfiling() const override { return false; }
93 const ToolChain &HostTC;
95 protected:
96 Tool *buildLinker() const override;
99 } // end namespace toolchains
100 } // end namespace driver
101 } // end namespace clang
103 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIPSPV_H