diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 04:20:57 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-03 04:20:57 +0000 |
commit | 4bd03abe593222b26e84066223feb321bf738625 (patch) | |
tree | 591cb633cfb9cf878cfe3de17e10dcd92d0210d4 | |
parent | 9072c8198de8730a1332ca5e03a2a597631b7615 (diff) |
Remove now unused arguments from TargetRegistry::lookupTarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77950 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetRegistry.h | 9 | ||||
-rw-r--r-- | lib/ExecutionEngine/JIT/TargetSelect.cpp | 5 | ||||
-rw-r--r-- | lib/Support/TargetRegistry.cpp | 25 | ||||
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 6 | ||||
-rw-r--r-- | tools/llc/llc.cpp | 5 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 6 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 6 | ||||
-rw-r--r-- | tools/lto/LTOModule.cpp | 5 |
8 files changed, 18 insertions, 49 deletions
diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 93991dc687..496df845cb 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -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 diff --git a/lib/ExecutionEngine/JIT/TargetSelect.cpp b/lib/ExecutionEngine/JIT/TargetSelect.cpp index 55ff44121d..c30a698822 100644 --- a/lib/ExecutionEngine/JIT/TargetSelect.cpp +++ b/lib/ExecutionEngine/JIT/TargetSelect.cpp @@ -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; diff --git a/lib/Support/TargetRegistry.cpp b/lib/Support/TargetRegistry.cpp index c60322bdcd..79f30a71f2 100644 --- a/lib/Support/TargetRegistry.cpp +++ b/lib/Support/TargetRegistry.cpp @@ -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; +} + diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index c014006f54..7a43233cfc 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -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. diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index e346857514..5782e42245 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -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 " diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index c372547072..7129dda937 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -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"; diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index ac7af13cb8..c78c2a4738 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -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; diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 9a8b155275..8fca056afc 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -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; |