From 214e22396fe86aa20c587d5c7df9ce63bfd4549e Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 4 Aug 2009 04:02:45 +0000 Subject: [PATCH] Remove now unused Module argument to createTargetMachine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78043 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetRegistry.h | 33 ++++++------------------ lib/Target/CBackend/CBackend.cpp | 2 +- lib/Target/CBackend/CTargetMachine.h | 7 ++--- lib/Target/CppBackend/CPPBackend.cpp | 2 +- lib/Target/CppBackend/CPPTargetMachine.h | 6 ++--- lib/Target/MSIL/MSILWriter.cpp | 8 +++--- 6 files changed, 17 insertions(+), 41 deletions(-) diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h index 496df845cb3..4a1c55dcfbe 100644 --- a/include/llvm/Target/TargetRegistry.h +++ b/include/llvm/Target/TargetRegistry.h @@ -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 #include @@ -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 - 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: diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 7a43233cfc2..2892826a85d 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -51,7 +51,7 @@ using namespace llvm; extern "C" void LLVMInitializeCBackendTarget() { // Register the target. - RegisterTargetMachineDeprecated X(TheCBackendTarget); + RegisterTargetMachine X(TheCBackendTarget); } namespace { diff --git a/lib/Target/CBackend/CTargetMachine.h b/lib/Target/CBackend/CTargetMachine.h index ffd033f1980..715bbdaf0c8 100644 --- a/lib/Target/CBackend/CTargetMachine.h +++ b/lib/Target/CBackend/CTargetMachine.h @@ -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, diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 69d9ee98904..b552e04c4f4 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -74,7 +74,7 @@ static cl::opt NameToGenerate("cppfor", cl::Optional, extern "C" void LLVMInitializeCppBackendTarget() { // Register the target. - RegisterTargetMachineDeprecated X(TheCppBackendTarget); + RegisterTargetMachine X(TheCppBackendTarget); } namespace { diff --git a/lib/Target/CppBackend/CPPTargetMachine.h b/lib/Target/CppBackend/CPPTargetMachine.h index c838b389b97..1f74f76b5ac 100644 --- a/lib/Target/CppBackend/CPPTargetMachine.h +++ b/lib/Target/CppBackend/CPPTargetMachine.h @@ -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, diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index 873f9b7125b..226d146a0e3 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -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 X(TheMSILTarget); + RegisterTargetMachine X(TheMSILTarget); } bool MSILModule::runOnModule(Module &M) { -- 2.34.1