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 /include | |
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 'include')
-rw-r--r-- | include/llvm/Target/TargetRegistry.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 6d692df..64d6e12 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); } }; |