case llvm::Triple::Solaris:
TC = new toolchains::Solaris(*this, Target, Args);
break;
+ case llvm::Triple::AMDHSA:
+ TC = new toolchains::AMDGPUToolChain(*this, Target, Args);
+ break;
case llvm::Triple::Win32:
switch (Target.getEnvironment()) {
default:
}
// End Hexagon
+/// AMDGPU Toolchain
+AMDGPUToolChain::AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
+ const ArgList &Args)
+ : Generic_ELF(D, Triple, Args) { }
+
+Tool *AMDGPUToolChain::buildLinker() const {
+ return new tools::amdgpu::Linker(*this);
+}
+// End AMDGPU
+
/// NaCl Toolchain
NaCl_TC::NaCl_TC(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
static bool UsesG0(const char *smallDataThreshold);
};
+class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
+protected:
+ Tool *buildLinker() const override;
+
+public:
+ AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
+ const llvm::opt::ArgList &Args);
+ bool IsIntegratedAssemblerDefault() const override { return true; }
+};
+
class LLVM_LIBRARY_VISIBILITY NaCl_TC : public Generic_ELF {
public:
NaCl_TC(const Driver &D, const llvm::Triple &Triple,
}
// Hexagon tools end.
+void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+
+ std::string Linker = getToolChain().GetProgramPath(getShortName());
+ ArgStringList CmdArgs;
+ CmdArgs.push_back("-flavor");
+ CmdArgs.push_back("gnu");
+ CmdArgs.push_back("-target");
+ CmdArgs.push_back(getToolChain().getTripleString().c_str());
+ AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
+ CmdArgs.push_back("-o");
+ CmdArgs.push_back(Output.getFilename());
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
+ CmdArgs, Inputs));
+}
+// AMDGPU tools end.
+
const std::string arm::getARMArch(const ArgList &Args,
const llvm::Triple &Triple) {
std::string MArch;
};
} // end namespace hexagon.
+namespace amdgpu {
+
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
+public:
+ Linker(const ToolChain &TC) : GnuTool("amdgpu::Linker", "lld", TC) {}
+ bool isLinkJob() const override { return true; }
+ bool hasIntegratedCPP() const override { return false; }
+ void ConstructJob(Compilation &C, const JobAction &JA,
+ const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::opt::ArgList &TCArgs,
+ const char *LinkingOutput) const override;
+};
+
+} // end namespace amdgpu
+
namespace arm {
std::string getARMTargetCPU(const llvm::opt::ArgList &Args,
const llvm::Triple &Triple);
--- /dev/null
+// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
+// AS_LINK-LABEL: clang
+// AS_LINK: "-cc1as"
+// AS_LINK-LABEL: lld
+// AS_LINK: "-flavor" "gnu" "-target" "amdgcn--amdhsa"