diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-25 10:09:50 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-25 10:09:50 +0000 |
commit | d6fd377f3333922c4e928019cdfa124ff7f4dd2e (patch) | |
tree | da15e380d88d8a3072e1d8cf434f424880b0a2ce /lib/Target | |
parent | e0d12d5f7b0a6369df128c8b0cc43e6e08a804a0 (diff) | |
download | external_llvm-d6fd377f3333922c4e928019cdfa124ff7f4dd2e.zip external_llvm-d6fd377f3333922c4e928019cdfa124ff7f4dd2e.tar.gz external_llvm-d6fd377f3333922c4e928019cdfa124ff7f4dd2e.tar.bz2 |
Simplify JIT target selection.
- 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
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp | 22 | ||||
-rw-r--r-- | lib/Target/Alpha/TargetInfo/AlphaTargetInfo.cpp | 12 | ||||
-rw-r--r-- | lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/CellSPU/TargetInfo/CellSPUTargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/CppBackend/TargetInfo/CppBackendTargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/MSIL/TargetInfo/MSILTargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/MSP430/TargetInfo/MSP430TargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp | 14 | ||||
-rw-r--r-- | lib/Target/PIC16/TargetInfo/PIC16TargetInfo.cpp | 14 | ||||
-rw-r--r-- | lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp | 24 | ||||
-rw-r--r-- | lib/Target/Sparc/TargetInfo/SparcTargetInfo.cpp | 7 | ||||
-rw-r--r-- | lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp | 9 | ||||
-rw-r--r-- | lib/Target/X86/TargetInfo/X86TargetInfo.cpp | 22 | ||||
-rw-r--r-- | lib/Target/XCore/TargetInfo/XCoreTargetInfo.cpp | 7 |
14 files changed, 27 insertions, 139 deletions
diff --git a/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp b/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp index d709463..a9f99e0 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 60f53e3..f148506 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 b86f4b2..588833b 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 bd0e415..04171ec 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 e155b7b..d5b64f5 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 e50d607..07de726 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 8b3e1f4..eb3b865 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 1188a74..35cbf8b 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 20bbba8..2a88fe5 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 ca1f490..3d25dad 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 131bdcc..a2f1e5d 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 09cb9c3..49c8e19 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 a130e4e..6201002 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 9dec792..48ad484 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); } |