blob: 36114d0dabc43d72341e8ec37fde5f8646584d53 [file] [log] [blame]
David L. Jonesf561aba2017-03-08 01:02:16 +00001//===--- 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 Kasaurov6618c392017-09-05 10:24:38 +000014#include "clang/Driver/Options.h"
David L. Jonesf561aba2017-03-08 01:02:16 +000015#include "clang/Driver/Tool.h"
16#include "clang/Driver/ToolChain.h"
Andrey Kasaurov6618c392017-09-05 10:24:38 +000017#include <map>
David L. Jonesf561aba2017-03-08 01:02:16 +000018
19namespace clang {
20namespace driver {
21namespace tools {
David L. Jonesf561aba2017-03-08 01:02:16 +000022namespace amdgpu {
23
24class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
25public:
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 Zhuravlyov8914a6d2017-11-10 19:09:57 +000035void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
36 std::vector<StringRef> &Features);
37
David L. Jonesf561aba2017-03-08 01:02:16 +000038} // end namespace amdgpu
39} // end namespace tools
40
41namespace toolchains {
42
43class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
Andrey Kasaurov6618c392017-09-05 10:24:38 +000044
45private:
46 const std::map<options::ID, const StringRef> OptionsDefault;
47
David L. Jonesf561aba2017-03-08 01:02:16 +000048protected:
49 Tool *buildLinker() const override;
Andrey Kasaurov6618c392017-09-05 10:24:38 +000050 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. Jonesf561aba2017-03-08 01:02:16 +000055
56public:
57 AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
Andrey Kasaurov6618c392017-09-05 10:24:38 +000058 const llvm::opt::ArgList &Args);
David L. Jonesf561aba2017-03-08 01:02:16 +000059 unsigned GetDefaultDwarfVersion() const override { return 2; }
60 bool IsIntegratedAssemblerDefault() const override { return true; }
Andrey Kasaurov6618c392017-09-05 10:24:38 +000061 llvm::opt::DerivedArgList *
62 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
63 Action::OffloadKind DeviceOffloadKind) const override;
David L. Jonesf561aba2017-03-08 01:02:16 +000064};
65
66} // end namespace toolchains
67} // end namespace driver
68} // end namespace clang
69
70#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H