Home | History | Annotate | Line # | Download | only in ToolChains
      1      1.1  joerg //===--- Hexagon.h - Hexagon ToolChain Implementations ----------*- C++ -*-===//
      2      1.1  joerg //
      3      1.1  joerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      4      1.1  joerg // See https://llvm.org/LICENSE.txt for license information.
      5      1.1  joerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      6      1.1  joerg //
      7      1.1  joerg //===----------------------------------------------------------------------===//
      8      1.1  joerg 
      9      1.1  joerg #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HEXAGON_H
     10      1.1  joerg #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HEXAGON_H
     11      1.1  joerg 
     12      1.1  joerg #include "Linux.h"
     13      1.1  joerg #include "clang/Driver/Tool.h"
     14      1.1  joerg #include "clang/Driver/ToolChain.h"
     15      1.1  joerg 
     16      1.1  joerg namespace clang {
     17      1.1  joerg namespace driver {
     18      1.1  joerg namespace tools {
     19      1.1  joerg namespace hexagon {
     20      1.1  joerg // For Hexagon, we do not need to instantiate tools for PreProcess, PreCompile
     21      1.1  joerg // and Compile.
     22      1.1  joerg // We simply use "clang -cc1" for those actions.
     23  1.1.1.2  joerg class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
     24      1.1  joerg public:
     25      1.1  joerg   Assembler(const ToolChain &TC)
     26  1.1.1.2  joerg       : Tool("hexagon::Assembler", "hexagon-as", TC) {}
     27      1.1  joerg 
     28      1.1  joerg   bool hasIntegratedCPP() const override { return false; }
     29      1.1  joerg 
     30      1.1  joerg   void RenderExtraToolArgs(const JobAction &JA,
     31      1.1  joerg                            llvm::opt::ArgStringList &CmdArgs) const;
     32      1.1  joerg   void ConstructJob(Compilation &C, const JobAction &JA,
     33      1.1  joerg                     const InputInfo &Output, const InputInfoList &Inputs,
     34      1.1  joerg                     const llvm::opt::ArgList &TCArgs,
     35      1.1  joerg                     const char *LinkingOutput) const override;
     36      1.1  joerg };
     37      1.1  joerg 
     38  1.1.1.2  joerg class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
     39      1.1  joerg public:
     40  1.1.1.2  joerg   Linker(const ToolChain &TC) : Tool("hexagon::Linker", "hexagon-ld", TC) {}
     41      1.1  joerg 
     42      1.1  joerg   bool hasIntegratedCPP() const override { return false; }
     43      1.1  joerg   bool isLinkJob() const override { return true; }
     44      1.1  joerg 
     45      1.1  joerg   virtual void RenderExtraToolArgs(const JobAction &JA,
     46      1.1  joerg                                    llvm::opt::ArgStringList &CmdArgs) const;
     47      1.1  joerg   void ConstructJob(Compilation &C, const JobAction &JA,
     48      1.1  joerg                     const InputInfo &Output, const InputInfoList &Inputs,
     49      1.1  joerg                     const llvm::opt::ArgList &TCArgs,
     50      1.1  joerg                     const char *LinkingOutput) const override;
     51      1.1  joerg };
     52      1.1  joerg 
     53      1.1  joerg void getHexagonTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
     54      1.1  joerg                               std::vector<StringRef> &Features);
     55      1.1  joerg 
     56      1.1  joerg } // end namespace hexagon.
     57      1.1  joerg } // end namespace tools
     58      1.1  joerg 
     59      1.1  joerg namespace toolchains {
     60      1.1  joerg 
     61      1.1  joerg class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
     62      1.1  joerg protected:
     63      1.1  joerg   GCCVersion GCCLibAndIncVersion;
     64      1.1  joerg   Tool *buildAssembler() const override;
     65      1.1  joerg   Tool *buildLinker() const override;
     66      1.1  joerg 
     67      1.1  joerg   unsigned getOptimizationLevel(const llvm::opt::ArgList &DriverArgs) const;
     68      1.1  joerg 
     69      1.1  joerg public:
     70      1.1  joerg   HexagonToolChain(const Driver &D, const llvm::Triple &Triple,
     71      1.1  joerg                    const llvm::opt::ArgList &Args);
     72      1.1  joerg   ~HexagonToolChain() override;
     73      1.1  joerg 
     74      1.1  joerg   void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
     75      1.1  joerg                              llvm::opt::ArgStringList &CC1Args,
     76      1.1  joerg                              Action::OffloadKind DeviceOffloadKind) const override;
     77      1.1  joerg   void
     78      1.1  joerg   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
     79      1.1  joerg                             llvm::opt::ArgStringList &CC1Args) const override;
     80      1.1  joerg   void addLibStdCxxIncludePaths(
     81      1.1  joerg       const llvm::opt::ArgList &DriverArgs,
     82      1.1  joerg       llvm::opt::ArgStringList &CC1Args) const override;
     83      1.1  joerg 
     84  1.1.1.2  joerg   void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
     85  1.1.1.2  joerg                              llvm::opt::ArgStringList &CC1Args) const override;
     86  1.1.1.2  joerg 
     87  1.1.1.2  joerg   const char *getDefaultLinker() const override {
     88  1.1.1.2  joerg     return getTriple().isMusl() ? "ld.lld" : "hexagon-link";
     89  1.1.1.2  joerg   }
     90      1.1  joerg 
     91      1.1  joerg   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
     92      1.1  joerg 
     93  1.1.1.2  joerg   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
     94  1.1.1.2  joerg                            llvm::opt::ArgStringList &CmdArgs) const override;
     95  1.1.1.2  joerg 
     96      1.1  joerg   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
     97      1.1  joerg   bool IsIntegratedAssemblerDefault() const override {
     98      1.1  joerg     return true;
     99      1.1  joerg   }
    100      1.1  joerg 
    101      1.1  joerg   std::string getHexagonTargetDir(
    102      1.1  joerg       const std::string &InstalledDir,
    103      1.1  joerg       const SmallVectorImpl<std::string> &PrefixDirs) const;
    104      1.1  joerg   void getHexagonLibraryPaths(const llvm::opt::ArgList &Args,
    105      1.1  joerg       ToolChain::path_list &LibPaths) const;
    106      1.1  joerg 
    107      1.1  joerg   static bool isAutoHVXEnabled(const llvm::opt::ArgList &Args);
    108      1.1  joerg   static const StringRef GetDefaultCPU();
    109      1.1  joerg   static const StringRef GetTargetCPUVersion(const llvm::opt::ArgList &Args);
    110      1.1  joerg 
    111      1.1  joerg   static Optional<unsigned> getSmallDataThreshold(
    112      1.1  joerg       const llvm::opt::ArgList &Args);
    113      1.1  joerg };
    114      1.1  joerg 
    115      1.1  joerg } // end namespace toolchains
    116      1.1  joerg } // end namespace driver
    117      1.1  joerg } // end namespace clang
    118      1.1  joerg 
    119      1.1  joerg #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HEXAGON_H
    120