diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 11:23:49 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-15 11:23:49 +0000 |
commit | 4d1be777f81137bab98025d1c37c08ef0ec2f204 (patch) | |
tree | aedada2beb4e92650e5515f3650203649acf7102 | |
parent | 3fb7eee9c210bcfd674e78c70244e3f42473c19b (diff) | |
download | external_llvm-4d1be777f81137bab98025d1c37c08ef0ec2f204.zip external_llvm-4d1be777f81137bab98025d1c37c08ef0ec2f204.tar.gz external_llvm-4d1be777f81137bab98025d1c37c08ef0ec2f204.tar.bz2 |
Include the Target& in the TargetMachineRegisterEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75772 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetMachineRegistry.h | 10 | ||||
-rw-r--r-- | lib/Target/TargetMachineRegistry.cpp | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/include/llvm/Target/TargetMachineRegistry.h b/include/llvm/Target/TargetMachineRegistry.h index 26b20e6..80ff188 100644 --- a/include/llvm/Target/TargetMachineRegistry.h +++ b/include/llvm/Target/TargetMachineRegistry.h @@ -23,9 +23,11 @@ namespace llvm { class Module; + class Target; class TargetMachine; struct TargetMachineRegistryEntry { + const Target &TheTarget; const char *Name; const char *ShortDesc; TargetMachine *(*CtorFn)(const Module &, const std::string &); @@ -33,12 +35,12 @@ namespace llvm { unsigned (*JITMatchQualityFn)(); public: - TargetMachineRegistryEntry(const char *N, const char *SD, + TargetMachineRegistryEntry(const Target &T, const char *N, const char *SD, TargetMachine *(*CF)(const Module &, const std::string &), unsigned (*MMF)(const Module &M), unsigned (*JMF)()) - : Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF), - JITMatchQualityFn(JMF) {} + : TheTarget(T), Name(N), ShortDesc(SD), CtorFn(CF), + ModuleMatchQualityFn(MMF), JITMatchQualityFn(JMF) {} }; template<> @@ -78,7 +80,7 @@ namespace llvm { template<class TargetMachineImpl> struct RegisterTarget { RegisterTarget(Target &T, const char *Name, const char *ShortDesc) - : Entry(Name, ShortDesc, &Allocator, + : Entry(T, Name, ShortDesc, &Allocator, &TargetMachineImpl::getModuleMatchQuality, &TargetMachineImpl::getJITMatchQuality), Node(Entry) { diff --git a/lib/Target/TargetMachineRegistry.cpp b/lib/Target/TargetMachineRegistry.cpp index 4d46526..e9887be 100644 --- a/lib/Target/TargetMachineRegistry.cpp +++ b/lib/Target/TargetMachineRegistry.cpp @@ -28,7 +28,7 @@ TargetMachineRegistry::getClosestStaticTargetForModule(const Module &M, if (!T) return 0; // FIXME: Temporary hack, please remove. - return new TargetMachineRegistry::entry(T->Name, T->ShortDesc, + return new TargetMachineRegistry::entry(*T, T->Name, T->ShortDesc, T->TargetMachineCtorFn, T->ModuleMatchQualityFn, T->JITMatchQualityFn); @@ -43,7 +43,7 @@ TargetMachineRegistry::getClosestTargetForJIT(std::string &Error) { if (!T) return 0; // FIXME: Temporary hack, please remove. - return new TargetMachineRegistry::entry(T->Name, T->ShortDesc, + return new TargetMachineRegistry::entry(*T, T->Name, T->ShortDesc, T->TargetMachineCtorFn, T->ModuleMatchQualityFn, T->JITMatchQualityFn); |