clang  6.0.0svn
Myriad.h
Go to the documentation of this file.
1 //===--- Myriad.h - Myriad ToolChain Implementations ------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
12 
13 #include "Gnu.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 
17 namespace clang {
18 namespace driver {
19 namespace tools {
20 
21 /// SHAVE tools -- Directly call moviCompile and moviAsm
22 namespace SHAVE {
23 class LLVM_LIBRARY_VISIBILITY Compiler : public Tool {
24 public:
25  Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {}
26 
27  bool hasIntegratedCPP() const override { return true; }
28 
29  void ConstructJob(Compilation &C, const JobAction &JA,
30  const InputInfo &Output, const InputInfoList &Inputs,
31  const llvm::opt::ArgList &TCArgs,
32  const char *LinkingOutput) const override;
33 };
34 
35 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
36 public:
37  Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {}
38 
39  bool hasIntegratedCPP() const override { return false; } // not sure.
40 
41  void ConstructJob(Compilation &C, const JobAction &JA,
42  const InputInfo &Output, const InputInfoList &Inputs,
43  const llvm::opt::ArgList &TCArgs,
44  const char *LinkingOutput) const override;
45 };
46 } // end namespace SHAVE
47 
48 /// The Myriad toolchain uses tools that are in two different namespaces.
49 /// The Compiler and Assembler as defined above are in the SHAVE namespace,
50 /// whereas the linker, which accepts code for a mixture of Sparc and SHAVE,
51 /// is in the Myriad namespace.
52 namespace Myriad {
53 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
54 public:
55  Linker(const ToolChain &TC) : GnuTool("shave::Linker", "ld", TC) {}
56  bool hasIntegratedCPP() const override { return false; }
57  bool isLinkJob() const override { return true; }
58  void ConstructJob(Compilation &C, const JobAction &JA,
59  const InputInfo &Output, const InputInfoList &Inputs,
60  const llvm::opt::ArgList &TCArgs,
61  const char *LinkingOutput) const override;
62 };
63 } // end namespace Myriad
64 } // end namespace tools
65 
66 namespace toolchains {
67 
68 /// MyriadToolChain - A tool chain using either clang or the external compiler
69 /// installed by the Movidius SDK to perform all subcommands.
70 class LLVM_LIBRARY_VISIBILITY MyriadToolChain : public Generic_ELF {
71 public:
72  MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
73  const llvm::opt::ArgList &Args);
74  ~MyriadToolChain() override;
75 
76  void
77  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
78  llvm::opt::ArgStringList &CC1Args) const override;
79  std::string findLibCxxIncludePath() const override;
80  void addLibStdCxxIncludePaths(
81  const llvm::opt::ArgList &DriverArgs,
82  llvm::opt::ArgStringList &CC1Args) const override;
83  Tool *SelectTool(const JobAction &JA) const override;
84  unsigned GetDefaultDwarfVersion() const override { return 2; }
85  SanitizerMask getSupportedSanitizers() const override;
86 
87 protected:
88  Tool *buildLinker() const override;
89  bool isShaveCompilation(const llvm::Triple &T) const {
90  return T.getArch() == llvm::Triple::shave;
91  }
92 
93 private:
94  mutable std::unique_ptr<Tool> Compiler;
95  mutable std::unique_ptr<Tool> Assembler;
96 };
97 
98 } // end namespace toolchains
99 } // end namespace driver
100 } // end namespace clang
101 
102 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
bool hasIntegratedCPP() const override
Definition: Myriad.h:27
MyriadToolChain - A tool chain using either clang or the external compiler installed by the Movidius ...
Definition: Myriad.h:70
unsigned GetDefaultDwarfVersion() const override
Definition: Myriad.h:84
Assembler(const ToolChain &TC)
Definition: Myriad.h:37
bool hasIntegratedCPP() const override
Definition: Myriad.h:56
bool isLinkJob() const override
Definition: Myriad.h:57
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:65
bool isShaveCompilation(const llvm::Triple &T) const
Definition: Myriad.h:89
Compiler(const ToolChain &TC)
Definition: Myriad.h:25
const FunctionProtoType * T
Linker(const ToolChain &TC)
Definition: Myriad.h:55
Base class for all GNU tools that provide the same behavior when it comes to response files support...
Definition: Gnu.h:41
Dataflow Directional Tag Classes.
uint64_t SanitizerMask
Definition: Sanitizers.h:24
bool hasIntegratedCPP() const override
Definition: Myriad.h:39
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:34
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:73