]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/Driver/ToolChains/Myriad.h
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / lib / Driver / ToolChains / Myriad.h
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   void addLibCxxIncludePaths(
80       const llvm::opt::ArgList &DriverArgs,
81       llvm::opt::ArgStringList &CC1Args) const override;
82   void addLibStdCxxIncludePaths(
83       const llvm::opt::ArgList &DriverArgs,
84       llvm::opt::ArgStringList &CC1Args) const override;
85   Tool *SelectTool(const JobAction &JA) const override;
86   unsigned GetDefaultDwarfVersion() const override { return 2; }
87   SanitizerMask getSupportedSanitizers() const override;
88
89 protected:
90   Tool *buildLinker() const override;
91   bool isShaveCompilation(const llvm::Triple &T) const {
92     return T.getArch() == llvm::Triple::shave;
93   }
94
95 private:
96   mutable std::unique_ptr<Tool> Compiler;
97   mutable std::unique_ptr<Tool> Assembler;
98 };
99
100 } // end namespace toolchains
101 } // end namespace driver
102 } // end namespace clang
103
104 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H