clang  9.0.0svn
AMDGPU.h
Go to the documentation of this file.
1 //===--- AMDGPU.h - AMDGPU 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_AMDGPU_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H
11 
12 #include "Gnu.h"
13 #include "clang/Driver/Options.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
16 #include <map>
17 
18 namespace clang {
19 namespace driver {
20 namespace tools {
21 namespace amdgpu {
22 
23 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
24 public:
25  Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "ld.lld", TC) {}
26  bool isLinkJob() const override { return true; }
27  bool hasIntegratedCPP() const override { return false; }
28  void ConstructJob(Compilation &C, const JobAction &JA,
29  const InputInfo &Output, const InputInfoList &Inputs,
30  const llvm::opt::ArgList &TCArgs,
31  const char *LinkingOutput) const override;
32 };
33 
34 void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args,
35  std::vector<StringRef> &Features);
36 
37 } // end namespace amdgpu
38 } // end namespace tools
39 
40 namespace toolchains {
41 
42 class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
43 
44 private:
45  const std::map<options::ID, const StringRef> OptionsDefault;
46 
47 protected:
48  Tool *buildLinker() const override;
49  const StringRef getOptionDefault(options::ID OptID) const {
50  auto opt = OptionsDefault.find(OptID);
51  assert(opt != OptionsDefault.end() && "No Default for Option");
52  return opt->second;
53  }
54 
55 public:
56  AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
57  const llvm::opt::ArgList &Args);
58  unsigned GetDefaultDwarfVersion() const override { return 5; }
59  bool IsIntegratedAssemblerDefault() const override { return true; }
60  llvm::opt::DerivedArgList *
61  TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
62  Action::OffloadKind DeviceOffloadKind) const override;
63 
64  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
65  llvm::opt::ArgStringList &CC1Args,
66  Action::OffloadKind DeviceOffloadKind) const override;
67 };
68 
69 } // end namespace toolchains
70 } // end namespace driver
71 } // end namespace clang
72 
73 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AMDGPU_H
bool isLinkJob() const override
Definition: AMDGPU.h:26
unsigned GetDefaultDwarfVersion() const override
Definition: AMDGPU.h:58
Linker(const ToolChain &TC)
Definition: AMDGPU.h:25
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:57
void getAMDGPUTargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features)
Definition: AMDGPU.cpp:38
Base class for all GNU tools that provide the same behavior when it comes to response files support...
Definition: Gnu.h:40
Dataflow Directional Tag Classes.
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
const StringRef getOptionDefault(options::ID OptID) const
Definition: AMDGPU.h:49
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: AMDGPU.h:59
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
bool hasIntegratedCPP() const override
Definition: AMDGPU.h:27
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88