diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 6d692df27b8..64d6e12fea3 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -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); } }; diff --git a/lib/ExecutionEngine/JIT/TargetSelect.cpp b/lib/ExecutionEngine/JIT/TargetSelect.cpp index 2b80e7e2bd1..84b745b3f9a 100644 --- a/lib/ExecutionEngine/JIT/TargetSelect.cpp +++ b/lib/ExecutionEngine/JIT/TargetSelect.cpp @@ -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"; diff --git a/lib/Support/TargetRegistry.cpp b/lib/Support/TargetRegistry.cpp index b3446e61092..f9026f12afd 100644 --- a/lib/Support/TargetRegistry.cpp +++ b/lib/Support/TargetRegistry.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/TargetRegistry.h" +#include "llvm/System/Host.h" #include 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; } diff --git a/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp b/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp index d709463a15f..a9f99e0646e 100644 --- a/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp +++ b/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp @@ -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); } diff --git a/lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp b/lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp index 60f53e36167..f148506e10c 100644 --- a/lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp +++ b/lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp @@ -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); } diff --git a/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp b/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp index b86f4b2e4ba..588833bd0cb 100644 --- a/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp +++ b/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp @@ -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); } diff --git a/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp b/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp index bd0e4150382..04171ecab2d 100644 --- a/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp +++ b/lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp @@ -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); } diff --git a/lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp b/lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp index e155b7bee36..d5b64f5c1b7 100644 --- a/lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp +++ b/lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp @@ -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); } diff --git a/lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp b/lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp index e50d607dccd..07de7266f41 100644 --- a/lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp +++ b/lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp @@ -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); } diff --git a/lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp b/lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp index 8b3e1f42a24..eb3b865585d 100644 --- a/lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp +++ b/lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp @@ -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); } diff --git a/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp b/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp index 1188a74f160..35cbf8b8836 100644 --- a/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp +++ b/lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp @@ -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); } diff --git a/lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp b/lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp index 20bbba8a91c..2a88fe52c9a 100644 --- a/lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp +++ b/lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp @@ -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); } diff --git a/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp b/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp index ca1f490b001..3d25dad2d64 100644 --- a/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp +++ b/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp @@ -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); } diff --git a/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp b/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp index 131bdcc35b4..a2f1e5ddfd0 100644 --- a/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp +++ b/lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp @@ -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); } diff --git a/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp b/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp index 09cb9c3f40f..49c8e19b3ac 100644 --- a/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp +++ b/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp @@ -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); } diff --git a/lib/Target/X86/TargetInfo/X86TargetInfo.cpp b/lib/Target/X86/TargetInfo/X86TargetInfo.cpp index a130e4e4827..6201002d7d0 100644 --- a/lib/Target/X86/TargetInfo/X86TargetInfo.cpp +++ b/lib/Target/X86/TargetInfo/X86TargetInfo.cpp @@ -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); } diff --git a/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp b/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp index 9dec7929932..48ad484e0d8 100644 --- a/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp +++ b/lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp @@ -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); }