| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 1 | //===--- AMDGPU.h - AMDGPU 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_AMDGPU_H |
| 11 | #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H |
| 12 | |
| 13 | #include "Gnu.h" |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 14 | #include "clang/Driver/Options.h" |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 15 | #include "clang/Driver/Tool.h" |
| 16 | #include "clang/Driver/ToolChain.h" |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 17 | #include <map> |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 18 | |
| 19 | namespace clang { |
| 20 | namespace driver { |
| 21 | namespace tools { |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 22 | namespace amdgpu { |
| 23 | |
| 24 | class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool { |
| 25 | public: |
| 26 | Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "ld.lld", TC) {} |
| 27 | bool isLinkJob() const override { return true; } |
| 28 | bool hasIntegratedCPP() const override { return false; } |
| 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 | |
| Konstantin Zhuravlyov | 8914a6d | 2017-11-10 19:09:57 +0000 | [diff] [blame^] | 35 | void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, |
| 36 | std::vector<StringRef> &Features); |
| 37 | |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 38 | } // end namespace amdgpu |
| 39 | } // end namespace tools |
| 40 | |
| 41 | namespace toolchains { |
| 42 | |
| 43 | class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF { |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 44 | |
| 45 | private: |
| 46 | const std::map<options::ID, const StringRef> OptionsDefault; |
| 47 | |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 48 | protected: |
| 49 | Tool *buildLinker() const override; |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 50 | const StringRef getOptionDefault(options::ID OptID) const { |
| 51 | auto opt = OptionsDefault.find(OptID); |
| 52 | assert(opt != OptionsDefault.end() && "No Default for Option"); |
| 53 | return opt->second; |
| 54 | } |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 55 | |
| 56 | public: |
| 57 | AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple, |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 58 | const llvm::opt::ArgList &Args); |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 59 | unsigned GetDefaultDwarfVersion() const override { return 2; } |
| 60 | bool IsIntegratedAssemblerDefault() const override { return true; } |
| Andrey Kasaurov | 6618c39 | 2017-09-05 10:24:38 +0000 | [diff] [blame] | 61 | llvm::opt::DerivedArgList * |
| 62 | TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch, |
| 63 | Action::OffloadKind DeviceOffloadKind) const override; |
| David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // end namespace toolchains |
| 67 | } // end namespace driver |
| 68 | } // end namespace clang |
| 69 | |
| 70 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H |