"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/lib/Driver/ToolChains/HIP.h" (19 Jan 2019, 5240 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "HIP.h": 8.0.1_vs_9.0.0.

    1 //===--- HIP.h - HIP ToolChain Implementations ------------------*- C++ -*-===//
    2 //
    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
    6 //
    7 //===----------------------------------------------------------------------===//
    8 
    9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIP_H
   10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIP_H
   11 
   12 #include "clang/Driver/ToolChain.h"
   13 #include "clang/Driver/Tool.h"
   14 
   15 namespace clang {
   16 namespace driver {
   17 
   18 namespace tools {
   19 
   20 namespace AMDGCN {
   21   // Construct command for creating HIP fatbin.
   22   void constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
   23                   StringRef OutputFileName, const InputInfoList &Inputs,
   24                   const llvm::opt::ArgList &TCArgs, const Tool& T);
   25 
   26 // Runs llvm-link/opt/llc/lld, which links multiple LLVM bitcode, together with
   27 // device library, then compiles it to ISA in a shared object.
   28 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
   29 public:
   30   Linker(const ToolChain &TC) : Tool("AMDGCN::Linker", "amdgcn-link", TC) {}
   31 
   32   bool hasIntegratedCPP() const override { return false; }
   33 
   34   void ConstructJob(Compilation &C, const JobAction &JA,
   35                     const InputInfo &Output, const InputInfoList &Inputs,
   36                     const llvm::opt::ArgList &TCArgs,
   37                     const char *LinkingOutput) const override;
   38 
   39 private:
   40   /// \return llvm-link output file name.
   41   const char *constructLLVMLinkCommand(Compilation &C, const JobAction &JA,
   42                                        const InputInfoList &Inputs,
   43                                        const llvm::opt::ArgList &Args,
   44                                        llvm::StringRef SubArchName,
   45                                        llvm::StringRef OutputFilePrefix) const;
   46 
   47   /// \return opt output file name.
   48   const char *constructOptCommand(Compilation &C, const JobAction &JA,
   49                                   const InputInfoList &Inputs,
   50                                   const llvm::opt::ArgList &Args,
   51                                   llvm::StringRef SubArchName,
   52                                   llvm::StringRef OutputFilePrefix,
   53                                   const char *InputFileName) const;
   54 
   55   /// \return llc output file name.
   56   const char *constructLlcCommand(Compilation &C, const JobAction &JA,
   57                                   const InputInfoList &Inputs,
   58                                   const llvm::opt::ArgList &Args,
   59                                   llvm::StringRef SubArchName,
   60                                   llvm::StringRef OutputFilePrefix,
   61                                   const char *InputFileName) const;
   62 
   63   void constructLldCommand(Compilation &C, const JobAction &JA,
   64                            const InputInfoList &Inputs, const InputInfo &Output,
   65                            const llvm::opt::ArgList &Args,
   66                            const char *InputFileName) const;
   67 };
   68 
   69 } // end namespace AMDGCN
   70 } // end namespace tools
   71 
   72 namespace toolchains {
   73 
   74 class LLVM_LIBRARY_VISIBILITY HIPToolChain : public ToolChain {
   75 public:
   76   HIPToolChain(const Driver &D, const llvm::Triple &Triple,
   77                 const ToolChain &HostTC, const llvm::opt::ArgList &Args);
   78 
   79   const llvm::Triple *getAuxTriple() const override {
   80     return &HostTC.getTriple();
   81   }
   82 
   83   llvm::opt::DerivedArgList *
   84   TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
   85                 Action::OffloadKind DeviceOffloadKind) const override;
   86   void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
   87                              llvm::opt::ArgStringList &CC1Args,
   88                              Action::OffloadKind DeviceOffloadKind) const override;
   89 
   90   bool useIntegratedAs() const override { return true; }
   91   bool isCrossCompiling() const override { return true; }
   92   bool isPICDefault() const override { return false; }
   93   bool isPIEDefault() const override { return false; }
   94   bool isPICDefaultForced() const override { return false; }
   95   bool SupportsProfiling() const override { return false; }
   96   bool IsMathErrnoDefault() const override { return false; }
   97 
   98   void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
   99   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
  100   void
  101   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  102                             llvm::opt::ArgStringList &CC1Args) const override;
  103   void AddClangCXXStdlibIncludeArgs(
  104       const llvm::opt::ArgList &Args,
  105       llvm::opt::ArgStringList &CC1Args) const override;
  106   void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  107                            llvm::opt::ArgStringList &CC1Args) const override;
  108 
  109   SanitizerMask getSupportedSanitizers() const override;
  110 
  111   VersionTuple
  112   computeMSVCVersion(const Driver *D,
  113                      const llvm::opt::ArgList &Args) const override;
  114 
  115   unsigned GetDefaultDwarfVersion() const override { return 2; }
  116 
  117   const ToolChain &HostTC;
  118 
  119 protected:
  120   Tool *buildLinker() const override;
  121 };
  122 
  123 } // end namespace toolchains
  124 } // end namespace driver
  125 } // end namespace clang
  126 
  127 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HIP_H