1 //===--- Myriad.h - Myriad ToolChain Implementations ------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
20 /// SHAVE tools -- Directly call moviCompile and moviAsm
22 class LLVM_LIBRARY_VISIBILITY Compiler
: public Tool
{
24 Compiler(const ToolChain
&TC
) : Tool("moviCompile", "movicompile", TC
) {}
26 bool hasIntegratedCPP() const override
{ return true; }
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
;
34 class LLVM_LIBRARY_VISIBILITY Assembler
: public Tool
{
36 Assembler(const ToolChain
&TC
) : Tool("moviAsm", "moviAsm", TC
) {}
38 bool hasIntegratedCPP() const override
{ return false; } // not sure.
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
;
45 } // end namespace SHAVE
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.
52 class LLVM_LIBRARY_VISIBILITY Linker
: public Tool
{
54 Linker(const ToolChain
&TC
) : Tool("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
;
62 } // end namespace Myriad
63 } // end namespace tools
65 namespace toolchains
{
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
{
71 MyriadToolChain(const Driver
&D
, const llvm::Triple
&Triple
,
72 const llvm::opt::ArgList
&Args
);
73 ~MyriadToolChain() override
;
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
;
89 Tool
*buildLinker() const override
;
90 bool isShaveCompilation(const llvm::Triple
&T
) const {
91 return T
.getArch() == llvm::Triple::shave
;
95 mutable std::unique_ptr
<Tool
> Compiler
;
96 mutable std::unique_ptr
<Tool
> Assembler
;
99 } // end namespace toolchains
100 } // end namespace driver
101 } // end namespace clang
103 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H