[llvm-commits] [llvm] r75772 - in /llvm/trunk: include/llvm/Target/TargetMachineRegistry.h lib/Target/TargetMachineRegistry.cpp

Daniel Dunbar daniel at zuster.org
Wed Jul 15 04:23:53 PDT 2009


Author: ddunbar
Date: Wed Jul 15 06:23:49 2009
New Revision: 75772

URL: http://llvm.org/viewvc/llvm-project?rev=75772&view=rev
Log:
Include the Target& in the TargetMachineRegisterEntry.

Modified:
    llvm/trunk/include/llvm/Target/TargetMachineRegistry.h
    llvm/trunk/lib/Target/TargetMachineRegistry.cpp

Modified: llvm/trunk/include/llvm/Target/TargetMachineRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachineRegistry.h?rev=75772&r1=75771&r2=75772&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachineRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachineRegistry.h Wed Jul 15 06:23:49 2009
@@ -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 @@
     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 @@
   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) {

Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineRegistry.cpp?rev=75772&r1=75771&r2=75772&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetMachineRegistry.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachineRegistry.cpp Wed Jul 15 06:23:49 2009
@@ -28,7 +28,7 @@
   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 @@
   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); 





More information about the llvm-commits mailing list