Coverage Report

Created: 2023-08-22 09:22

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Driver/ToolChains/Myriad.h
Line
Count
Source (jump to first uncovered line)
1
//===--- Myriad.h - Myriad 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_MYRIAD_H
10
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
11
12
#include "Gnu.h"
13
#include "clang/Driver/Tool.h"
14
#include "clang/Driver/ToolChain.h"
15
16
namespace clang {
17
namespace driver {
18
namespace tools {
19
20
/// SHAVE tools -- Directly call moviCompile and moviAsm
21
namespace SHAVE {
22
class LLVM_LIBRARY_VISIBILITY Compiler : public Tool {
23
public:
24
7
  Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {}
25
26
7
  bool hasIntegratedCPP() const override { return true; }
27
28
  void ConstructJob(Compilation &C, const JobAction &JA,
29
                    const InputInfo &Output, const InputInfoList &Inputs,
30
                    const llvm::opt::ArgList &TCArgs,
31
                    const char *LinkingOutput) const override;
32
};
33
34
class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
35
public:
36
5
  Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {}
37
38
5
  bool hasIntegratedCPP() const override { return false; } // not sure.
39
40
  void ConstructJob(Compilation &C, const JobAction &JA,
41
                    const InputInfo &Output, const InputInfoList &Inputs,
42
                    const llvm::opt::ArgList &TCArgs,
43
                    const char *LinkingOutput) const override;
44
};
45
} // end namespace SHAVE
46
47
/// The Myriad toolchain uses tools that are in two different namespaces.
48
/// The Compiler and Assembler as defined above are in the SHAVE namespace,
49
/// whereas the linker, which accepts code for a mixture of Sparc and SHAVE,
50
/// is in the Myriad namespace.
51
namespace Myriad {
52
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
53
public:
54
5
  Linker(const ToolChain &TC) : Tool("shave::Linker", "ld", TC) {}
55
5
  bool hasIntegratedCPP() const override { return false; }
56
0
  bool isLinkJob() const override { return true; }
57
  void ConstructJob(Compilation &C, const JobAction &JA,
58
                    const InputInfo &Output, const InputInfoList &Inputs,
59
                    const llvm::opt::ArgList &TCArgs,
60
                    const char *LinkingOutput) const override;
61
};
62
} // end namespace Myriad
63
} // end namespace tools
64
65
namespace toolchains {
66
67
/// MyriadToolChain - A tool chain using either clang or the external compiler
68
/// installed by the Movidius SDK to perform all subcommands.
69
class LLVM_LIBRARY_VISIBILITY MyriadToolChain : public Generic_ELF {
70
public:
71
  MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
72
                  const llvm::opt::ArgList &Args);
73
  ~MyriadToolChain() override;
74
75
  void
76
  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
77
                            llvm::opt::ArgStringList &CC1Args) const override;
78
  void addLibCxxIncludePaths(
79
      const llvm::opt::ArgList &DriverArgs,
80
      llvm::opt::ArgStringList &CC1Args) const override;
81
  void addLibStdCxxIncludePaths(
82
      const llvm::opt::ArgList &DriverArgs,
83
      llvm::opt::ArgStringList &CC1Args) const override;
84
  Tool *SelectTool(const JobAction &JA) const override;
85
2
  unsigned GetDefaultDwarfVersion() const override { return 2; }
86
  SanitizerMask getSupportedSanitizers() const override;
87
88
protected:
89
  Tool *buildLinker() const override;
90
51
  bool isShaveCompilation(const llvm::Triple &T) const {
91
51
    return T.getArch() == llvm::Triple::shave;
92
51
  }
93
94
private:
95
  mutable std::unique_ptr<Tool> Compiler;
96
  mutable std::unique_ptr<Tool> Assembler;
97
};
98
99
} // end namespace toolchains
100
} // end namespace driver
101
} // end namespace clang
102
103
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H