[docs] Fix build-docs.sh
[llvm-project.git] / clang / lib / Driver / ToolChains / SPIRV.h
blobbb2904f761289ca6106bda1e82586cd91032f202
1 //===--- SPIRV.h - SPIR-V Tool 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_SPIRV_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SPIRV_H
12 #include "clang/Driver/Tool.h"
13 #include "clang/Driver/ToolChain.h"
15 namespace clang {
16 namespace driver {
17 namespace tools {
18 namespace SPIRV {
20 void addTranslatorArgs(const llvm::opt::ArgList &InArgs,
21 llvm::opt::ArgStringList &OutArgs);
23 void constructTranslateCommand(Compilation &C, const Tool &T,
24 const JobAction &JA, const InputInfo &Output,
25 const InputInfo &Input,
26 const llvm::opt::ArgStringList &Args);
28 class LLVM_LIBRARY_VISIBILITY Translator : public Tool {
29 public:
30 Translator(const ToolChain &TC)
31 : Tool("SPIR-V::Translator", "llvm-spirv", TC) {}
33 bool hasIntegratedCPP() const override { return false; }
34 bool hasIntegratedAssembler() const override { return true; }
36 void ConstructJob(Compilation &C, const JobAction &JA,
37 const InputInfo &Output, const InputInfoList &Inputs,
38 const llvm::opt::ArgList &TCArgs,
39 const char *LinkingOutput) const override;
42 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
43 public:
44 Linker(const ToolChain &TC) : Tool("SPIRV::Linker", "spirv-link", TC) {}
45 bool hasIntegratedCPP() const override { return false; }
46 bool isLinkJob() const override { return true; }
47 void ConstructJob(Compilation &C, const JobAction &JA,
48 const InputInfo &Output, const InputInfoList &Inputs,
49 const llvm::opt::ArgList &TCArgs,
50 const char *LinkingOutput) const override;
53 } // namespace SPIRV
54 } // namespace tools
56 namespace toolchains {
58 class LLVM_LIBRARY_VISIBILITY SPIRVToolChain final : public ToolChain {
59 mutable std::unique_ptr<Tool> Translator;
61 public:
62 SPIRVToolChain(const Driver &D, const llvm::Triple &Triple,
63 const llvm::opt::ArgList &Args)
64 : ToolChain(D, Triple, Args) {}
66 bool useIntegratedAs() const override { return true; }
68 bool IsIntegratedBackendDefault() const override { return false; }
69 bool IsNonIntegratedBackendSupported() const override { return true; }
70 bool IsMathErrnoDefault() const override { return false; }
71 bool isCrossCompiling() const override { return true; }
72 bool isPICDefault() const override { return false; }
73 bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
74 return false;
76 bool isPICDefaultForced() const override { return false; }
77 bool SupportsProfiling() const override { return false; }
79 clang::driver::Tool *SelectTool(const JobAction &JA) const override;
81 protected:
82 clang::driver::Tool *getTool(Action::ActionClass AC) const override;
83 Tool *buildLinker() const override;
85 private:
86 clang::driver::Tool *getTranslator() const;
89 } // namespace toolchains
90 } // namespace driver
91 } // namespace clang
92 #endif