diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-02 23:37:13 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-02 23:37:13 +0000 |
commit | e28039cfd1a9c43b5fa9274bf19372d96f58f460 (patch) | |
tree | 041034918223f633336eac712c8807536d06f4f4 /lib | |
parent | c20a6fd8ce2fb96dd7572c11dcfb7654ac455c43 (diff) |
Move most targets TargetMachine constructor to only taking a target triple.
- The C, C++, MSIL, and Mips backends still need the module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
29 files changed, 83 insertions, 126 deletions
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 0546e57513..918ca7806b 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -14,7 +14,6 @@ #include "ARMTargetAsmInfo.h" #include "ARMFrameInfo.h" #include "ARM.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/CommandLine.h" @@ -37,29 +36,29 @@ extern "C" void LLVMInitializeARMTarget() { /// TargetMachine ctor - Create an ARM architecture model. /// ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, - const Module &M, + const std::string &TT, const std::string &FS, bool isThumb) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS, isThumb), + Subtarget(TT, FS, isThumb), FrameInfo(Subtarget), JITInfo(), InstrItins(Subtarget.getInstrItineraryData()) { DefRelocModel = getRelocationModel(); } -ARMTargetMachine::ARMTargetMachine(const Target &T, const Module &M, +ARMTargetMachine::ARMTargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : ARMBaseTargetMachine(T, M, FS, false), InstrInfo(Subtarget), + : ARMBaseTargetMachine(T, TT, FS, false), InstrInfo(Subtarget), DataLayout(Subtarget.isAPCS_ABI() ? std::string("e-p:32:32-f64:32:32-i64:32:32") : std::string("e-p:32:32-f64:64:64-i64:64:64")), TLInfo(*this) { } -ThumbTargetMachine::ThumbTargetMachine(const Target &T, const Module &M, +ThumbTargetMachine::ThumbTargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : ARMBaseTargetMachine(T, M, FS, true), + : ARMBaseTargetMachine(T, TT, FS, true), DataLayout(Subtarget.isAPCS_ABI() ? std::string("e-p:32:32-f64:32:32-i64:32:32-" "i16:16:32-i8:8:32-i1:8:32-a:0:32") : diff --git a/lib/Target/ARM/ARMTargetMachine.h b/lib/Target/ARM/ARMTargetMachine.h index c85af3b58e..d992f08f2f 100644 --- a/lib/Target/ARM/ARMTargetMachine.h +++ b/lib/Target/ARM/ARMTargetMachine.h @@ -26,8 +26,6 @@ namespace llvm { -class Module; - class ARMBaseTargetMachine : public LLVMTargetMachine { protected: ARMSubtarget Subtarget; @@ -39,8 +37,8 @@ private: Reloc::Model DefRelocModel; // Reloc model before it's overridden. public: - ARMBaseTargetMachine(const Target &T, const Module &M, const std::string &FS, - bool isThumb); + ARMBaseTargetMachine(const Target &T, const std::string &TT, + const std::string &FS, bool isThumb); virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual ARMJITInfo *getJITInfo() { return &JITInfo; } @@ -79,7 +77,8 @@ class ARMTargetMachine : public ARMBaseTargetMachine { const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; public: - ARMTargetMachine(const Target &T, const Module &M, const std::string &FS); + ARMTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const ARMRegisterInfo *getRegisterInfo() const { return &InstrInfo.getRegisterInfo(); @@ -91,9 +90,6 @@ public: virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetData *getTargetData() const { return &DataLayout; } - - static unsigned getJITMatchQuality(); - static unsigned getModuleMatchQuality(const Module &M); }; /// ThumbTargetMachine - Thumb target machine. @@ -105,7 +101,8 @@ class ThumbTargetMachine : public ARMBaseTargetMachine { const TargetData DataLayout; // Calculates type size & alignment ARMTargetLowering TLInfo; public: - ThumbTargetMachine(const Target &T, const Module &M, const std::string &FS); + ThumbTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); /// returns either Thumb1RegisterInfo of Thumb2RegisterInfo virtual const ARMBaseRegisterInfo *getRegisterInfo() const { @@ -119,9 +116,6 @@ public: /// returns either Thumb1InstrInfo or Thumb2InstrInfo virtual const ARMBaseInstrInfo *getInstrInfo() const { return InstrInfo; } virtual const TargetData *getTargetData() const { return &DataLayout; } - - static unsigned getJITMatchQuality(); - static unsigned getModuleMatchQuality(const Module &M); }; } // end namespace llvm diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index b72f96fb62..5c61b6d7c5 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -14,7 +14,6 @@ #include "AlphaJITInfo.h" #include "AlphaTargetAsmInfo.h" #include "AlphaTargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetRegistry.h" @@ -30,13 +29,13 @@ const TargetAsmInfo *AlphaTargetMachine::createTargetAsmInfo() const { return new AlphaTargetAsmInfo(); } -AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M, +AlphaTargetMachine::AlphaTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), DataLayout("e-f128:128:128"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), TLInfo(*this) { setRelocationModel(Reloc::PIC_); } diff --git a/lib/Target/Alpha/AlphaTargetMachine.h b/lib/Target/Alpha/AlphaTargetMachine.h index 649e427902..fc6439345a 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.h +++ b/lib/Target/Alpha/AlphaTargetMachine.h @@ -38,7 +38,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - AlphaTargetMachine(const Target &T, const Module &M, const std::string &FS); + AlphaTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } diff --git a/lib/Target/Blackfin/BlackfinTargetMachine.cpp b/lib/Target/Blackfin/BlackfinTargetMachine.cpp index b69adf609e..943ce17d4f 100644 --- a/lib/Target/Blackfin/BlackfinTargetMachine.cpp +++ b/lib/Target/Blackfin/BlackfinTargetMachine.cpp @@ -13,7 +13,6 @@ #include "BlackfinTargetMachine.h" #include "Blackfin.h" #include "BlackfinTargetAsmInfo.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetRegistry.h" @@ -28,25 +27,16 @@ const TargetAsmInfo* BlackfinTargetMachine::createTargetAsmInfo() const { } BlackfinTargetMachine::BlackfinTargetMachine(const Target &T, - const Module &M, + const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), DataLayout("e-p:32:32-i64:32-f64:32"), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 4, 0) { } -unsigned BlackfinTargetMachine::getModuleMatchQuality(const Module &M) { - std::string TT = M.getTargetTriple(); - if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "bfin-") - return 20; - - // Otherwise we don't match. - return 0; -} - bool BlackfinTargetMachine::addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel) { PM.add(createBlackfinISelDag(*this, OptLevel)); diff --git a/lib/Target/Blackfin/BlackfinTargetMachine.h b/lib/Target/Blackfin/BlackfinTargetMachine.h index 0538c9a1a5..13a8a631f3 100644 --- a/lib/Target/Blackfin/BlackfinTargetMachine.h +++ b/lib/Target/Blackfin/BlackfinTargetMachine.h @@ -23,8 +23,6 @@ namespace llvm { - class Module; - class BlackfinTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; BlackfinSubtarget Subtarget; @@ -36,7 +34,7 @@ namespace llvm { virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - BlackfinTargetMachine(const Target &T, const Module &M, + BlackfinTargetMachine(const Target &T, const std::string &TT, const std::string &FS); virtual const BlackfinInstrInfo *getInstrInfo() const { return &InstrInfo; } @@ -51,7 +49,6 @@ namespace llvm { return const_cast<BlackfinTargetLowering*>(&TLInfo); } virtual const TargetData *getTargetData() const { return &DataLayout; } - static unsigned getModuleMatchQuality(const Module &M); virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); }; diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 6e71d3bd60..84f7c11e5d 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. - RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget); + RegisterTargetMachineDeprecated<CTargetMachine> X(TheCBackendTarget); } namespace { diff --git a/lib/Target/CBackend/CTargetMachine.h b/lib/Target/CBackend/CTargetMachine.h index a3052ab825..72146a80cb 100644 --- a/lib/Target/CBackend/CTargetMachine.h +++ b/lib/Target/CBackend/CTargetMachine.h @@ -22,7 +22,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) + CTargetMachine(const Target &T, const Module &M, + const std::string &FS) : TargetMachine(T), DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index 16b923b8ce..4b803a0fdc 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -15,7 +15,6 @@ #include "SPURegisterNames.h" #include "SPUTargetAsmInfo.h" #include "SPUTargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/SchedulerRegistry.h" @@ -38,10 +37,10 @@ const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const { return new SPULinuxTargetAsmInfo(); } -SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M, +SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this), diff --git a/lib/Target/CellSPU/SPUTargetMachine.h b/lib/Target/CellSPU/SPUTargetMachine.h index f1c3817397..a0e7130749 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.h +++ b/lib/Target/CellSPU/SPUTargetMachine.h @@ -40,7 +40,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - SPUTargetMachine(const Target &T, const Module &M, const std::string &FS); + SPUTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); /// Return the subtarget implementation object virtual const SPUSubtarget *getSubtargetImpl() const { diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index b552e04c4f..69d9ee9890 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -74,7 +74,7 @@ static cl::opt<std::string> NameToGenerate("cppfor", cl::Optional, extern "C" void LLVMInitializeCppBackendTarget() { // Register the target. - RegisterTargetMachine<CPPTargetMachine> X(TheCppBackendTarget); + RegisterTargetMachineDeprecated<CPPTargetMachine> X(TheCppBackendTarget); } namespace { diff --git a/lib/Target/CppBackend/CPPTargetMachine.h b/lib/Target/CppBackend/CPPTargetMachine.h index 0cf1fd4036..c7c8a7e04a 100644 --- a/lib/Target/CppBackend/CPPTargetMachine.h +++ b/lib/Target/CppBackend/CPPTargetMachine.h @@ -24,7 +24,8 @@ class formatted_raw_ostream; struct CPPTargetMachine : public TargetMachine { const TargetData DataLayout; // Calculates type size & alignment - CPPTargetMachine(const Target &T, const Module &M, const std::string &FS) + CPPTargetMachine(const Target &T, const Module &M, + const std::string &FS) : TargetMachine(T), DataLayout(&M) {} virtual bool WantsWholeFile() const { return true; } diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp index 6e0f3b6d42..fa47a8f113 100644 --- a/lib/Target/MSIL/MSILWriter.cpp +++ b/lib/Target/MSIL/MSILWriter.cpp @@ -42,16 +42,13 @@ namespace llvm { CodeGenFileType FileType, CodeGenOpt::Level OptLevel); - // This class always works, but shouldn't be the default in most cases. - static unsigned getModuleMatchQuality(const Module &M) { return 1; } - virtual const TargetData *getTargetData() const { return &DataLayout; } }; } extern "C" void LLVMInitializeMSILTarget() { // Register the target. - RegisterTargetMachine<MSILTarget> X(TheMSILTarget); + RegisterTargetMachineDeprecated<MSILTarget> X(TheMSILTarget); } bool MSILModule::runOnModule(Module &M) { diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index e5642db01f..2d6af85bbc 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -14,17 +14,16 @@ #include "MSP430.h" #include "MSP430TargetAsmInfo.h" #include "MSP430TargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetAsmInfo.h" using namespace llvm; MSP430TargetMachine::MSP430TargetMachine(const Target &T, - const Module &M, + const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), // FIXME: Check TargetData string. DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), InstrInfo(*this), TLInfo(*this), diff --git a/lib/Target/MSP430/MSP430TargetMachine.h b/lib/Target/MSP430/MSP430TargetMachine.h index d8b6c76b4c..44cdd54239 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.h +++ b/lib/Target/MSP430/MSP430TargetMachine.h @@ -41,7 +41,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - MSP430TargetMachine(const Target &T, const Module &M, const std::string &FS); + MSP430TargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual const MSP430InstrInfo *getInstrInfo() const { return &InstrInfo; } diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index db18b097c4..657d21d7c0 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -14,15 +14,14 @@ #include "Mips.h" #include "MipsTargetAsmInfo.h" #include "MipsTargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetRegistry.h" using namespace llvm; extern "C" void LLVMInitializeMipsTarget() { // Register the target. - RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget); - RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget); + RegisterTargetMachineDeprecated<MipsTargetMachine> X(TheMipsTarget); + RegisterTargetMachineDeprecated<MipselTargetMachine> Y(TheMipselTarget); } const TargetAsmInfo *MipsTargetMachine:: @@ -39,7 +38,7 @@ createTargetAsmInfo() const // an easier handling. // Using CodeModel::Large enables different CALL behavior. MipsTargetMachine:: -MipsTargetMachine(const Target &T, const Module &M, const std::string &FS, +MipsTargetMachine(const Target &T, const Module &M, const std::string &FS, bool isLittle=false): LLVMTargetMachine(T), Subtarget(*this, M.getTargetTriple(), FS, isLittle), diff --git a/lib/Target/Mips/MipsTargetMachine.h b/lib/Target/Mips/MipsTargetMachine.h index cdee9cc194..e2b83b721f 100644 --- a/lib/Target/Mips/MipsTargetMachine.h +++ b/lib/Target/Mips/MipsTargetMachine.h @@ -35,8 +35,8 @@ namespace llvm { virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - MipsTargetMachine(const Target &T, const Module &M, const std::string &FS, - bool isLittle); + MipsTargetMachine(const Target &T, const Module &M, + const std::string &FS, bool isLittle); virtual const MipsInstrInfo *getInstrInfo() const { return &InstrInfo; } @@ -67,8 +67,6 @@ namespace llvm { class MipselTargetMachine : public MipsTargetMachine { public: MipselTargetMachine(const Target &T, const Module &M, const std::string &FS); - - static unsigned getModuleMatchQuality(const Module &M); }; } // End llvm namespace diff --git a/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp index 9a3b1858b8..52846cf68c 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.cpp +++ b/lib/Target/PIC16/PIC16TargetMachine.cpp @@ -14,7 +14,6 @@ #include "PIC16.h" #include "PIC16TargetAsmInfo.h" #include "PIC16TargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetAsmInfo.h" @@ -22,19 +21,19 @@ using namespace llvm; // PIC16TargetMachine - Traditional PIC16 Machine. -PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, +PIC16TargetMachine::PIC16TargetMachine(const Target &T, const std::string &TT, const std::string &FS, bool Cooper) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS, Cooper), + Subtarget(TT, FS, Cooper), DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), InstrInfo(*this), TLInfo(*this), FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { } // CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper // as true. -CooperTargetMachine::CooperTargetMachine(const Target &T, const Module &M, +CooperTargetMachine::CooperTargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : PIC16TargetMachine(T, M, FS, true) {} + : PIC16TargetMachine(T, TT, FS, true) {} const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const { diff --git a/lib/Target/PIC16/PIC16TargetMachine.h b/lib/Target/PIC16/PIC16TargetMachine.h index 3664d4316e..c147f810e5 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.h +++ b/lib/Target/PIC16/PIC16TargetMachine.h @@ -41,8 +41,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - PIC16TargetMachine(const Target &T, const Module &M, const std::string &FS, - bool Cooper = false); + PIC16TargetMachine(const Target &T, const std::string &TT, + const std::string &FS, bool Cooper = false); virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual const PIC16InstrInfo *getInstrInfo() const { return &InstrInfo; } @@ -65,7 +65,8 @@ public: /// CooperTargetMachine class CooperTargetMachine : public PIC16TargetMachine { public: - CooperTargetMachine(const Target &T, const Module &M, const std::string &FS); + CooperTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); }; // CooperTargetMachine. } // end namespace llvm diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index da6ebc49a9..251be7679b 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -14,7 +14,6 @@ #include "PPC.h" #include "PPCTargetAsmInfo.h" #include "PPCTargetMachine.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" @@ -34,10 +33,10 @@ const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const { return new PPCLinuxTargetAsmInfo(*this); } -PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M, +PPCTargetMachine::PPCTargetMachine(const Target&T, const std::string &TT, const std::string &FS, bool is64Bit) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS, is64Bit), + Subtarget(TT, FS, is64Bit), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) { @@ -54,15 +53,15 @@ PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M, /// groups, which typically degrades performance. bool PPCTargetMachine::getEnableTailMergeDefault() const { return false; } -PPC32TargetMachine::PPC32TargetMachine(const Target &T, const Module &M, +PPC32TargetMachine::PPC32TargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : PPCTargetMachine(T, M, FS, false) { + : PPCTargetMachine(T, TT, FS, false) { } -PPC64TargetMachine::PPC64TargetMachine(const Target &T, const Module &M, +PPC64TargetMachine::PPC64TargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : PPCTargetMachine(T, M, FS, true) { + : PPCTargetMachine(T, TT, FS, true) { } diff --git a/lib/Target/PowerPC/PPCTargetMachine.h b/lib/Target/PowerPC/PPCTargetMachine.h index 0000fa8504..b7ac6ef8bc 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.h +++ b/lib/Target/PowerPC/PPCTargetMachine.h @@ -43,8 +43,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - PPCTargetMachine(const Target &T, const Module &M, const std::string &FS, - bool is64Bit); + PPCTargetMachine(const Target &T, const std::string &TT, + const std::string &FS, bool is64Bit); virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const PPCFrameInfo *getFrameInfo() const { return &FrameInfo; } @@ -90,14 +90,16 @@ public: /// class PPC32TargetMachine : public PPCTargetMachine { public: - PPC32TargetMachine(const Target &T, const Module &M, const std::string &FS); + PPC32TargetMachine(const Target &T, const std::string &TT, + const std::string &FS); }; /// PPC64TargetMachine - PowerPC 64-bit target machine. /// class PPC64TargetMachine : public PPCTargetMachine { public: - PPC64TargetMachine(const Target &T, const Module &M, const std::string &FS); + PPC64TargetMachine(const Target &T, const std::string &TT, + const std::string &FS); }; } // end namespace llvm diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 48924d618b..f7c172216a 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -13,7 +13,6 @@ #include "SparcTargetAsmInfo.h" #include "SparcTargetMachine.h" #include "Sparc.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetRegistry.h" using namespace llvm; @@ -30,11 +29,11 @@ const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const { /// SparcTargetMachine ctor - Create an ILP32 architecture model /// -SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M, +SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), DataLayout("E-p:32:32-f128:128:128"), - Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget), + Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { } diff --git a/lib/Target/Sparc/SparcTargetMachine.h b/lib/Target/Sparc/SparcTargetMachine.h index c01d09ddee..8cdfba3a50 100644 --- a/lib/Target/Sparc/SparcTargetMachine.h +++ b/lib/Target/Sparc/SparcTargetMachine.h @@ -23,8 +23,6 @@ namespace llvm { -class Module; - class SparcTargetMachine : public LLVMTargetMachine { const TargetData DataLayout; // Calculates type size & alignment SparcSubtarget Subtarget; @@ -36,7 +34,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - SparcTargetMachine(const Target &T, const Module &M, const std::string &FS); + SparcTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } diff --git a/lib/Target/SystemZ/SystemZTargetMachine.cpp b/lib/Target/SystemZ/SystemZTargetMachine.cpp index 6a9c10c7b0..51b31a9609 100644 --- a/lib/Target/SystemZ/SystemZTargetMachine.cpp +++ b/lib/Target/SystemZ/SystemZTargetMachine.cpp @@ -13,7 +13,6 @@ #include "SystemZTargetAsmInfo.h" #include "SystemZTargetMachine.h" #include "SystemZ.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Target/TargetRegistry.h" using namespace llvm; @@ -30,10 +29,10 @@ const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const { /// SystemZTargetMachine ctor - Create an ILP64 architecture model /// SystemZTargetMachine::SystemZTargetMachine(const Target &T, - const Module &M, + const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32" "-f64:64:64-f128:128:128-a0:16:16"), InstrInfo(*this), TLInfo(*this), @@ -49,14 +48,3 @@ bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM, PM.add(createSystemZISelDag(*this, OptLevel)); return false; } - -unsigned SystemZTargetMachine::getModuleMatchQuality(const Module &M) { - std::string TT = M.getTargetTriple(); - - // We strongly match s390x - if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' && - TT[3] == '0' && TT[4] == 'x') - return 20; - - return 0; -} diff --git a/lib/Target/SystemZ/SystemZTargetMachine.h b/lib/Target/SystemZ/SystemZTargetMachine.h index 843399c2e4..6626fd0e50 100644 --- a/lib/Target/SystemZ/SystemZTargetMachine.h +++ b/lib/Target/SystemZ/SystemZTargetMachine.h @@ -41,7 +41,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - SystemZTargetMachine(const Target &T, const Module &M, const std::string &FS); + SystemZTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } virtual const SystemZInstrInfo *getInstrInfo() const { return &InstrInfo; } @@ -57,7 +58,6 @@ public: } virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); - static unsigned getModuleMatchQuality(const Module &M); }; // SystemZTargetMachine. } // end namespace llvm diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 56c0e92476..43340f5124 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -14,7 +14,6 @@ #include "X86TargetAsmInfo.h" #include "X86TargetMachine.h" #include "X86.h" -#include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/Passes.h" @@ -46,23 +45,23 @@ const TargetAsmInfo *X86TargetMachine::createTargetAsmInfo() const { } } -X86_32TargetMachine::X86_32TargetMachine(const Target &T, const Module &M, +X86_32TargetMachine::X86_32TargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : X86TargetMachine(T, M, FS, false) { + : X86TargetMachine(T, TT, FS, false) { } -X86_64TargetMachine::X86_64TargetMachine(const Target &T, const Module &M, +X86_64TargetMachine::X86_64TargetMachine(const Target &T, const std::string &TT, const std::string &FS) - : X86TargetMachine(T, M, FS, true) { + : X86TargetMachine(T, TT, FS, true) { } /// X86TargetMachine ctor - Create an X86 target. /// -X86TargetMachine::X86TargetMachine(const Target &T, const Module &M, +X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT, const std::string &FS, bool is64Bit) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS, is64Bit), + Subtarget(TT, FS, is64Bit), DataLayout(Subtarget.getDataLayout()), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4), diff --git a/lib/Target/X86/X86TargetMachine.h b/lib/Target/X86/X86TargetMachine.h index 8a7f29fb12..d6187c773c 100644 --- a/lib/Target/X86/X86TargetMachine.h +++ b/lib/Target/X86/X86TargetMachine.h @@ -42,8 +42,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - X86TargetMachine(const Target &T, const Module &M, const std::string &FS, - bool is64Bit); + X86TargetMachine(const Target &T, const std::string &TT, + const std::string &FS, bool is64Bit); virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } @@ -85,20 +85,16 @@ public: /// class X86_32TargetMachine : public X86TargetMachine { public: - X86_32TargetMachine(const Target &T, const Module &M, const std::string &FS); - - static unsigned getJITMatchQuality(); - static unsigned getModuleMatchQuality(const Module &M); + X86_32TargetMachine(const Target &T, const std::string &M, + const std::string &FS); }; /// X86_64TargetMachine - X86 64-bit target machine. /// class X86_64TargetMachine : public X86TargetMachine { public: - X86_64TargetMachine(const Target &T, const Module &M, const std::string &FS); - - static unsigned getJITMatchQuality(); - static unsigned getModuleMatchQuality(const Module &M); + X86_64TargetMachine(const Target &T, const std::string &TT, + const std::string &FS); }; } // End llvm namespace diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp index 570e3fd52d..8847809408 100644 --- a/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/lib/Target/XCore/XCoreTargetMachine.cpp @@ -23,10 +23,10 @@ const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const { /// XCoreTargetMachine ctor - Create an ILP32 architecture model /// -XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Module &M, +XCoreTargetMachine::XCoreTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(M.getTargetTriple(), FS), + Subtarget(TT, FS), DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-" "i16:16:32-i32:32:32-i64:32:32"), InstrInfo(), diff --git a/lib/Target/XCore/XCoreTargetMachine.h b/lib/Target/XCore/XCoreTargetMachine.h index dc06f51a6f..136cea29e7 100644 --- a/lib/Target/XCore/XCoreTargetMachine.h +++ b/lib/Target/XCore/XCoreTargetMachine.h @@ -23,8 +23,6 @@ namespace llvm { -class Module; - class XCoreTargetMachine : public LLVMTargetMachine { XCoreSubtarget Subtarget; const TargetData DataLayout; // Calculates type size & alignment @@ -36,7 +34,8 @@ protected: virtual const TargetAsmInfo *createTargetAsmInfo() const; public: - XCoreTargetMachine(const Target &T, const Module &M, const std::string &FS); + XCoreTargetMachine(const Target &T, const std::string &TT, + const std::string &FS); virtual const XCoreInstrInfo *getInstrInfo() const { return &InstrInfo; } virtual const XCoreFrameInfo *getFrameInfo() const { return &FrameInfo; } |