mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
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. llvm-svn: 77060
This commit is contained in:
parent
b09f01d842
commit
d699ffc2ac
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user