summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Target/TargetMachineRegistry.h10
-rw-r--r--llvm/lib/Target/TargetMachineRegistry.cpp4
2 files changed, 8 insertions, 6 deletions
diff --git a/llvm/include/llvm/Target/TargetMachineRegistry.h b/llvm/include/llvm/Target/TargetMachineRegistry.h
index 26b20e65cca..80ff188fac5 100644
--- a/llvm/include/llvm/Target/TargetMachineRegistry.h
+++ b/llvm/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/llvm/lib/Target/TargetMachineRegistry.cpp b/llvm/lib/Target/TargetMachineRegistry.cpp
index 4d4652604f0..e9887be9237 100644
--- a/llvm/lib/Target/TargetMachineRegistry.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud