Coverage Report

Created: 2024-01-17 10:31

/src/llvm-project/clang/lib/Driver/ToolChains/SPIRV.h
Line
Count
Source (jump to first uncovered line)
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
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SPIRV_H
10
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SPIRV_H
11
12
#include "clang/Driver/Tool.h"
13
#include "clang/Driver/ToolChain.h"
14
15
namespace clang {
16
namespace driver {
17
namespace tools {
18
namespace SPIRV {
19
20
void constructTranslateCommand(Compilation &C, const Tool &T,
21
                               const JobAction &JA, const InputInfo &Output,
22
                               const InputInfo &Input,
23
                               const llvm::opt::ArgStringList &Args);
24
25
class LLVM_LIBRARY_VISIBILITY Translator : public Tool {
26
public:
27
  Translator(const ToolChain &TC)
28
0
      : Tool("SPIR-V::Translator", "llvm-spirv", TC) {}
29
30
0
  bool hasIntegratedCPP() const override { return false; }
31
0
  bool hasIntegratedAssembler() const override { return true; }
32
33
  void ConstructJob(Compilation &C, const JobAction &JA,
34
                    const InputInfo &Output, const InputInfoList &Inputs,
35
                    const llvm::opt::ArgList &TCArgs,
36
                    const char *LinkingOutput) const override;
37
};
38
39
class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
40
public:
41
0
  Linker(const ToolChain &TC) : Tool("SPIRV::Linker", "spirv-link", TC) {}
42
0
  bool hasIntegratedCPP() const override { return false; }
43
0
  bool isLinkJob() const override { return true; }
44
  void ConstructJob(Compilation &C, const JobAction &JA,
45
                    const InputInfo &Output, const InputInfoList &Inputs,
46
                    const llvm::opt::ArgList &TCArgs,
47
                    const char *LinkingOutput) const override;
48
};
49
50
} // namespace SPIRV
51
} // namespace tools
52
53
namespace toolchains {
54
55
class LLVM_LIBRARY_VISIBILITY SPIRVToolChain final : public ToolChain {
56
  mutable std::unique_ptr<Tool> Translator;
57
58
public:
59
  SPIRVToolChain(const Driver &D, const llvm::Triple &Triple,
60
                 const llvm::opt::ArgList &Args)
61
0
      : ToolChain(D, Triple, Args) {}
62
63
0
  bool useIntegratedAs() const override { return true; }
64
65
0
  bool IsIntegratedBackendDefault() const override { return false; }
66
0
  bool IsNonIntegratedBackendSupported() const override { return true; }
67
0
  bool IsMathErrnoDefault() const override { return false; }
68
0
  bool isCrossCompiling() const override { return true; }
69
0
  bool isPICDefault() const override { return false; }
70
0
  bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
71
0
    return false;
72
0
  }
73
0
  bool isPICDefaultForced() const override { return false; }
74
0
  bool SupportsProfiling() const override { return false; }
75
76
  clang::driver::Tool *SelectTool(const JobAction &JA) const override;
77
78
protected:
79
  clang::driver::Tool *getTool(Action::ActionClass AC) const override;
80
  Tool *buildLinker() const override;
81
82
private:
83
  clang::driver::Tool *getTranslator() const;
84
};
85
86
} // namespace toolchains
87
} // namespace driver
88
} // namespace clang
89
#endif