[llvm-commits] [llvm] r75767 - in /llvm/trunk: lib/Target/CBackend/CBackend.cpp tools/lto/LTOCodeGenerator.cpp tools/lto/LTOModule.cpp

Daniel Dunbar daniel at zuster.org
Wed Jul 15 03:06:15 PDT 2009


Author: ddunbar
Date: Wed Jul 15 05:05:03 2009
New Revision: 75767

URL: http://llvm.org/viewvc/llvm-project?rev=75767&view=rev
Log:
Switch some obvious clients to using the new TargetRegistry.

Modified:
    llvm/trunk/lib/Target/CBackend/CBackend.cpp
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp
    llvm/trunk/tools/lto/LTOModule.cpp

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=75767&r1=75766&r2=75767&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Wed Jul 15 05:05:03 2009
@@ -30,9 +30,10 @@
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/IntrinsicLowering.h"
 #include "llvm/Transforms/Scalar.h"
-#include "llvm/Target/TargetMachineRegistry.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachineRegistry.h"
+#include "llvm/Target/TargetRegistry.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -3187,27 +3188,27 @@
 
   const char *const *table = 0;
   
-  //Grab the translation table from TargetAsmInfo if it exists
+  // Grab the translation table from TargetAsmInfo if it exists.
   if (!TAsm) {
     std::string E;
-    const TargetMachineRegistry::entry* Match = 
-      TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, E);
+    const Target *Match =
+      TargetRegistry::getClosestStaticTargetForModule(*TheModule, E);
     if (Match) {
-      //Per platform Target Machines don't exist, so create it
-      // this must be done only once
-      const TargetMachine* TM = Match->CtorFn(*TheModule, "");
+      // Per platform Target Machines don't exist, so create it;
+      // this must be done only once.
+      const TargetMachine* TM = Match->createTargetMachine(*TheModule, "");
       TAsm = TM->getTargetAsmInfo();
     }
   }
   if (TAsm)
     table = TAsm->getAsmCBE();
 
-  //Search the translation table if it exists
+  // Search the translation table if it exists.
   for (int i = 0; table && table[i]; i += 2)
     if (c.Codes[0] == table[i])
       return table[i+1];
 
-  //default is identity
+  // Default is identity.
   return c.Codes[0];
 }
 

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=75767&r1=75766&r2=75767&view=diff

==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Wed Jul 15 05:05:03 2009
@@ -328,9 +328,9 @@
     if ( _target == NULL ) {
         // create target machine from info for merged modules
         Module* mergedModule = _linker.getModule();
-        const TargetMachineRegistry::entry* march = 
-          TargetMachineRegistry::getClosestStaticTargetForModule(
-                                                       *mergedModule, errMsg);
+        const Target *march = 
+          TargetRegistry::getClosestStaticTargetForModule(*mergedModule, 
+                                                          errMsg);
         if ( march == NULL )
             return true;
 
@@ -351,7 +351,7 @@
         // construct LTModule, hand over ownership of module and target
         std::string FeatureStr =
           getFeatureString(_linker.getModule()->getTargetTriple().c_str());
-        _target = march->CtorFn(*mergedModule, FeatureStr.c_str());
+        _target = march->createTargetMachine(*mergedModule, FeatureStr.c_str());
     }
     return false;
 }

Modified: llvm/trunk/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=75767&r1=75766&r2=75767&view=diff

==============================================================================
--- llvm/trunk/tools/lto/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto/LTOModule.cpp Wed Jul 15 05:05:03 2009
@@ -147,15 +147,15 @@
     if ( !m )
         return NULL;
     // find machine architecture for this module
-    const TargetMachineRegistry::entry* march = 
-            TargetMachineRegistry::getClosestStaticTargetForModule(*m, errMsg);
+    const Target* march = 
+      TargetRegistry::getClosestStaticTargetForModule(*m, errMsg);
 
     if ( march == NULL ) 
         return NULL;
 
     // construct LTModule, hand over ownership of module and target
     std::string FeatureStr = getFeatureString(m->getTargetTriple().c_str());
-    TargetMachine* target = march->CtorFn(*m, FeatureStr);
+    TargetMachine* target = march->createTargetMachine(*m, FeatureStr);
     return new LTOModule(m.take(), target);
 }
 





More information about the llvm-commits mailing list