[llvm-commits] [llvm] r77950 - in /llvm/trunk: include/llvm/Target/TargetRegistry.h lib/ExecutionEngine/JIT/TargetSelect.cpp lib/Support/TargetRegistry.cpp lib/Target/CBackend/CBackend.cpp tools/llc/llc.cpp tools/llvm-mc/llvm-mc.cpp tools/lto/LTOCodeGenerator.cpp tools/lto/LTOModule.cpp
Daniel Dunbar
daniel at zuster.org
Sun Aug 2 21:21:02 PDT 2009
Author: ddunbar
Date: Sun Aug 2 23:20:57 2009
New Revision: 77950
URL: http://llvm.org/viewvc/llvm-project?rev=77950&view=rev
Log:
Remove now unused arguments from TargetRegistry::lookupTarget.
Modified:
llvm/trunk/include/llvm/Target/TargetRegistry.h
llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp
llvm/trunk/lib/Support/TargetRegistry.cpp
llvm/trunk/lib/Target/CBackend/CBackend.cpp
llvm/trunk/tools/llc/llc.cpp
llvm/trunk/tools/llvm-mc/llvm-mc.cpp
llvm/trunk/tools/lto/LTOCodeGenerator.cpp
llvm/trunk/tools/lto/LTOModule.cpp
Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegistry.h Sun Aug 2 23:20:57 2009
@@ -199,14 +199,9 @@
/// 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 @@
/// 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
Modified: llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/TargetSelect.cpp Sun Aug 2 23:20:57 2009
@@ -51,10 +51,7 @@
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;
Modified: llvm/trunk/lib/Support/TargetRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetRegistry.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TargetRegistry.cpp (original)
+++ llvm/trunk/lib/Support/TargetRegistry.cpp Sun Aug 2 23:20:57 2009
@@ -20,8 +20,6 @@
}
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 *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 @@
}
}
- // 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 @@
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;
+}
+
Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sun Aug 2 23:20:57 2009
@@ -3186,11 +3186,7 @@
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.
Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Sun Aug 2 23:20:57 2009
@@ -265,10 +265,7 @@
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 "
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Sun Aug 2 23:20:57 2009
@@ -146,11 +146,7 @@
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";
Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Sun Aug 2 23:20:57 2009
@@ -333,11 +333,7 @@
// 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;
Modified: llvm/trunk/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=77950&r1=77949&r2=77950&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto/LTOModule.cpp Sun Aug 2 23:20:57 2009
@@ -156,10 +156,7 @@
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;
More information about the llvm-commits
mailing list