[llvm-commits] [llvm] r78043 - in /llvm/trunk: include/llvm/Target/TargetRegistry.h lib/Target/CBackend/CBackend.cpp lib/Target/CBackend/CTargetMachine.h lib/Target/CppBackend/CPPBackend.cpp lib/Target/CppBackend/CPPTargetMachine.h lib/Target/MSIL/MSILWriter.cpp

Daniel Dunbar daniel at zuster.org
Mon Aug 3 21:02:48 PDT 2009


Author: ddunbar
Date: Mon Aug  3 23:02:45 2009
New Revision: 78043

URL: http://llvm.org/viewvc/llvm-project?rev=78043&view=rev
Log:
Remove now unused Module argument to createTargetMachine.

Modified:
    llvm/trunk/include/llvm/Target/TargetRegistry.h
    llvm/trunk/lib/Target/CBackend/CBackend.cpp
    llvm/trunk/lib/Target/CBackend/CTargetMachine.h
    llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
    llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h
    llvm/trunk/lib/Target/MSIL/MSILWriter.cpp

Modified: llvm/trunk/include/llvm/Target/TargetRegistry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegistry.h?rev=78043&r1=78042&r2=78043&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetRegistry.h (original)
+++ llvm/trunk/include/llvm/Target/TargetRegistry.h Mon Aug  3 23:02:45 2009
@@ -23,9 +23,6 @@
 // FIXME: We shouldn't need this header, but we need it until there is a
 // different interface to get the TargetAsmInfo.
 #include "llvm/Target/TargetMachine.h"
-// FIXME: We shouldn't need this header, but we need it until there is a
-// different interface to the target machines.
-#include "llvm/Module.h"
 #include <string>
 #include <cassert>
 
@@ -50,7 +47,6 @@
     typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
 
     typedef TargetMachine *(*TargetMachineCtorTy)(const Target &,
-                                                  const Module &, 
                                                   const std::string &,
                                                   const std::string &);
     typedef FunctionPass *(*AsmPrinterCtorTy)(formatted_raw_ostream &,
@@ -120,12 +116,16 @@
     /// feature set; it should always be provided. Generally this should be
     /// either the target triple from the module, or the target triple of the
     /// host if that does not exist.
-    TargetMachine *createTargetMachine(const Module &M,
-                                       const std::string &Triple,
+    TargetMachine *createTargetMachine(const std::string &Triple,
                                        const std::string &Features) const {
       if (!TargetMachineCtorFn)
         return 0;
-      return TargetMachineCtorFn(*this, M, Triple, Features);
+      return TargetMachineCtorFn(*this, Triple, Features);
+    }
+    TargetMachine *createTargetMachine(const Module &M,
+                                       const std::string &Triple,
+                                       const std::string &Features) const {
+      return createTargetMachine(Triple, Features);
     }
 
     /// createAsmPrinter - Create a target specific assembly printer pass.
@@ -149,8 +149,6 @@
   };
 
   /// TargetRegistry - Generic interface to target specific features.
-  //
-  // FIXME: Provide Target* iterator.
   struct TargetRegistry {
     class iterator {
       const Target *Current;
@@ -327,27 +325,12 @@
     }
 
   private:
-    static TargetMachine *Allocator(const Target &T, const Module &M,
-                                    const std::string &TT,
+    static TargetMachine *Allocator(const Target &T, const std::string &TT,
                                     const std::string &FS) {
       return new TargetMachineImpl(T, TT, FS);
     }
   };
 
-  template<class TargetMachineImpl>
-  struct RegisterTargetMachineDeprecated {
-    RegisterTargetMachineDeprecated(Target &T) {
-      TargetRegistry::RegisterTargetMachine(T, &Allocator);
-    }
-
-  private:
-    static TargetMachine *Allocator(const Target &T, const Module &M,
-                                    const std::string &TT,
-                                    const std::string &FS) {
-      return new TargetMachineImpl(T, M, FS);
-    }
-  };
-
   /// RegisterAsmPrinter - Helper template for registering a target specific
   /// assembly printer, for use in the target machine initialization
   /// function. Usage:

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

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Aug  3 23:02:45 2009
@@ -51,7 +51,7 @@
 
 extern "C" void LLVMInitializeCBackendTarget() { 
   // Register the target.
-  RegisterTargetMachineDeprecated<CTargetMachine> X(TheCBackendTarget);
+  RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget);
 }
 
 namespace {

Modified: llvm/trunk/lib/Target/CBackend/CTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CTargetMachine.h?rev=78043&r1=78042&r2=78043&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CTargetMachine.h (original)
+++ llvm/trunk/lib/Target/CBackend/CTargetMachine.h Mon Aug  3 23:02:45 2009
@@ -20,11 +20,8 @@
 namespace llvm {
 
 struct CTargetMachine : public TargetMachine {
-  const TargetData DataLayout;       // Calculates type size & alignment
-
-  CTargetMachine(const Target &T, const Module &M,
-                 const std::string &FS)
-    : TargetMachine(T), DataLayout(&M) {}
+  CTargetMachine(const Target &T, const std::string &TT, const std::string &FS)
+    : TargetMachine(T) {}
 
   virtual bool WantsWholeFile() const { return true; }
   virtual bool addPassesToEmitWholeFile(PassManager &PM,

Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=78043&r1=78042&r2=78043&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Mon Aug  3 23:02:45 2009
@@ -74,7 +74,7 @@
 
 extern "C" void LLVMInitializeCppBackendTarget() {
   // Register the target.
-  RegisterTargetMachineDeprecated<CPPTargetMachine> X(TheCppBackendTarget);
+  RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget);
 }
 
 namespace {

Modified: llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h?rev=78043&r1=78042&r2=78043&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPTargetMachine.h Mon Aug  3 23:02:45 2009
@@ -22,11 +22,9 @@
 class formatted_raw_ostream;
 
 struct CPPTargetMachine : public TargetMachine {
-  const TargetData DataLayout;       // Calculates type size & alignment
-
-  CPPTargetMachine(const Target &T, const Module &M,
+  CPPTargetMachine(const Target &T, const std::string &TT,
                    const std::string &FS)
-    : TargetMachine(T), DataLayout(&M) {}
+    : TargetMachine(T) {}
 
   virtual bool WantsWholeFile() const { return true; }
   virtual bool addPassesToEmitWholeFile(PassManager &PM,

Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=78043&r1=78042&r2=78043&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original)
+++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Mon Aug  3 23:02:45 2009
@@ -31,10 +31,8 @@
 namespace llvm {
   // TargetMachine for the MSIL 
   struct VISIBILITY_HIDDEN MSILTarget : public TargetMachine {
-    const TargetData DataLayout;       // Calculates type size & alignment
-
-    MSILTarget(const Target &T, const Module &M, const std::string &FS)
-      : TargetMachine(T), DataLayout(&M) {}
+    MSILTarget(const Target &T, const std::string &TT, const std::string &FS)
+      : TargetMachine(T) {}
 
     virtual bool WantsWholeFile() const { return true; }
     virtual bool addPassesToEmitWholeFile(PassManager &PM,
@@ -48,7 +46,7 @@
 
 extern "C" void LLVMInitializeMSILTarget() {
   // Register the target.
-  RegisterTargetMachineDeprecated<MSILTarget> X(TheMSILTarget);
+  RegisterTargetMachine<MSILTarget> X(TheMSILTarget);
 }
 
 bool MSILModule::runOnModule(Module &M) {





More information about the llvm-commits mailing list