Remove now unused arguments from TargetRegistry::lookupTarget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-03 04:20:57 +00:00
parent 9072c8198d
commit 4bd03abe59
8 changed files with 18 additions and 49 deletions

View File

@ -199,14 +199,9 @@ namespace llvm {
/// lookupTarget - Lookup a target based on a target triple.
///
/// \param Triple - The triple to use for finding a target.
/// \param FallbackToHost - If true and no target is found for the given
/// \arg Triple, then the host's triple will be used.
/// \param RequireJIT - Require the target to support JIT compilation.
/// \param Error - On failure, an error string describing why no target was
/// found.
static const Target *lookupTarget(const std::string &Triple,
bool FallbackToHost,
bool RequireJIT,
std::string &Error);
/// getClosestTargetForJIT - Pick the best target that is compatible with
@ -214,9 +209,7 @@ namespace llvm {
/// and sets the Error string to a reason.
///
/// Mainted for compatibility through 2.6.
static const Target *getClosestTargetForJIT(std::string &Error) {
return lookupTarget("", true, true, Error);
}
static const Target *getClosestTargetForJIT(std::string &Error);
/// @}
/// @name Target Registration

View File

@ -51,10 +51,7 @@ TargetMachine *JIT::selectTarget(ModuleProvider *MP, std::string *ErrorStr) {
std::string Error;
const Target *TheTarget =
TargetRegistry::lookupTarget(TheTriple.getTriple(),
/*FallbackToHost=*/false,
/*RequireJIT=*/false,
Error);
TargetRegistry::lookupTarget(TheTriple.getTriple(), Error);
if (TheTarget == 0) {
if (ErrorStr)
*ErrorStr = Error;

View File

@ -20,8 +20,6 @@ TargetRegistry::iterator TargetRegistry::begin() {
}
const Target *TargetRegistry::lookupTarget(const std::string &TT,
bool FallbackToHost,
bool RequireJIT,
std::string &Error) {
// Provide special warning when no targets are initialized.
if (begin() == end()) {
@ -31,9 +29,6 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
const Target *Best = 0, *EquallyBest = 0;
unsigned BestQuality = 0;
for (iterator it = begin(), ie = end(); it != ie; ++it) {
if (RequireJIT && !it->hasJIT())
continue;
if (unsigned Qual = it->TripleMatchQualityFn(TT)) {
if (!Best || Qual > BestQuality) {
Best = &*it;
@ -44,15 +39,6 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
}
}
// FIXME: Hack. If we only have an extremely weak match and the client
// requested to fall back to the host, then ignore it and try again.
if (BestQuality == 1 && FallbackToHost)
Best = 0;
// Fallback to the host triple if we didn't find anything.
if (!Best && FallbackToHost)
return lookupTarget(sys::getHostTriple(), false, RequireJIT, Error);
if (!Best) {
Error = "No available targets are compatible with this triple";
return 0;
@ -92,3 +78,14 @@ void TargetRegistry::RegisterTarget(Target &T,
T.HasJIT = HasJIT;
}
const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error);
if (TheTarget && !TheTarget->hasJIT()) {
Error = "No JIT compatible target available for this host";
return 0;
}
return TheTarget;
}

View File

@ -3186,11 +3186,7 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) {
Triple = llvm::sys::getHostTriple();
std::string E;
const Target *Match =
TargetRegistry::lookupTarget(Triple,
/*FallbackToHost=*/false,
/*RequireJIT=*/false,
E);
const Target *Match = TargetRegistry::lookupTarget(Triple, E);
if (Match) {
// Per platform Target Machines don't exist, so create it;
// this must be done only once.

View File

@ -265,10 +265,7 @@ int main(int argc, char **argv) {
TheTriple.setArch(Type);
} else {
std::string Err;
TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(),
/*FallbackToHost=*/false,
/*RequireJIT=*/false,
Err);
TheTarget = TargetRegistry::lookupTarget(TheTriple.getTriple(), Err);
if (TheTarget == 0) {
errs() << argv[0] << ": error auto-selecting target for module '"
<< Err << "'. Please use the -march option to explicitly "

View File

@ -146,11 +146,7 @@ static TargetAsmParser *GetTargetAsmParser(const char *ProgName,
MCAsmParser &Parser) {
// Get the target specific parser.
std::string Error;
const Target *TheTarget =
TargetRegistry::lookupTarget(TripleName,
/*FallbackToHost=*/true,
/*RequireJIT=*/false,
Error);
const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
if (TheTarget == 0) {
errs() << ProgName << ": error: unable to get target for '" << TripleName
<< "', see --version and --triple.\n";

View File

@ -333,11 +333,7 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
// create target machine from info for merged modules
Module* mergedModule = _linker.getModule();
const Target *march =
TargetRegistry::lookupTarget(Triple,
/*FallbackToHost=*/false,
/*RequireJIT=*/false,
errMsg);
const Target *march = TargetRegistry::lookupTarget(Triple, errMsg);
if ( march == NULL )
return true;

View File

@ -156,10 +156,7 @@ LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
Triple = sys::getHostTriple();
// find machine architecture for this module
const Target* march = TargetRegistry::lookupTarget(Triple,
/*FallbackToHost=*/false,
/*RequireJIT=*/false,
errMsg);
const Target* march = TargetRegistry::lookupTarget(Triple, errMsg);
if ( march == NULL )
return NULL;