Remove now unused Module argument to createTargetMachine.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 4 Aug 2009 04:02:45 +0000 (04:02 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 4 Aug 2009 04:02:45 +0000 (04:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78043 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 496df845cb341b1fe3cb929af687f198a895e46d..4a1c55dcfbecf91ba39d391346cff79eb1b625e3 100644 (file)
@@ -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 @@ namespace llvm {
     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 @@ namespace llvm {
     /// 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 @@ namespace llvm {
   };
 
   /// TargetRegistry - Generic interface to target specific features.
-  //
-  // FIXME: Provide Target* iterator.
   struct TargetRegistry {
     class iterator {
       const Target *Current;
@@ -327,27 +325,12 @@ namespace llvm {
     }
 
   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:
index 7a43233cfc26cb403648d77c5ab6937ad2aa6c90..2892826a85d3efd6e9d3b2631b77dafc706a1d8c 100644 (file)
@@ -51,7 +51,7 @@ using namespace llvm;
 
 extern "C" void LLVMInitializeCBackendTarget() { 
   // Register the target.
-  RegisterTargetMachineDeprecated<CTargetMachine> X(TheCBackendTarget);
+  RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget);
 }
 
 namespace {
index ffd033f1980e35b5d9b2869d5bbd994503285f0e..715bbdaf0c87c8ac84d5a327ad077f03592a95e3 100644 (file)
 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,
index 69d9ee98904fd79d63e029394165155c78dde11c..b552e04c4f4aca54895933901241e3b698efa6b1 100644 (file)
@@ -74,7 +74,7 @@ static cl::opt<std::string> NameToGenerate("cppfor", cl::Optional,
 
 extern "C" void LLVMInitializeCppBackendTarget() {
   // Register the target.
-  RegisterTargetMachineDeprecated<CPPTargetMachine> X(TheCppBackendTarget);
+  RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget);
 }
 
 namespace {
index c838b389b975ab7a82e2f2a6c314c30ea2dc2c23..1f74f76b5ac14b66937c82a97350bb0b84a1efd8 100644 (file)
@@ -22,11 +22,9 @@ namespace llvm {
 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,
index 873f9b7125bbc8e920d6fb0bdbc783abb7df1d88..226d146a0e38de13953ab6d178d0a7a438f65a28 100644 (file)
@@ -31,10 +31,8 @@ using namespace llvm;
 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 @@ namespace llvm {
 
 extern "C" void LLVMInitializeMSILTarget() {
   // Register the target.
-  RegisterTargetMachineDeprecated<MSILTarget> X(TheMSILTarget);
+  RegisterTargetMachine<MSILTarget> X(TheMSILTarget);
 }
 
 bool MSILModule::runOnModule(Module &M) {