Remove now unused arguments from TargetRegistry::lookupTarget.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 3 Aug 2009 04:20:57 +0000 (04:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 3 Aug 2009 04:20:57 +0000 (04:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77950 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 93991dc687324f0614dd973c53eb9f6efddf3f29..496df845cb341b1fe3cb929af687f198a895e46d 100644 (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
index 55ff44121ddc4d8acb9ff52d634fe2c20d8b4fc9..c30a698822bc2da5b7744ba03dac7ce42ab7b7fd 100644 (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;
index c60322bdcd7ba93ce93534bb392e8518d0a9a5b6..79f30a71f2b57db3eebd69eb080269198feb3251 100644 (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;
+}
+
index c014006f54cacc51090315a4fd5e895d804fe058..7a43233cfc26cb403648d77c5ab6937ad2aa6c90 100644 (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.
index e34685751428e65897e7fe259e6214ae5e7f3bad..5782e4224575bcb0956cfac3f94627eba809a0f3 100644 (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 "
index c372547072c06dd353852ee1661fad02ad3164c8..7129dda937956060edda1bc551d3621db6b5ab00 100644 (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";
index ac7af13cb8018a57e30a85b7cd524bc7005428fe..c78c2a4738002e120e283b989fb49c85184c035a 100644 (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;
 
index 9a8b155275ffb3c53b04e90fefdb14d4ea0744f4..8fca056afc27ba71e7acf31ca6200606f841cf93 100644 (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;