Simplify JIT target selection.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 25 Jul 2009 10:09:50 +0000 (10:09 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 25 Jul 2009 10:09:50 +0000 (10:09 +0000)
 - Instead of requiring targets to define a JIT quality match function, we just
   have them specify if they support a JIT.

 - Target selection for the JIT just gets the host triple and looks for the best
   target which matches the triple and has a JIT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77060 91177308-0d34-0410-b5e6-96231b3b80d8

17 files changed:
include/llvm/Target/TargetRegistry.h
lib/ExecutionEngine/JIT/TargetSelect.cpp
lib/Support/TargetRegistry.cpp
lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp
lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp
lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp
lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp
lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp
lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp
lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp
lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp
lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp
lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp
lib/Target/X86/TargetInfo/X86TargetInfo.cpp
lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp

index 6d692df27b85fc003f54db498e51f2974947e2df..64d6e12fea3e2ea3fc23a91bcf5e3e705cd85cf1 100644 (file)
@@ -68,16 +68,15 @@ namespace llvm {
     /// of a module.
     ModuleMatchQualityFnTy ModuleMatchQualityFn;
 
-    /// JITMatchQualityFn - The target function for rating the match quality
-    /// with the host.
-    JITMatchQualityFnTy JITMatchQualityFn;
-
     /// Name - The target name.
     const char *Name;
 
     /// ShortDesc - A short description of the target.
     const char *ShortDesc;
 
+    /// HasJIT - Whether this target supports the JIT.
+    bool HasJIT;
+
     /// TargetMachineCtorFn - Construction function for this target's
     /// TargetMachine, if registered.
     TargetMachineCtorTy TargetMachineCtorFn;
@@ -100,9 +99,7 @@ namespace llvm {
     /// getShortDescription - Get a short description of the target.
     const char *getShortDescription() const { return ShortDesc; }
 
-    /// getJITMatchQuality - Get the quality of this targets match for use as a
-    /// JIT.
-    unsigned getJITMatchQuality() const { return JITMatchQualityFn(); }
+    bool hasJIT() const { return HasJIT; }
 
     /// hasTargetMachine - Check if this target supports code generation.
     bool hasTargetMachine() const { return TargetMachineCtorFn != 0; }
@@ -224,14 +221,14 @@ namespace llvm {
     /// this target.
     /// @param MQualityFn - The module match quality computation function for
     /// this target.
-    /// @param JITMatchQualityFn - The JIT match quality computation function
-    /// for this target.
+    /// @param HasJIT - Whether the target supports JIT code
+    /// generation.
     static void RegisterTarget(Target &T,
                                const char *Name,
                                const char *ShortDesc,
                                Target::TripleMatchQualityFnTy TQualityFn,
                                Target::ModuleMatchQualityFnTy MQualityFn,
-                               Target::JITMatchQualityFnTy JITQualityFn);
+                               bool HasJIT = false);
                                
     /// RegisterTargetMachine - Register a TargetMachine implementation for the
     /// given target.
@@ -292,6 +289,8 @@ namespace llvm {
   ///
   /// namespace {
   ///   struct FooInfo {
+  ///     static const bool HasJIT = ...;
+  ///
   ///     static unsigned getJITMatchQuality() { ... }
   ///     static unsigned getTripleMatchQuality(const std::string &) { ... }
   ///     static unsigned getModuleMatchQuality(const Module &) { ... }
@@ -307,7 +306,7 @@ namespace llvm {
       TargetRegistry::RegisterTarget(T, Name, Desc,
                                      &TargetInfoImpl::getTripleMatchQuality,
                                      &TargetInfoImpl::getModuleMatchQuality,
-                                     &TargetInfoImpl::getJITMatchQuality);
+                                     TargetInfoImpl::HasJIT);
     }
   };
 
index 2b80e7e2bd16d36d6eb14041c7e6cb45acf01ef2..84b745b3f9a399495ba17e46e4cf1ad03bbbda64 100644 (file)
@@ -65,7 +65,7 @@ TargetMachine *JIT::selectTarget(ModuleProvider *MP, std::string *ErrorStr) {
       return 0;
     }        
 
-    if (TheTarget->getJITMatchQuality() == 0) {
+    if (!TheTarget->hasJIT()) {
       cerr << "WARNING: This target JIT is not designed for the host you are"
            << " running.  If bad things happen, please choose a different "
            << "-march switch.\n";
index b3446e6109227872d1f3c601ab9b39a9b47e9e63..f9026f12afd1cef2ff327013ed585ae52279a2c2 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Target/TargetRegistry.h"
+#include "llvm/System/Host.h"
 #include <cassert>
 using namespace llvm;
 
@@ -77,9 +78,18 @@ TargetRegistry::getClosestStaticTargetForModule(const Module &M,
     }
   }
 
+  // FIXME: This is a hack to ignore super weak matches like msil, etc. and look
+  // by host instead. They will be found again via the triple.
+  if (Best && BestQuality == 1)    
+    Best = EquallyBest = 0;
+
+  // If that failed, try looking up the host triple.
+  if (!Best)
+    Best = getClosestStaticTargetForTriple(sys::getHostTriple(), Error);
+
   if (!Best) {
     Error = "No available targets are compatible with this module";
-    return 0;
+    return Best;
   }
 
   // Otherwise, take the best target, but make sure we don't have two equally
@@ -95,6 +105,8 @@ TargetRegistry::getClosestStaticTargetForModule(const Module &M,
 
 const Target *
 TargetRegistry::getClosestTargetForJIT(std::string &Error) {
+  std::string Triple = sys::getHostTriple();
+
   // Provide special warning when no targets are initialized.
   if (begin() == end()) {
     Error = "No JIT is available for this host (no targets are registered)";
@@ -104,7 +116,10 @@ TargetRegistry::getClosestTargetForJIT(std::string &Error) {
   const Target *Best = 0, *EquallyBest = 0;
   unsigned BestQuality = 0;
   for (iterator it = begin(), ie = end(); it != ie; ++it) {
-    if (unsigned Qual = it->JITMatchQualityFn()) {
+    if (!it->hasJIT())
+      continue;
+
+    if (unsigned Qual = it->TripleMatchQualityFn(Triple)) {
       if (!Best || Qual > BestQuality) {
         Best = &*it;
         EquallyBest = 0;
@@ -128,8 +143,8 @@ void TargetRegistry::RegisterTarget(Target &T,
                                     const char *ShortDesc,
                                     Target::TripleMatchQualityFnTy TQualityFn,
                                     Target::ModuleMatchQualityFnTy MQualityFn,
-                                    Target::JITMatchQualityFnTy JITQualityFn) {
-  assert(Name && ShortDesc && TQualityFn && MQualityFn && JITQualityFn &&
+                                    bool HasJIT) {
+  assert(Name && ShortDesc && TQualityFn && MQualityFn &&
          "Missing required target information!");
 
   // Check if this target has already been initialized, we allow this as a
@@ -145,6 +160,6 @@ void TargetRegistry::RegisterTarget(Target &T,
   T.ShortDesc = ShortDesc;
   T.TripleMatchQualityFn = TQualityFn;
   T.ModuleMatchQualityFn = MQualityFn;
-  T.JITMatchQualityFn = JITQualityFn;
+  T.HasJIT = HasJIT;
 }
 
index d709463a15f5bb58fea01ddcb6531089cb0cf0c2..a9f99e0646e4eaea1d203ae0eb38a95520db0a06 100644 (file)
@@ -14,13 +14,6 @@ using namespace llvm;
 
 Target llvm::TheARMTarget;
 
-static unsigned ARM_JITMatchQuality() {
-#if defined(__arm__)
-  return 10;
-#endif
-  return 0;
-}
-
 static unsigned ARM_TripleMatchQuality(const std::string &TT) {
   // Match arm-foo-bar, as well as things like armv5blah-*
   if (TT.size() >= 4 &&
@@ -45,18 +38,11 @@ static unsigned ARM_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
 
-  return ARM_JITMatchQuality()/2;
+  return 0;
 }
 
 Target llvm::TheThumbTarget;
 
-static unsigned Thumb_JITMatchQuality() {
-#if defined(__thumb__)
-  return 10;
-#endif
-  return 0;
-}
-
 static unsigned Thumb_TripleMatchQuality(const std::string &TT) {
   // Match thumb-foo-bar, as well as things like thumbv5blah-*
   if (TT.size() >= 6 &&
@@ -81,7 +67,7 @@ static unsigned Thumb_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
 
-  return Thumb_JITMatchQuality()/2;
+  return 0;
 }
 
 extern "C" void LLVMInitializeARMTargetInfo() { 
@@ -89,11 +75,11 @@ extern "C" void LLVMInitializeARMTargetInfo() {
                                   "ARM",
                                   &ARM_TripleMatchQuality,
                                   &ARM_ModuleMatchQuality,
-                                  &ARM_JITMatchQuality);
+                                 /*HasJIT=*/true);
 
   TargetRegistry::RegisterTarget(TheThumbTarget, "thumb",    
                                   "Thumb",
                                   &Thumb_TripleMatchQuality,
                                   &Thumb_ModuleMatchQuality,
-                                  &Thumb_JITMatchQuality);
+                                 /*HasJIT=*/true);
 }
index 60f53e36167cb8f81f9706313daa4f66c549ad65..f148506e10c25e91923b68129e0f7bc80265402b 100644 (file)
@@ -14,14 +14,6 @@ using namespace llvm;
 
 llvm::Target llvm::TheAlphaTarget;
 
-static unsigned Alpha_JITMatchQuality() {
-#ifdef __alpha
-  return 10;
-#else
-  return 0;
-#endif
-}
-
 static unsigned Alpha_TripleMatchQuality(const std::string &TT) {
   // We strongly match "alpha*".
   if (TT.size() >= 5 && TT[0] == 'a' && TT[1] == 'l' && TT[2] == 'p' &&
@@ -46,7 +38,7 @@ static unsigned Alpha_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
 
-  return Alpha_JITMatchQuality()/2;
+  return 0;
 }
 
 extern "C" void LLVMInitializeAlphaTargetInfo() { 
@@ -54,5 +46,5 @@ extern "C" void LLVMInitializeAlphaTargetInfo() {
                                   "Alpha [experimental]",
                                   &Alpha_TripleMatchQuality,
                                   &Alpha_ModuleMatchQuality,
-                                  &Alpha_JITMatchQuality);
+                                  /*HasJIT=*/true);
 }
index b86f4b2e4ba35c77cf480e4e3c539ee05343d891..588833bd0cbfd37b75949cbdfa36705d4c4f2053 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheCBackendTarget;
 
-static unsigned CBackend_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned CBackend_TripleMatchQuality(const std::string &TT) {
   // This class always works, but must be requested explicitly on 
   // llc command line.
@@ -34,6 +30,5 @@ extern "C" void LLVMInitializeCBackendTargetInfo() {
   TargetRegistry::RegisterTarget(TheCBackendTarget, "c",
                                   "C backend",
                                   &CBackend_TripleMatchQuality,
-                                  &CBackend_ModuleMatchQuality,
-                                  &CBackend_JITMatchQuality);
+                                  &CBackend_ModuleMatchQuality);
 }
index bd0e4150382d175874ff760fdf821019f16dac91..04171ecab2d4becb7bcc55234b917f26c4d546a7 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheCellSPUTarget;
 
-static unsigned CellSPU_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned CellSPU_TripleMatchQuality(const std::string &TT) {
   // We strongly match "spu-*" or "cellspu-*".
   if ((TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "spu") ||
@@ -44,6 +40,5 @@ extern "C" void LLVMInitializeCellSPUTargetInfo() {
   TargetRegistry::RegisterTarget(TheCellSPUTarget, "cellspu",
                                   "STI CBEA Cell SPU [experimental]",
                                   &CellSPU_TripleMatchQuality,
-                                  &CellSPU_ModuleMatchQuality,
-                                  &CellSPU_JITMatchQuality);
+                                  &CellSPU_ModuleMatchQuality);
 }
index e155b7bee361ee57c0fde209b6709b1260aeb941..d5b64f5c1b73e2f3cd33d41c4106d2f53e5bb9d8 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheCppBackendTarget;
 
-static unsigned CppBackend_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned CppBackend_TripleMatchQuality(const std::string &TT) {
   // This class always works, but shouldn't be the default in most cases.
   return 1;
@@ -32,6 +28,5 @@ extern "C" void LLVMInitializeCppBackendTargetInfo() {
   TargetRegistry::RegisterTarget(TheCppBackendTarget, "cpp",    
                                   "C++ backend",
                                   &CppBackend_TripleMatchQuality,
-                                  &CppBackend_ModuleMatchQuality,
-                                  &CppBackend_JITMatchQuality);
+                                  &CppBackend_ModuleMatchQuality);
 }
index e50d607dccdaf88b2848eabbb6887b904bda731b..07de7266f415ccfc7a933c77a347aec96a1eb296 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheMSILTarget;
 
-static unsigned MSIL_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned MSIL_TripleMatchQuality(const std::string &TT) {
   // This class always works, but shouldn't be the default in most cases.
   return 1;
@@ -32,6 +28,5 @@ extern "C" void LLVMInitializeMSILTargetInfo() {
   TargetRegistry::RegisterTarget(TheMSILTarget, "msil",    
                                   "MSIL backend",
                                   &MSIL_TripleMatchQuality,
-                                  &MSIL_ModuleMatchQuality,
-                                  &MSIL_JITMatchQuality);
+                                  &MSIL_ModuleMatchQuality);
 }
index 8b3e1f42a2496bba5c6635367997e7ec035950f6..eb3b865585d50746e90564821cab3a63625462fe 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheMSP430Target;
 
-static unsigned MSP430_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned MSP430_TripleMatchQuality(const std::string &TT) {
   // We strongly match msp430
   if (TT.size() >= 6 && TT[0] == 'm' && TT[1] == 's' && TT[2] == 'p' &&
@@ -42,6 +38,5 @@ extern "C" void LLVMInitializeMSP430TargetInfo() {
   TargetRegistry::RegisterTarget(TheMSP430Target, "msp430",    
                                   "MSP430 [experimental]",
                                   &MSP430_TripleMatchQuality,
-                                  &MSP430_ModuleMatchQuality,
-                                  &MSP430_JITMatchQuality);
+                                  &MSP430_ModuleMatchQuality);
 }
index 1188a74f160c844df47992f14e935dc122f4ebcd..35cbf8b883615dde9de2533f518f8fd5a0ef6a3b 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheMipsTarget;
 
-static unsigned Mips_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned Mips_TripleMatchQuality(const std::string &TT) {
   // We strongly match "mips*-*".
   if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-")
@@ -43,10 +39,6 @@ static unsigned Mips_ModuleMatchQuality(const Module &M) {
 
 Target llvm::TheMipselTarget;
 
-static unsigned Mipsel_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned Mipsel_TripleMatchQuality(const std::string &TT) {
   // We strongly match "mips*el-*".
   if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-")
@@ -77,12 +69,10 @@ extern "C" void LLVMInitializeMipsTargetInfo() {
   TargetRegistry::RegisterTarget(TheMipsTarget, "mips",
                                   "Mips",
                                   &Mips_TripleMatchQuality,
-                                  &Mips_ModuleMatchQuality,
-                                  &Mips_JITMatchQuality);
+                                  &Mips_ModuleMatchQuality);
 
   TargetRegistry::RegisterTarget(TheMipselTarget, "mipsel",
                                   "Mipsel",
                                   &Mipsel_TripleMatchQuality,
-                                  &Mipsel_ModuleMatchQuality,
-                                  &Mipsel_JITMatchQuality);
+                                  &Mipsel_ModuleMatchQuality);
 }
index 20bbba8a91c6ff260fc2934251b0201e5c6d3563..2a88fe52c9afb2ff52ca20778ec4ce57b75c7343 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::ThePIC16Target;
 
-static unsigned PIC16_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned PIC16_TripleMatchQuality(const std::string &TT) {
   return 0;
 }
@@ -28,10 +24,6 @@ static unsigned PIC16_ModuleMatchQuality(const Module &M) {
 
 Target llvm::TheCooperTarget;
 
-static unsigned Cooper_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned Cooper_TripleMatchQuality(const std::string &TT) {
   return 0;
 }
@@ -44,12 +36,10 @@ extern "C" void LLVMInitializePIC16TargetInfo() {
   TargetRegistry::RegisterTarget(ThePIC16Target, "pic16",
                                   "PIC16 14-bit [experimental]",
                                   &PIC16_TripleMatchQuality,
-                                  &PIC16_ModuleMatchQuality,
-                                  &PIC16_JITMatchQuality);
+                                  &PIC16_ModuleMatchQuality);
 
   TargetRegistry::RegisterTarget(TheCooperTarget, "cooper",    
                                   "PIC16 Cooper [experimental]",
                                   &Cooper_TripleMatchQuality,
-                                  &Cooper_ModuleMatchQuality,
-                                  &Cooper_JITMatchQuality);
+                                  &Cooper_ModuleMatchQuality);
 }
index ca1f490b00180013e07b7257e44410e4f3de8f1c..3d25dad2d647500e3fb0f07409770b607243ecc2 100644 (file)
@@ -14,14 +14,6 @@ using namespace llvm;
 
 Target llvm::ThePPC32Target;
 
-static unsigned PPC32_JITMatchQuality() {
-#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
-  if (sizeof(void*) == 4)
-    return 10;
-#endif
-  return 0;
-}
-
 static unsigned PPC32_TripleMatchQuality(const std::string &TT) {
   // We strongly match "powerpc-*".
   if (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "powerpc-")
@@ -45,19 +37,11 @@ static unsigned PPC32_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
   
-  return PPC32_JITMatchQuality()/2;
+  return 0;
 }
 
 Target llvm::ThePPC64Target;
 
-static unsigned PPC64_JITMatchQuality() {
-#if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) || defined(__PPC__)
-  if (sizeof(void*) == 8)
-    return 10;
-#endif
-  return 0;
-}
-
 static unsigned PPC64_TripleMatchQuality(const std::string &TT) {
   // We strongly match "powerpc64-*".
   if (TT.size() >= 10 && std::string(TT.begin(), TT.begin()+10) == "powerpc64-")
@@ -81,7 +65,7 @@ static unsigned PPC64_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
   
-  return PPC64_JITMatchQuality()/2;
+  return 0;
 }
 
 extern "C" void LLVMInitializePowerPCTargetInfo() { 
@@ -89,11 +73,11 @@ extern "C" void LLVMInitializePowerPCTargetInfo() {
                                   "PowerPC 32",
                                   &PPC32_TripleMatchQuality,
                                   &PPC32_ModuleMatchQuality,
-                                  &PPC32_JITMatchQuality);
+                                 /*HasJIT=*/true);
 
   TargetRegistry::RegisterTarget(ThePPC64Target, "ppc64",
                                   "PowerPC 64",
                                   &PPC64_TripleMatchQuality,
                                   &PPC64_ModuleMatchQuality,
-                                  &PPC64_JITMatchQuality);
+                                 /*HasJIT=*/true);
 }
index 131bdcc35b4efa3c0ad2f619668423b8b35afc5d..a2f1e5ddfd0def4d8b1773ac0325e00752f2928d 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheSparcTarget;
 
-static unsigned Sparc_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned Sparc_TripleMatchQuality(const std::string &TT) {
   if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "sparc-")
     return 20;
@@ -57,6 +53,5 @@ extern "C" void LLVMInitializeSparcTargetInfo() {
   TargetRegistry::RegisterTarget(TheSparcTarget, "sparc",
                                   "Sparc",
                                   &Sparc_TripleMatchQuality,
-                                  &Sparc_ModuleMatchQuality,
-                                  &Sparc_JITMatchQuality);
+                                  &Sparc_ModuleMatchQuality);
 }
index 09cb9c3f40fd85844203bbba82aa13b55d0453b5..49c8e19b3acd40f47e5d698b4655a9cfab5047a4 100644 (file)
@@ -1,4 +1,4 @@
-//===-- SystemZTargetInfo.cpp - SystemZ Target Implementation -----------------===//
+//===-- SystemZTargetInfo.cpp - SystemZ Target Implementation -------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheSystemZTarget;
 
-static unsigned SystemZ_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned SystemZ_TripleMatchQuality(const std::string &TT) {
   // We strongly match s390x
   if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
@@ -40,6 +36,5 @@ extern "C" void LLVMInitializeSystemZTargetInfo() {
   TargetRegistry::RegisterTarget(TheSystemZTarget, "systemz",
                                  "SystemZ",
                                  &SystemZ_TripleMatchQuality,
-                                 &SystemZ_ModuleMatchQuality,
-                                 &SystemZ_JITMatchQuality);
+                                 &SystemZ_ModuleMatchQuality);
 }
index a130e4e4827a5447bb740369689897cd9434c8f6..6201002d7d055cf11fa1032521c1bfe69591a0e2 100644 (file)
@@ -14,13 +14,6 @@ using namespace llvm;
 
 Target llvm::TheX86_32Target;
 
-static unsigned X86_32_JITMatchQuality() {
-#if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
-  return 10;
-#endif
-  return 0;
-}
-
 static unsigned X86_32_TripleMatchQuality(const std::string &TT) {
   // We strongly match "i[3-9]86-*".
   if (TT.size() >= 5 && TT[0] == 'i' && TT[2] == '8' && TT[3] == '6' &&
@@ -45,18 +38,11 @@ static unsigned X86_32_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
 
-  return X86_32_JITMatchQuality()/2;
+  return 0;
 }
 
 Target llvm::TheX86_64Target;
 
-static unsigned X86_64_JITMatchQuality() {
-#if defined(__x86_64__) || defined(_M_AMD64)
-  return 10;
-#endif
-  return 0;
-}
-
 static unsigned X86_64_TripleMatchQuality(const std::string &TT) {
   // We strongly match "x86_64-*".
   if (TT.size() >= 7 && TT[0] == 'x' && TT[1] == '8' && TT[2] == '6' &&
@@ -81,7 +67,7 @@ static unsigned X86_64_ModuleMatchQuality(const Module &M) {
            M.getPointerSize() != Module::AnyPointerSize)
     return 0;                                    // Match for some other target
 
-  return X86_64_JITMatchQuality()/2;
+  return 0;
 }
 
 extern "C" void LLVMInitializeX86TargetInfo() { 
@@ -89,11 +75,11 @@ extern "C" void LLVMInitializeX86TargetInfo() {
                                   "32-bit X86: Pentium-Pro and above",
                                   &X86_32_TripleMatchQuality,
                                   &X86_32_ModuleMatchQuality,
-                                  &X86_32_JITMatchQuality);
+                                  /*HasJIT=*/true);
 
   TargetRegistry::RegisterTarget(TheX86_64Target, "x86-64",    
                                   "64-bit X86: EM64T and AMD64",
                                   &X86_64_TripleMatchQuality,
                                   &X86_64_ModuleMatchQuality,
-                                  &X86_64_JITMatchQuality);
+                                  /*HasJIT=*/true);
 }
index 9dec792993279ca44ebb5f0f641999d1c8743798..48ad484e0d805cfcdacbcf9fce496d57816e8ede 100644 (file)
@@ -14,10 +14,6 @@ using namespace llvm;
 
 Target llvm::TheXCoreTarget;
 
-static unsigned XCore_JITMatchQuality() {
-  return 0;
-}
-
 static unsigned XCore_TripleMatchQuality(const std::string &TT) {
   if (TT.size() >= 6 && std::string(TT.begin(), TT.begin()+6) == "xcore-")
     return 20;
@@ -38,6 +34,5 @@ extern "C" void LLVMInitializeXCoreTargetInfo() {
   TargetRegistry::RegisterTarget(TheXCoreTarget, "xcore",
                                   "XCore",
                                   &XCore_TripleMatchQuality,
-                                  &XCore_ModuleMatchQuality,
-                                  &XCore_JITMatchQuality);
+                                  &XCore_ModuleMatchQuality);
 }