clang  6.0.0svn
Hexagon.h
Go to the documentation of this file.
1 //===--- Hexagon.h - Hexagon 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_HEXAGON_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HEXAGON_H
12 
13 #include "Linux.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 
17 namespace clang {
18 namespace driver {
19 namespace tools {
20 namespace hexagon {
21 // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile
22 // and Compile.
23 // We simply use "clang -cc1" for those actions.
24 class LLVM_LIBRARY_VISIBILITY Assembler : public GnuTool {
25 public:
26  Assembler(const ToolChain &TC)
27  : GnuTool("hexagon::Assembler", "hexagon-as", TC) {}
28 
29  bool hasIntegratedCPP() const override { return false; }
30 
31  void RenderExtraToolArgs(const JobAction &JA,
32  llvm::opt::ArgStringList &CmdArgs) const;
33  void ConstructJob(Compilation &C, const JobAction &JA,
34  const InputInfo &Output, const InputInfoList &Inputs,
35  const llvm::opt::ArgList &TCArgs,
36  const char *LinkingOutput) const override;
37 };
38 
39 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
40 public:
41  Linker(const ToolChain &TC) : GnuTool("hexagon::Linker", "hexagon-ld", TC) {}
42 
43  bool hasIntegratedCPP() const override { return false; }
44  bool isLinkJob() const override { return true; }
45 
46  virtual void RenderExtraToolArgs(const JobAction &JA,
47  llvm::opt::ArgStringList &CmdArgs) const;
48  void ConstructJob(Compilation &C, const JobAction &JA,
49  const InputInfo &Output, const InputInfoList &Inputs,
50  const llvm::opt::ArgList &TCArgs,
51  const char *LinkingOutput) const override;
52 };
53 
54 void getHexagonTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
55  std::vector<StringRef> &Features);
56 
57 } // end namespace hexagon.
58 } // end namespace tools
59 
60 namespace toolchains {
61 
62 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
63 protected:
64  GCCVersion GCCLibAndIncVersion;
65  Tool *buildAssembler() const override;
66  Tool *buildLinker() const override;
67 
68  unsigned getOptimizationLevel(const llvm::opt::ArgList &DriverArgs) const;
69 
70 public:
71  HexagonToolChain(const Driver &D, const llvm::Triple &Triple,
72  const llvm::opt::ArgList &Args);
73  ~HexagonToolChain() override;
74 
75  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
76  llvm::opt::ArgStringList &CC1Args,
77  Action::OffloadKind DeviceOffloadKind) const override;
78  void
79  AddClangSystemIncludeArgs(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  CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
85 
86  StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
87  bool IsIntegratedAssemblerDefault() const override {
88  return true;
89  }
90 
91  std::string getHexagonTargetDir(
92  const std::string &InstalledDir,
93  const SmallVectorImpl<std::string> &PrefixDirs) const;
94  void getHexagonLibraryPaths(const llvm::opt::ArgList &Args,
95  ToolChain::path_list &LibPaths) const;
96 
97  static const StringRef GetDefaultCPU();
98  static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args);
99 
100  static Optional<unsigned> getSmallDataThreshold(
101  const llvm::opt::ArgList &Args);
102 };
103 
104 } // end namespace toolchains
105 } // end namespace driver
106 } // end namespace clang
107 
108 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HEXAGON_H
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:75
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK, DiagnosticsEngine &Diags)
bool hasIntegratedCPP() const override
Definition: Hexagon.h:29
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
Assembler(const ToolChain &TC)
Definition: Hexagon.h:26
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: Hexagon.h:87
bool hasIntegratedCPP() const override
Definition: Hexagon.h:43
bool isLinkJob() const override
Definition: Hexagon.h:44
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.
void getHexagonTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
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
Linker(const ToolChain &TC)
Definition: Hexagon.h:41
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:73