Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/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 addTranslatorArgs(const llvm::opt::ArgList &InArgs,
21
                       llvm::opt::ArgStringList &OutArgs);
22
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);
27
28
class LLVM_LIBRARY_VISIBILITY Translator : public Tool {
29
public:
30
  Translator(const ToolChain &TC)
31
22
      : Tool("SPIR-V::Translator", "llvm-spirv", TC) {}
32
33
22
  bool hasIntegratedCPP() const override { return false; }
34
14
  bool hasIntegratedAssembler() const override { return true; }
35
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;
40
};
41
42
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
43
public:
44
3
  Linker(const ToolChain &TC) : Tool("SPIRV::Linker", "spirv-link", TC) {}
45
3
  bool hasIntegratedCPP() const override { return false; }
46
0
  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;
51
};
52
53
} // namespace SPIRV
54
} // namespace tools
55
56
namespace toolchains {
57
58
class LLVM_LIBRARY_VISIBILITY SPIRVToolChain final : public ToolChain {
59
  mutable std::unique_ptr<Tool> Translator;
60
61
public:
62
  SPIRVToolChain(const Driver &D, const llvm::Triple &Triple,
63
                 const llvm::opt::ArgList &Args)
64
22
      : ToolChain(D, Triple, Args) {}
65
66
129
  bool useIntegratedAs() const override { return true; }
67
20
  bool useIntegratedBackend() const override { return false; }
68
69
22
  bool IsMathErrnoDefault() const override { return false; }
70
3
  bool isCrossCompiling() const override { return true; }
71
22
  bool isPICDefault() const override { return false; }
72
22
  bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
73
22
    return false;
74
22
  }
75
22
  bool isPICDefaultForced() const override { return false; }
76
22
  bool SupportsProfiling() const override { return false; }
77
78
  clang::driver::Tool *SelectTool(const JobAction &JA) const override;
79
80
protected:
81
  clang::driver::Tool *getTool(Action::ActionClass AC) const override;
82
  Tool *buildLinker() const override;
83
84
private:
85
  clang::driver::Tool *getTranslator() const;
86
};
87
88
} // namespace toolchains
89
} // namespace driver
90
} // namespace clang
91
#endif