mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
[Driver] Remove Myriad.cpp
I am trying to clean up GCCInstallationDetector::init and noticed that Myriad.cpp is the only toolchain using `ExtraTripleAliases`. This is a little overhead, but I figured that Myriad.cpp is unused. Its sanitizer runtime part was removed in 2021 by D104279. It seems time to retire it. Reviewed By: waltl Differential Revision: https://reviews.llvm.org/D158706
This commit is contained in:
parent
e4c7298bea
commit
aa9d7d1cd0
@ -71,7 +71,6 @@ add_clang_library(clangDriver
|
||||
ToolChains/MinGW.cpp
|
||||
ToolChains/MSP430.cpp
|
||||
ToolChains/MSVC.cpp
|
||||
ToolChains/Myriad.cpp
|
||||
ToolChains/NaCl.cpp
|
||||
ToolChains/NetBSD.cpp
|
||||
ToolChains/OHOS.cpp
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "ToolChains/MSVC.h"
|
||||
#include "ToolChains/MinGW.h"
|
||||
#include "ToolChains/MipsLinux.h"
|
||||
#include "ToolChains/Myriad.h"
|
||||
#include "ToolChains/NaCl.h"
|
||||
#include "ToolChains/NetBSD.h"
|
||||
#include "ToolChains/OHOS.h"
|
||||
@ -6325,10 +6324,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
||||
TC = std::make_unique<toolchains::CSKYToolChain>(*this, Target, Args);
|
||||
break;
|
||||
default:
|
||||
if (Target.getVendor() == llvm::Triple::Myriad)
|
||||
TC = std::make_unique<toolchains::MyriadToolChain>(*this, Target,
|
||||
Args);
|
||||
else if (toolchains::BareMetal::handlesTarget(Target))
|
||||
if (toolchains::BareMetal::handlesTarget(Target))
|
||||
TC = std::make_unique<toolchains::BareMetal>(*this, Target, Args);
|
||||
else if (Target.isOSBinFormatELF())
|
||||
TC = std::make_unique<toolchains::Generic_ELF>(*this, Target, Args);
|
||||
|
@ -2071,8 +2071,7 @@ static llvm::StringRef getGCCToolchainDir(const ArgList &Args,
|
||||
/// necessary because the driver doesn't store the final version of the target
|
||||
/// triple.
|
||||
void Generic_GCC::GCCInstallationDetector::init(
|
||||
const llvm::Triple &TargetTriple, const ArgList &Args,
|
||||
ArrayRef<std::string> ExtraTripleAliases) {
|
||||
const llvm::Triple &TargetTriple, const ArgList &Args) {
|
||||
llvm::Triple BiarchVariantTriple = TargetTriple.isArch32Bit()
|
||||
? TargetTriple.get64BitArchVariant()
|
||||
: TargetTriple.get32BitArchVariant();
|
||||
@ -2146,9 +2145,6 @@ void Generic_GCC::GCCInstallationDetector::init(
|
||||
// may pick the libraries for x86_64-pc-linux-gnu even when exact matching
|
||||
// triple x86_64-gentoo-linux-gnu is present.
|
||||
GentooTestTriples.push_back(TargetTriple.str());
|
||||
// Check rest of triples.
|
||||
GentooTestTriples.append(ExtraTripleAliases.begin(),
|
||||
ExtraTripleAliases.end());
|
||||
GentooTestTriples.append(CandidateTripleAliases.begin(),
|
||||
CandidateTripleAliases.end());
|
||||
if (ScanGentooConfigs(TargetTriple, Args, GentooTestTriples,
|
||||
@ -2178,10 +2174,6 @@ void Generic_GCC::GCCInstallationDetector::init(
|
||||
if (TargetTriple.getVendor() == llvm::Triple::UnknownVendor)
|
||||
ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, TripleNoVendorRef,
|
||||
false, GCCDirExists, GCCCrossDirExists);
|
||||
// Try rest of possible triples.
|
||||
for (StringRef Candidate : ExtraTripleAliases) // Try these first.
|
||||
ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, Candidate, false,
|
||||
GCCDirExists, GCCCrossDirExists);
|
||||
for (StringRef Candidate : CandidateTripleAliases)
|
||||
ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, Candidate, false,
|
||||
GCCDirExists, GCCCrossDirExists);
|
||||
@ -2963,7 +2955,7 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const {
|
||||
case llvm::Triple::xcore:
|
||||
return false;
|
||||
default:
|
||||
return getTriple().getVendor() != llvm::Triple::Myriad;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,8 +218,7 @@ public:
|
||||
|
||||
public:
|
||||
explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
|
||||
void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args,
|
||||
ArrayRef<std::string> ExtraTripleAliases = std::nullopt);
|
||||
void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args);
|
||||
|
||||
/// Check whether we detected a valid GCC install.
|
||||
bool isValid() const { return IsValid; }
|
||||
|
@ -1,293 +0,0 @@
|
||||
//===--- Myriad.cpp - Myriad ToolChain Implementations ----------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Myriad.h"
|
||||
#include "CommonArgs.h"
|
||||
#include "clang/Driver/Compilation.h"
|
||||
#include "clang/Driver/Driver.h"
|
||||
#include "clang/Driver/DriverDiagnostic.h"
|
||||
#include "clang/Driver/Options.h"
|
||||
#include "llvm/Option/ArgList.h"
|
||||
|
||||
using namespace clang::driver;
|
||||
using namespace clang::driver::toolchains;
|
||||
using namespace clang;
|
||||
using namespace llvm::opt;
|
||||
|
||||
using tools::addPathIfExists;
|
||||
|
||||
void tools::SHAVE::Compiler::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
ArgStringList CmdArgs;
|
||||
assert(Inputs.size() == 1);
|
||||
const InputInfo &II = Inputs[0];
|
||||
assert(II.getType() == types::TY_C || II.getType() == types::TY_CXX ||
|
||||
II.getType() == types::TY_PP_CXX);
|
||||
|
||||
if (JA.getKind() == Action::PreprocessJobClass) {
|
||||
Args.ClaimAllArgs();
|
||||
CmdArgs.push_back("-E");
|
||||
} else {
|
||||
assert(Output.getType() == types::TY_PP_Asm); // Require preprocessed asm.
|
||||
CmdArgs.push_back("-S");
|
||||
CmdArgs.push_back("-fno-exceptions"); // Always do this even if unspecified.
|
||||
}
|
||||
CmdArgs.push_back("-DMYRIAD2");
|
||||
|
||||
// Append all -I, -iquote, -isystem paths, defines/undefines, 'f'
|
||||
// flags, 'g' flags, 'M' flags, optimize flags, warning options,
|
||||
// mcpu flags, mllvm flags, and Xclang flags.
|
||||
// These are spelled the same way in clang and moviCompile.
|
||||
Args.AddAllArgsExcept(
|
||||
CmdArgs,
|
||||
{options::OPT_I_Group, options::OPT_clang_i_Group, options::OPT_std_EQ,
|
||||
options::OPT_D, options::OPT_U, options::OPT_f_Group,
|
||||
options::OPT_f_clang_Group, options::OPT_g_Group, options::OPT_M_Group,
|
||||
options::OPT_O_Group, options::OPT_W_Group, options::OPT_mcpu_EQ,
|
||||
options::OPT_mllvm, options::OPT_Xclang},
|
||||
{options::OPT_fno_split_dwarf_inlining});
|
||||
Args.hasArg(options::OPT_fno_split_dwarf_inlining); // Claim it if present.
|
||||
|
||||
// If we're producing a dependency file, and assembly is the final action,
|
||||
// then the name of the target in the dependency file should be the '.o'
|
||||
// file, not the '.s' file produced by this step. For example, instead of
|
||||
// /tmp/mumble.s: mumble.c .../someheader.h
|
||||
// the filename on the lefthand side should be "mumble.o"
|
||||
if (Args.getLastArg(options::OPT_MF) && !Args.getLastArg(options::OPT_MT) &&
|
||||
C.getActions().size() == 1 &&
|
||||
C.getActions()[0]->getKind() == Action::AssembleJobClass) {
|
||||
Arg *A = Args.getLastArg(options::OPT_o);
|
||||
if (A) {
|
||||
CmdArgs.push_back("-MT");
|
||||
CmdArgs.push_back(Args.MakeArgString(A->getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
CmdArgs.push_back(II.getFilename());
|
||||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
|
||||
std::string Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("moviCompile"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(Exec), CmdArgs,
|
||||
Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::SHAVE::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
ArgStringList CmdArgs;
|
||||
|
||||
assert(Inputs.size() == 1);
|
||||
const InputInfo &II = Inputs[0];
|
||||
assert(II.getType() == types::TY_PP_Asm); // Require preprocessed asm input.
|
||||
assert(Output.getType() == types::TY_Object);
|
||||
|
||||
CmdArgs.push_back("-no6thSlotCompression");
|
||||
const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ);
|
||||
if (CPUArg)
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString("-cv:" + StringRef(CPUArg->getValue())));
|
||||
CmdArgs.push_back("-noSPrefixing");
|
||||
CmdArgs.push_back("-a"); // Mystery option.
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
|
||||
for (const Arg *A : Args.filtered(options::OPT_I, options::OPT_isystem)) {
|
||||
A->claim();
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(std::string("-i:") + A->getValue(0)));
|
||||
}
|
||||
CmdArgs.push_back(II.getFilename());
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(std::string("-o:") + Output.getFilename()));
|
||||
|
||||
std::string Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("moviAsm"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(Exec), CmdArgs,
|
||||
Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::Myriad::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output,
|
||||
const InputInfoList &Inputs,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
const auto &TC =
|
||||
static_cast<const toolchains::MyriadToolChain &>(getToolChain());
|
||||
const llvm::Triple &T = TC.getTriple();
|
||||
ArgStringList CmdArgs;
|
||||
bool UseStartfiles =
|
||||
!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
|
||||
bool UseDefaultLibs =
|
||||
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs);
|
||||
// Silence warning if the args contain both -nostdlib and -stdlib=.
|
||||
Args.getLastArg(options::OPT_stdlib_EQ);
|
||||
|
||||
if (T.getArch() == llvm::Triple::sparc)
|
||||
CmdArgs.push_back("-EB");
|
||||
else // SHAVE assumes little-endian, and sparcel is expressly so.
|
||||
CmdArgs.push_back("-EL");
|
||||
|
||||
// The remaining logic is mostly like gnutools::Linker::ConstructJob,
|
||||
// but we never pass through a --sysroot option and various other bits.
|
||||
// For example, there are no sanitizers (yet) nor gold linker.
|
||||
|
||||
// Eat some arguments that may be present but have no effect.
|
||||
Args.ClaimAllArgs(options::OPT_g_Group);
|
||||
Args.ClaimAllArgs(options::OPT_w);
|
||||
Args.ClaimAllArgs(options::OPT_static_libgcc);
|
||||
|
||||
if (Args.hasArg(options::OPT_s)) // Pass the 'strip' option.
|
||||
CmdArgs.push_back("-s");
|
||||
|
||||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
|
||||
if (UseStartfiles) {
|
||||
// If you want startfiles, it means you want the builtin crti and crtbegin,
|
||||
// but not crt0. Myriad link commands provide their own crt0.o as needed.
|
||||
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crti.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
|
||||
}
|
||||
|
||||
Args.AddAllArgs(CmdArgs,
|
||||
{options::OPT_L, options::OPT_T_Group, options::OPT_s,
|
||||
options::OPT_t, options::OPT_Z_Flag, options::OPT_r});
|
||||
|
||||
TC.AddFilePathLibArgs(Args, CmdArgs);
|
||||
|
||||
bool NeedsSanitizerDeps = addSanitizerRuntimes(TC, Args, CmdArgs);
|
||||
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
|
||||
|
||||
if (UseDefaultLibs) {
|
||||
if (NeedsSanitizerDeps)
|
||||
linkSanitizerRuntimeDeps(TC, CmdArgs);
|
||||
if (C.getDriver().CCCIsCXX()) {
|
||||
if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) {
|
||||
CmdArgs.push_back("-lc++");
|
||||
CmdArgs.push_back("-lc++abi");
|
||||
} else
|
||||
CmdArgs.push_back("-lstdc++");
|
||||
}
|
||||
if (T.getOS() == llvm::Triple::RTEMS) {
|
||||
CmdArgs.push_back("--start-group");
|
||||
CmdArgs.push_back("-lc");
|
||||
CmdArgs.push_back("-lgcc"); // circularly dependent on rtems
|
||||
// You must provide your own "-L" option to enable finding these.
|
||||
CmdArgs.push_back("-lrtemscpu");
|
||||
CmdArgs.push_back("-lrtemsbsp");
|
||||
CmdArgs.push_back("--end-group");
|
||||
} else {
|
||||
CmdArgs.push_back("-lc");
|
||||
CmdArgs.push_back("-lgcc");
|
||||
}
|
||||
}
|
||||
if (UseStartfiles) {
|
||||
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
|
||||
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtn.o")));
|
||||
}
|
||||
|
||||
std::string Exec =
|
||||
Args.MakeArgString(TC.GetProgramPath("sparc-myriad-rtems-ld"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Exec),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
MyriadToolChain::MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
|
||||
const ArgList &Args)
|
||||
: Generic_ELF(D, Triple, Args) {
|
||||
// If a target of 'sparc-myriad-elf' is specified to clang, it wants to use
|
||||
// 'sparc-myriad--elf' (note the unknown OS) as the canonical triple.
|
||||
// This won't work to find gcc. Instead we give the installation detector an
|
||||
// extra triple, which is preferable to further hacks of the logic that at
|
||||
// present is based solely on getArch(). In particular, it would be wrong to
|
||||
// choose the myriad installation when targeting a non-myriad sparc install.
|
||||
switch (Triple.getArch()) {
|
||||
default:
|
||||
D.Diag(clang::diag::err_target_unsupported_arch)
|
||||
<< Triple.getArchName() << "myriad";
|
||||
[[fallthrough]];
|
||||
case llvm::Triple::shave:
|
||||
return;
|
||||
case llvm::Triple::sparc:
|
||||
case llvm::Triple::sparcel:
|
||||
GCCInstallation.init(Triple, Args, {"sparc-myriad-rtems"});
|
||||
}
|
||||
|
||||
if (GCCInstallation.isValid()) {
|
||||
// This directory contains crt{i,n,begin,end}.o as well as libgcc.
|
||||
// These files are tied to a particular version of gcc.
|
||||
SmallString<128> CompilerSupportDir(GCCInstallation.getInstallPath());
|
||||
addPathIfExists(D, CompilerSupportDir, getFilePaths());
|
||||
}
|
||||
// libstd++ and libc++ must both be found in this one place.
|
||||
addPathIfExists(D, D.Dir + "/../sparc-myriad-rtems/lib", getFilePaths());
|
||||
}
|
||||
|
||||
MyriadToolChain::~MyriadToolChain() {}
|
||||
|
||||
void MyriadToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args) const {
|
||||
if (!DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
|
||||
addSystemInclude(DriverArgs, CC1Args, getDriver().SysRoot + "/include");
|
||||
}
|
||||
|
||||
void MyriadToolChain::addLibCxxIncludePaths(
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const {
|
||||
std::string Path(getDriver().getInstalledDir());
|
||||
addSystemInclude(DriverArgs, CC1Args, Path + "/../include/c++/v1");
|
||||
}
|
||||
|
||||
void MyriadToolChain::addLibStdCxxIncludePaths(
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const {
|
||||
StringRef LibDir = GCCInstallation.getParentLibPath();
|
||||
const GCCVersion &Version = GCCInstallation.getVersion();
|
||||
StringRef TripleStr = GCCInstallation.getTriple().str();
|
||||
const Multilib &Multilib = GCCInstallation.getMultilib();
|
||||
addLibStdCXXIncludePaths(
|
||||
LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
|
||||
TripleStr, Multilib.includeSuffix(), DriverArgs, CC1Args);
|
||||
}
|
||||
|
||||
// MyriadToolChain handles several triples:
|
||||
// {shave,sparc{,el}}-myriad-{rtems,unknown}-elf
|
||||
Tool *MyriadToolChain::SelectTool(const JobAction &JA) const {
|
||||
// The inherited method works fine if not targeting the SHAVE.
|
||||
if (!isShaveCompilation(getTriple()))
|
||||
return ToolChain::SelectTool(JA);
|
||||
switch (JA.getKind()) {
|
||||
case Action::PreprocessJobClass:
|
||||
case Action::CompileJobClass:
|
||||
if (!Compiler)
|
||||
Compiler.reset(new tools::SHAVE::Compiler(*this));
|
||||
return Compiler.get();
|
||||
case Action::AssembleJobClass:
|
||||
if (!Assembler)
|
||||
Assembler.reset(new tools::SHAVE::Assembler(*this));
|
||||
return Assembler.get();
|
||||
default:
|
||||
return ToolChain::getTool(JA.getKind());
|
||||
}
|
||||
}
|
||||
|
||||
Tool *MyriadToolChain::buildLinker() const {
|
||||
return new tools::Myriad::Linker(*this);
|
||||
}
|
||||
|
||||
SanitizerMask MyriadToolChain::getSupportedSanitizers() const {
|
||||
return SanitizerKind::Address;
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
//===--- Myriad.h - Myriad ToolChain Implementations ------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
|
||||
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
|
||||
|
||||
#include "Gnu.h"
|
||||
#include "clang/Driver/Tool.h"
|
||||
#include "clang/Driver/ToolChain.h"
|
||||
|
||||
namespace clang {
|
||||
namespace driver {
|
||||
namespace tools {
|
||||
|
||||
/// SHAVE tools -- Directly call moviCompile and moviAsm
|
||||
namespace SHAVE {
|
||||
class LLVM_LIBRARY_VISIBILITY Compiler : public Tool {
|
||||
public:
|
||||
Compiler(const ToolChain &TC) : Tool("moviCompile", "movicompile", TC) {}
|
||||
|
||||
bool hasIntegratedCPP() const override { return true; }
|
||||
|
||||
void ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const InputInfo &Output, const InputInfoList &Inputs,
|
||||
const llvm::opt::ArgList &TCArgs,
|
||||
const char *LinkingOutput) const override;
|
||||
};
|
||||
|
||||
class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
|
||||
public:
|
||||
Assembler(const ToolChain &TC) : Tool("moviAsm", "moviAsm", TC) {}
|
||||
|
||||
bool hasIntegratedCPP() const override { return false; } // not sure.
|
||||
|
||||
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 SHAVE
|
||||
|
||||
/// The Myriad toolchain uses tools that are in two different namespaces.
|
||||
/// The Compiler and Assembler as defined above are in the SHAVE namespace,
|
||||
/// whereas the linker, which accepts code for a mixture of Sparc and SHAVE,
|
||||
/// is in the Myriad namespace.
|
||||
namespace Myriad {
|
||||
class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
|
||||
public:
|
||||
Linker(const ToolChain &TC) : Tool("shave::Linker", "ld", TC) {}
|
||||
bool hasIntegratedCPP() const override { return false; }
|
||||
bool isLinkJob() const override { return true; }
|
||||
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 Myriad
|
||||
} // end namespace tools
|
||||
|
||||
namespace toolchains {
|
||||
|
||||
/// MyriadToolChain - A tool chain using either clang or the external compiler
|
||||
/// installed by the Movidius SDK to perform all subcommands.
|
||||
class LLVM_LIBRARY_VISIBILITY MyriadToolChain : public Generic_ELF {
|
||||
public:
|
||||
MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
|
||||
const llvm::opt::ArgList &Args);
|
||||
~MyriadToolChain() override;
|
||||
|
||||
void
|
||||
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
void addLibCxxIncludePaths(
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
void addLibStdCxxIncludePaths(
|
||||
const llvm::opt::ArgList &DriverArgs,
|
||||
llvm::opt::ArgStringList &CC1Args) const override;
|
||||
Tool *SelectTool(const JobAction &JA) const override;
|
||||
unsigned GetDefaultDwarfVersion() const override { return 2; }
|
||||
SanitizerMask getSupportedSanitizers() const override;
|
||||
|
||||
protected:
|
||||
Tool *buildLinker() const override;
|
||||
bool isShaveCompilation(const llvm::Triple &T) const {
|
||||
return T.getArch() == llvm::Triple::shave;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable std::unique_ptr<Tool> Compiler;
|
||||
mutable std::unique_ptr<Tool> Assembler;
|
||||
};
|
||||
|
||||
} // end namespace toolchains
|
||||
} // end namespace driver
|
||||
} // end namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MYRIAD_H
|
@ -1,90 +0,0 @@
|
||||
// RUN: %clang -### --target=sparc-myriad-rtems %s \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_myriad_tree/bin \
|
||||
// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS
|
||||
// LINK_WITH_RTEMS: Inputs{{.*}}crti.o
|
||||
// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o
|
||||
// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0"
|
||||
// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/bin/../sparc-myriad-rtems/lib"
|
||||
// LINK_WITH_RTEMS: "--start-group" "-lc" "-lgcc" "-lrtemscpu" "-lrtemsbsp" "--end-group"
|
||||
// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o
|
||||
// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o
|
||||
|
||||
// RUN: %clang -c -### --target=sparc-myriad-rtems -x c++ %s \
|
||||
// RUN: -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=COMPILE_CXX
|
||||
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0"
|
||||
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0/sparc-myriad-rtems"
|
||||
// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-rtems/6.3.0/../../../../sparc-myriad-rtems/include/c++/6.3.0/backward"
|
||||
|
||||
// RUN: %clang -### -E --target=sparc-myriad --sysroot=/yow %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=SLASH_INCLUDE
|
||||
// SLASH_INCLUDE: "-isysroot" "/yow" "-internal-isystem" "/yow/include"
|
||||
|
||||
// RUN: %clang -### -E --target=sparc-myriad --sysroot=/yow %s -nostdinc 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=NO_SLASH_INCLUDE
|
||||
// NO_SLASH_INCLUDE: "-isysroot" "/yow"
|
||||
// NO_SLASH_INCLUDE-NOT: "-internal-isystem" "/yow/include"
|
||||
|
||||
// RUN: not %clang -### --target=what-myriad %s 2>&1 | FileCheck %s -check-prefix=BAD_ARCH
|
||||
// BAD_ARCH: the target architecture 'what' is not supported by the target 'myriad'
|
||||
|
||||
// Ensure that '-target shave' picks a different compiler.
|
||||
// Also check that '-I' is turned into '-i:' for the assembler.
|
||||
|
||||
// Note that since we don't know where movi tools are installed,
|
||||
// the driver may or may not find a full path to them.
|
||||
// That is, the 0th argument will be "/path/to/my/moviCompile"
|
||||
// or just "moviCompile" depending on whether moviCompile is found.
|
||||
// As such, we test only for a trailing quote in its rendering.
|
||||
// The same goes for "moviAsm".
|
||||
|
||||
// RUN: %clang --target=shave-myriad -mcpu=myriad2.2 -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=MOVICOMPILE
|
||||
// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-DMYRIAD2" "-mcpu=myriad2.2" "-isystem" "somewhere" "-I" "common"
|
||||
// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad2.2" "-noSPrefixing" "-a"
|
||||
// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common"
|
||||
|
||||
// RUN: %clang --target=shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=DEFINES
|
||||
// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME"
|
||||
|
||||
// RUN: %clang --target=shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=INCLUDES
|
||||
// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath"
|
||||
|
||||
// -fno-split-dwarf-inlining is consumed but not passed to moviCompile.
|
||||
// RUN: %clang --target=shave-myriad -c -### %s -g -fno-inline-functions \
|
||||
// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d -fno-split-dwarf-inlining \
|
||||
// RUN: -ffunction-sections -Xclang -xclangflag -mllvm -llvm-flag 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=PASSTHRU_OPTIONS
|
||||
// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once"
|
||||
// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections"
|
||||
// PASSTHRU_OPTIONS: "-Xclang" "-xclangflag" "-mllvm" "-llvm-flag"
|
||||
|
||||
// RUN: %clang --target=shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=MDMF
|
||||
// MDMF: "-S" "-fno-exceptions" "-DMYRIAD2" "-MD" "-MF" "dep.d" "-MT" "foo.o"
|
||||
|
||||
// RUN: %clang --target=shave-myriad -std=gnu++11 -mcpu=anothercpu -S %s -o foo.o -### 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=STDEQ
|
||||
// STDEQ: "-S" "-fno-exceptions" "-DMYRIAD2" "-std=gnu++11" "-mcpu=anothercpu"
|
||||
|
||||
// RUN: %clang --target=shave-myriad -E -Ifoo %s -o foo.i -### 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=PREPROCESS
|
||||
// PREPROCESS: "-E" "-DMYRIAD2" "-I" "foo"
|
||||
|
||||
// RUN: %clang -stdlib=platform --target=sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck %s --check-prefix=LIBSTDCXX
|
||||
// LIBSTDCXX: "-lstdc++" "-lc" "-lgcc"
|
||||
|
||||
// RUN: %clang -stdlib=libc++ -### --target=sparcel-myriad -S -x c++ %s 2>&1 | FileCheck %s -check-prefix=LIBCXX
|
||||
// LIBCXX: "-internal-isystem" "{{.*}}/../include/c++/v1"
|
||||
|
||||
// RUN: %clang --target=sparc-myriad -### -nostdlib %s 2>&1 | FileCheck %s --check-prefix=NOSTDLIB
|
||||
// NOSTDLIB-NOT: crtbegin.o
|
||||
// NOSTDLIB-NOT: "-lc"
|
||||
|
||||
// RUN: %clang -### -c -g %s --target=sparc-myriad 2>&1 | FileCheck -check-prefix=G_SPARC %s
|
||||
// G_SPARC: "-debug-info-kind=constructor" "-dwarf-version=2"
|
||||
|
||||
// RUN: %clang -### -c %s --target=sparc-myriad-rtems -fuse-init-array 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=USE-INIT-ARRAY %s
|
||||
// USE-INIT-ARRAY-NOT: argument unused
|
@ -259,15 +259,6 @@
|
||||
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
|
||||
// CHECK-ASAN-ANDROID-SHARED-NOT: "-lresolv"
|
||||
|
||||
// RUN: %clang -### %s 2>&1 \
|
||||
// RUN: --target=sparcel-myriad-rtems-elf -fuse-ld=ld -fsanitize=address \
|
||||
// RUN: --sysroot=%S/Inputs/basic_myriad_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ASAN-MYRIAD %s
|
||||
//
|
||||
// CHECK-ASAN-MYRIAD: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
|
||||
// CHECK-ASAN-MYRIAD-NOT: "-lc"
|
||||
// CHECK-ASAN-MYRIAD: libclang_rt.asan-sparcel.a"
|
||||
|
||||
// RUN: %clangxx -### %s 2>&1 \
|
||||
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \
|
||||
// RUN: -fsanitize=thread \
|
||||
|
@ -87,7 +87,6 @@ static_library("Driver") {
|
||||
"ToolChains/MSVC.cpp",
|
||||
"ToolChains/MinGW.cpp",
|
||||
"ToolChains/MipsLinux.cpp",
|
||||
"ToolChains/Myriad.cpp",
|
||||
"ToolChains/NaCl.cpp",
|
||||
"ToolChains/NetBSD.cpp",
|
||||
"ToolChains/OHOS.cpp",
|
||||
|
Loading…
Reference in New Issue
Block a user