clang  6.0.0svn
AMDGPU.h
Go to the documentation of this file.
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"
14 #include "clang/Driver/Options.h"
15 #include "clang/Driver/Tool.h"
16 #include "clang/Driver/ToolChain.h"
17 #include <map>
18 
19 namespace clang {
20 namespace driver {
21 namespace tools {
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 
35 void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
36  std::vector<StringRef> &Features);
37 
38 } // end namespace amdgpu
39 } // end namespace tools
40 
41 namespace toolchains {
42 
43 class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
44 
45 private:
46  const std::map<options::ID, const StringRef> OptionsDefault;
47 
48 protected:
49  Tool *buildLinker() const override;
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  }
55 
56 public:
57  AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
58  const llvm::opt::ArgList &Args);
59  unsigned GetDefaultDwarfVersion() const override { return 2; }
60  bool IsIntegratedAssemblerDefault() const override { return true; }
61  llvm::opt::DerivedArgList *
62  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
63  Action::OffloadKind DeviceOffloadKind) const override;
64 };
65 
66 } // end namespace toolchains
67 } // end namespace driver
68 } // end namespace clang
69 
70 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H
bool isLinkJob() const override
Definition: AMDGPU.h:27
unsigned GetDefaultDwarfVersion() const override
Definition: AMDGPU.h:59
Linker(const ToolChain &TC)
Definition: AMDGPU.h:26
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
void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
Definition: AMDGPU.cpp:39
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.
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
const StringRef getOptionDefault(options::ID OptID) const
Definition: AMDGPU.h:50
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: AMDGPU.h:60
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:34
bool hasIntegratedCPP() const override
Definition: AMDGPU.h:28
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:73