clang  5.0.0
AMDGPU.cpp
Go to the documentation of this file.
1 //===--- AMDGPU.cpp - 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 #include "AMDGPU.h"
11 #include "InputInfo.h"
12 #include "CommonArgs.h"
14 #include "llvm/Option/ArgList.h"
15 
16 using namespace clang::driver;
17 using namespace clang::driver::tools;
18 using namespace clang::driver::toolchains;
19 using namespace clang;
20 using namespace llvm::opt;
21 
23  const InputInfo &Output,
24  const InputInfoList &Inputs,
25  const ArgList &Args,
26  const char *LinkingOutput) const {
27 
28  std::string Linker = getToolChain().GetProgramPath(getShortName());
29  ArgStringList CmdArgs;
30  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
31  CmdArgs.push_back("-shared");
32  CmdArgs.push_back("-o");
33  CmdArgs.push_back(Output.getFilename());
34  C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
35  CmdArgs, Inputs));
36 }
37 
38 /// AMDGPU Toolchain
39 AMDGPUToolChain::AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
40  const ArgList &Args)
41  : Generic_ELF(D, Triple, Args) { }
42 
44  return new tools::amdgpu::Linker(*this);
45 }
Tool * buildLinker() const override
Definition: AMDGPU.cpp:43
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 addCommand(std::unique_ptr< Command > C)
Definition: Compilation.h:189
const char * getFilename() const
Definition: InputInfo.h:84
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs...
Definition: AMDGPU.cpp:22
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:34