clang  10.0.0svn
Myriad.h
Go to the documentation of this file.
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  Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {}
25 
26  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  Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {}
37 
38  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 GnuTool {
53 public:
54  Linker(const ToolChain &TC) : GnuTool("shave::Linker", "ld", TC) {}
55  bool hasIntegratedCPP() const override { return false; }
56  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  unsigned GetDefaultDwarfVersion() const override { return 2; }
86  SanitizerMask getSupportedSanitizers() const override;
87 
88 protected:
89  Tool *buildLinker() const override;
90  bool isShaveCompilation(const llvm::Triple &T) const {
91  return T.getArch() == llvm::Triple::shave;
92  }
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
bool hasIntegratedCPP() const override
Definition: Myriad.h:26
MyriadToolChain - A tool chain using either clang or the external compiler installed by the Movidius ...
Definition: Myriad.h:69
unsigned GetDefaultDwarfVersion() const override
Definition: Myriad.h:85
Assembler(const ToolChain &TC)
Definition: Myriad.h:36
bool hasIntegratedCPP() const override
Definition: Myriad.h:55
bool isLinkJob() const override
Definition: Myriad.h:56
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
bool isShaveCompilation(const llvm::Triple &T) const
Definition: Myriad.h:90
Compiler(const ToolChain &TC)
Definition: Myriad.h:24
Linker(const ToolChain &TC)
Definition: Myriad.h:54
Base class for all GNU tools that provide the same behavior when it comes to response files support...
Definition: Gnu.h:40
Dataflow Directional Tag Classes.
bool hasIntegratedCPP() const override
Definition: Myriad.h:38
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88