From b711cf09b31c5498b18293768ae4323ecee304ef Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 2 Aug 2009 22:11:08 +0000 Subject: Normalize Subtarget constructors to take a target triple string instead of Module*. Also, dropped uses of TargetMachine where unnecessary. The only target which still takes a TargetMachine& is Mips, I would appreciate it if someone would normalize this to match other targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77918 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMSubtarget.cpp | 5 +---- lib/Target/ARM/ARMSubtarget.h | 5 ++--- lib/Target/ARM/ARMTargetMachine.cpp | 2 +- lib/Target/Alpha/AlphaSubtarget.cpp | 2 +- lib/Target/Alpha/AlphaSubtarget.h | 5 ++--- lib/Target/Alpha/AlphaTargetMachine.cpp | 2 +- lib/Target/Blackfin/BlackfinSubtarget.cpp | 3 +-- lib/Target/Blackfin/BlackfinSubtarget.h | 6 +----- lib/Target/Blackfin/BlackfinTargetMachine.cpp | 2 +- lib/Target/CellSPU/SPUSubtarget.cpp | 6 +----- lib/Target/CellSPU/SPUSubtarget.h | 9 ++------- lib/Target/CellSPU/SPUTargetMachine.cpp | 2 +- lib/Target/MSP430/MSP430Subtarget.cpp | 4 +--- lib/Target/MSP430/MSP430Subtarget.h | 7 ++----- lib/Target/MSP430/MSP430TargetMachine.cpp | 2 +- lib/Target/Mips/MipsSubtarget.cpp | 4 +--- lib/Target/Mips/MipsSubtarget.h | 5 ++--- lib/Target/Mips/MipsTargetMachine.cpp | 2 +- lib/Target/PIC16/PIC16Subtarget.cpp | 2 +- lib/Target/PIC16/PIC16Subtarget.h | 5 ++--- lib/Target/PIC16/PIC16TargetMachine.cpp | 2 +- lib/Target/PowerPC/PPCISelLowering.cpp | 2 +- lib/Target/PowerPC/PPCSubtarget.cpp | 13 ++++++------- lib/Target/PowerPC/PPCSubtarget.h | 11 ++++------- lib/Target/PowerPC/PPCTargetMachine.cpp | 2 +- lib/Target/Sparc/SparcSubtarget.cpp | 2 +- lib/Target/Sparc/SparcSubtarget.h | 5 ++--- lib/Target/Sparc/SparcTargetMachine.cpp | 2 +- lib/Target/SystemZ/SystemZSubtarget.cpp | 2 +- lib/Target/SystemZ/SystemZSubtarget.h | 8 +++----- lib/Target/SystemZ/SystemZTargetMachine.cpp | 2 +- lib/Target/X86/X86Subtarget.cpp | 6 +++--- lib/Target/X86/X86Subtarget.h | 7 +++---- lib/Target/X86/X86TargetMachine.cpp | 2 +- lib/Target/XCore/XCoreSubtarget.cpp | 3 +-- lib/Target/XCore/XCoreSubtarget.h | 6 ++---- lib/Target/XCore/XCoreTargetMachine.cpp | 2 +- 37 files changed, 59 insertions(+), 98 deletions(-) diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp index d30592b..71c77e1 100644 --- a/lib/Target/ARM/ARMSubtarget.cpp +++ b/lib/Target/ARM/ARMSubtarget.cpp @@ -13,8 +13,6 @@ #include "ARMSubtarget.h" #include "ARMGenSubtarget.inc" -#include "llvm/Module.h" -#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -23,7 +21,7 @@ static cl::opt ReserveR9("arm-reserve-r9", cl::Hidden, cl::desc("Reserve R9, making it unavailable as GPR")); -ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, +ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS, bool isThumb) : ARMArchVersion(V4T) , ARMFPUType(None) @@ -45,7 +43,6 @@ ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. - const std::string& TT = M.getTargetTriple(); unsigned Len = TT.length(); unsigned Idx = 0; diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h index 60c3bd1..4ec77ff 100644 --- a/lib/Target/ARM/ARMSubtarget.h +++ b/lib/Target/ARM/ARMSubtarget.h @@ -19,7 +19,6 @@ #include namespace llvm { -class Module; class ARMSubtarget : public TargetSubtarget { protected: @@ -73,9 +72,9 @@ protected: } TargetABI; /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - ARMSubtarget(const Module &M, const std::string &FS, bool isThumb); + ARMSubtarget(const std::string &TT, const std::string &FS, bool isThumb); /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size /// that still makes it profitable to inline the call. diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 96552ed..0546e57 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -41,7 +41,7 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const std::string &FS, bool isThumb) : LLVMTargetMachine(T), - Subtarget(M, FS, isThumb), + Subtarget(M.getTargetTriple(), FS, isThumb), FrameInfo(Subtarget), JITInfo(), InstrItins(Subtarget.getInstrItineraryData()) { diff --git a/lib/Target/Alpha/AlphaSubtarget.cpp b/lib/Target/Alpha/AlphaSubtarget.cpp index d5a9365..bda7104 100644 --- a/lib/Target/Alpha/AlphaSubtarget.cpp +++ b/lib/Target/Alpha/AlphaSubtarget.cpp @@ -16,7 +16,7 @@ #include "AlphaGenSubtarget.inc" using namespace llvm; -AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS) +AlphaSubtarget::AlphaSubtarget(const std::string &TT, const std::string &FS) : HasCT(false) { std::string CPU = "generic"; diff --git a/lib/Target/Alpha/AlphaSubtarget.h b/lib/Target/Alpha/AlphaSubtarget.h index 0a944cb..f0eb93c 100644 --- a/lib/Target/Alpha/AlphaSubtarget.h +++ b/lib/Target/Alpha/AlphaSubtarget.h @@ -20,7 +20,6 @@ #include namespace llvm { -class Module; class AlphaSubtarget : public TargetSubtarget { protected: @@ -31,9 +30,9 @@ protected: public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - AlphaSubtarget(const Module &M, const std::string &FS); + AlphaSubtarget(const std::string &TT, const std::string &FS); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/Alpha/AlphaTargetMachine.cpp b/lib/Target/Alpha/AlphaTargetMachine.cpp index 9de5c36..b72f96f 100644 --- a/lib/Target/Alpha/AlphaTargetMachine.cpp +++ b/lib/Target/Alpha/AlphaTargetMachine.cpp @@ -36,7 +36,7 @@ AlphaTargetMachine::AlphaTargetMachine(const Target &T, const Module &M, DataLayout("e-f128:128:128"), FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), - Subtarget(M, FS), + Subtarget(M.getTargetTriple(), FS), TLInfo(*this) { setRelocationModel(Reloc::PIC_); } diff --git a/lib/Target/Blackfin/BlackfinSubtarget.cpp b/lib/Target/Blackfin/BlackfinSubtarget.cpp index 80a2421..e104c52 100644 --- a/lib/Target/Blackfin/BlackfinSubtarget.cpp +++ b/lib/Target/Blackfin/BlackfinSubtarget.cpp @@ -16,8 +16,7 @@ using namespace llvm; -BlackfinSubtarget::BlackfinSubtarget(const TargetMachine &TM, - const Module &M, +BlackfinSubtarget::BlackfinSubtarget(const std::string &TT, const std::string &FS) : sdram(false), icplb(false), diff --git a/lib/Target/Blackfin/BlackfinSubtarget.h b/lib/Target/Blackfin/BlackfinSubtarget.h index 13d8e24..d667fe2 100644 --- a/lib/Target/Blackfin/BlackfinSubtarget.h +++ b/lib/Target/Blackfin/BlackfinSubtarget.h @@ -19,9 +19,6 @@ namespace llvm { - class TargetMachine; - class Module; - class BlackfinSubtarget : public TargetSubtarget { bool sdram; bool icplb; @@ -35,8 +32,7 @@ namespace llvm { bool wa_killed_mmr; bool wa_rets; public: - BlackfinSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS); + BlackfinSubtarget(const std::string &TT, const std::string &FS); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/Blackfin/BlackfinTargetMachine.cpp b/lib/Target/Blackfin/BlackfinTargetMachine.cpp index 059916b..b69adf6 100644 --- a/lib/Target/Blackfin/BlackfinTargetMachine.cpp +++ b/lib/Target/Blackfin/BlackfinTargetMachine.cpp @@ -32,7 +32,7 @@ BlackfinTargetMachine::BlackfinTargetMachine(const Target &T, const std::string &FS) : LLVMTargetMachine(T), DataLayout("e-p:32:32-i64:32-f64:32"), - Subtarget(*this, M, FS), + Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 4, 0) { diff --git a/lib/Target/CellSPU/SPUSubtarget.cpp b/lib/Target/CellSPU/SPUSubtarget.cpp index 0a1c2f7..0f18b7f 100644 --- a/lib/Target/CellSPU/SPUSubtarget.cpp +++ b/lib/Target/CellSPU/SPUSubtarget.cpp @@ -13,15 +13,11 @@ #include "SPUSubtarget.h" #include "SPU.h" -#include "llvm/Module.h" -#include "llvm/Target/TargetMachine.h" #include "SPUGenSubtarget.inc" using namespace llvm; -SPUSubtarget::SPUSubtarget(const TargetMachine &tm, const Module &M, - const std::string &FS) : - TM(tm), +SPUSubtarget::SPUSubtarget(const std::string &TT, const std::string &FS) : StackAlignment(16), ProcDirective(SPU::DEFAULT_PROC), UseLargeMem(false) diff --git a/lib/Target/CellSPU/SPUSubtarget.h b/lib/Target/CellSPU/SPUSubtarget.h index b6a3409..94ac73c 100644 --- a/lib/Target/CellSPU/SPUSubtarget.h +++ b/lib/Target/CellSPU/SPUSubtarget.h @@ -20,9 +20,7 @@ #include namespace llvm { - class Module; class GlobalValue; - class TargetMachine; namespace SPU { enum { @@ -33,8 +31,6 @@ namespace llvm { class SPUSubtarget : public TargetSubtarget { protected: - const TargetMachine &TM; - /// stackAlignment - The minimum alignment known to hold of the stack frame /// on entry to the function and which must be maintained by every function. unsigned StackAlignment; @@ -52,10 +48,9 @@ namespace llvm { public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - SPUSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS); + SPUSubtarget(const std::string &TT, const std::string &FS); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/CellSPU/SPUTargetMachine.cpp b/lib/Target/CellSPU/SPUTargetMachine.cpp index 340eb56..16b923b 100644 --- a/lib/Target/CellSPU/SPUTargetMachine.cpp +++ b/lib/Target/CellSPU/SPUTargetMachine.cpp @@ -41,7 +41,7 @@ const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const { SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(*this, M, FS), + Subtarget(M.getTargetTriple(), FS), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this), diff --git a/lib/Target/MSP430/MSP430Subtarget.cpp b/lib/Target/MSP430/MSP430Subtarget.cpp index ef9e103..1346cb9 100644 --- a/lib/Target/MSP430/MSP430Subtarget.cpp +++ b/lib/Target/MSP430/MSP430Subtarget.cpp @@ -14,12 +14,10 @@ #include "MSP430Subtarget.h" #include "MSP430.h" #include "MSP430GenSubtarget.inc" -#include "llvm/Target/TargetMachine.h" using namespace llvm; -MSP430Subtarget::MSP430Subtarget(const TargetMachine &TM, const Module &M, - const std::string &FS) { +MSP430Subtarget::MSP430Subtarget(const std::string &TT, const std::string &FS) { std::string CPU = "generic"; // Parse features string. diff --git a/lib/Target/MSP430/MSP430Subtarget.h b/lib/Target/MSP430/MSP430Subtarget.h index 96c8108..1070544 100644 --- a/lib/Target/MSP430/MSP430Subtarget.h +++ b/lib/Target/MSP430/MSP430Subtarget.h @@ -19,17 +19,14 @@ #include namespace llvm { -class Module; -class TargetMachine; class MSP430Subtarget : public TargetSubtarget { bool ExtendedInsts; public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - MSP430Subtarget(const TargetMachine &TM, const Module &M, - const std::string &FS); + MSP430Subtarget(const std::string &TT, const std::string &FS); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/MSP430/MSP430TargetMachine.cpp b/lib/Target/MSP430/MSP430TargetMachine.cpp index 6f57003..e5642db 100644 --- a/lib/Target/MSP430/MSP430TargetMachine.cpp +++ b/lib/Target/MSP430/MSP430TargetMachine.cpp @@ -24,7 +24,7 @@ MSP430TargetMachine::MSP430TargetMachine(const Target &T, const Module &M, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(*this, M, FS), + Subtarget(M.getTargetTriple(), 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/Mips/MipsSubtarget.cpp b/lib/Target/Mips/MipsSubtarget.cpp index 87c2208..c56bc9d 100644 --- a/lib/Target/Mips/MipsSubtarget.cpp +++ b/lib/Target/Mips/MipsSubtarget.cpp @@ -14,7 +14,6 @@ #include "MipsSubtarget.h" #include "Mips.h" #include "MipsGenSubtarget.inc" -#include "llvm/Module.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -25,7 +24,7 @@ static cl::opt AbsoluteCall("enable-mips-absolute-call", cl::Hidden, cl::desc("Enable absolute call within abicall")); -MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, +MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const std::string &TT, const std::string &FS, bool little) : MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false), IsFP64bit(false), IsGP64bit(false), HasVFPU(false), HasABICall(true), @@ -37,7 +36,6 @@ MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, // Parse features string. ParseSubtargetFeatures(FS, CPU); - const std::string& TT = M.getTargetTriple(); // Is the target system Linux ? if (TT.find("linux") == std::string::npos) diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h index 2244e49..2485fef 100644 --- a/lib/Target/Mips/MipsSubtarget.h +++ b/lib/Target/Mips/MipsSubtarget.h @@ -20,7 +20,6 @@ #include namespace llvm { -class Module; class MipsSubtarget : public TargetSubtarget { @@ -99,8 +98,8 @@ public: unsigned getTargetABI() const { return MipsABI; } /// This constructor initializes the data members to match that - /// of the specified module. - MipsSubtarget(const TargetMachine &TM, const Module &M, + /// of the specified triple. + MipsSubtarget(const TargetMachine &TM, const std::string &TT, const std::string &FS, bool little); /// ParseSubtargetFeatures - Parses features string setting specified diff --git a/lib/Target/Mips/MipsTargetMachine.cpp b/lib/Target/Mips/MipsTargetMachine.cpp index b5e2da7..db18b09 100644 --- a/lib/Target/Mips/MipsTargetMachine.cpp +++ b/lib/Target/Mips/MipsTargetMachine.cpp @@ -42,7 +42,7 @@ MipsTargetMachine:: MipsTargetMachine(const Target &T, const Module &M, const std::string &FS, bool isLittle=false): LLVMTargetMachine(T), - Subtarget(*this, M, FS, isLittle), + Subtarget(*this, M.getTargetTriple(), FS, isLittle), DataLayout(isLittle ? std::string("e-p:32:32:32-i8:8:32-i16:16:32") : std::string("E-p:32:32:32-i8:8:32-i16:16:32")), InstrInfo(*this), diff --git a/lib/Target/PIC16/PIC16Subtarget.cpp b/lib/Target/PIC16/PIC16Subtarget.cpp index db8a5d8..33fc3fb 100644 --- a/lib/Target/PIC16/PIC16Subtarget.cpp +++ b/lib/Target/PIC16/PIC16Subtarget.cpp @@ -16,7 +16,7 @@ using namespace llvm; -PIC16Subtarget::PIC16Subtarget(const Module &M, const std::string &FS, +PIC16Subtarget::PIC16Subtarget(const std::string &TT, const std::string &FS, bool Cooper) :IsCooper(Cooper) { diff --git a/lib/Target/PIC16/PIC16Subtarget.h b/lib/Target/PIC16/PIC16Subtarget.h index e5147a0..81e3783 100644 --- a/lib/Target/PIC16/PIC16Subtarget.h +++ b/lib/Target/PIC16/PIC16Subtarget.h @@ -19,7 +19,6 @@ #include namespace llvm { -class Module; class PIC16Subtarget : public TargetSubtarget { @@ -28,9 +27,9 @@ class PIC16Subtarget : public TargetSubtarget { public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - PIC16Subtarget(const Module &M, const std::string &FS, bool Cooper); + PIC16Subtarget(const std::string &TT, const std::string &FS, bool Cooper); /// isCooper - Returns true if the target ISA is Cooper. bool isCooper() const { return IsCooper; } diff --git a/lib/Target/PIC16/PIC16TargetMachine.cpp b/lib/Target/PIC16/PIC16TargetMachine.cpp index 1c5d3d4..9a3b185 100644 --- a/lib/Target/PIC16/PIC16TargetMachine.cpp +++ b/lib/Target/PIC16/PIC16TargetMachine.cpp @@ -25,7 +25,7 @@ using namespace llvm; PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, const std::string &FS, bool Cooper) : LLVMTargetMachine(T), - Subtarget(M, FS, Cooper), + Subtarget(M.getTargetTriple(), 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) { } diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 9b0dd1f..2db69ec 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1201,7 +1201,7 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op, Lo = DAG.getNode(ISD::ADD, dl, PtrVT, Hi, Lo); - if (!TM.getSubtarget().hasLazyResolverStub(GV)) + if (!TM.getSubtarget().hasLazyResolverStub(GV, TM)) return Lo; // If the global is weak or external, we have to go through the lazy diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp index 425d8e6..e0937e2 100644 --- a/lib/Target/PowerPC/PPCSubtarget.cpp +++ b/lib/Target/PowerPC/PPCSubtarget.cpp @@ -13,7 +13,7 @@ #include "PPCSubtarget.h" #include "PPC.h" -#include "llvm/Module.h" +#include "llvm/GlobalValue.h" #include "llvm/Target/TargetMachine.h" #include "PPCGenSubtarget.inc" #include @@ -57,10 +57,9 @@ static const char *GetCurrentPowerPCCPU() { #endif -PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M, - const std::string &FS, bool is64Bit) - : TM(tm) - , StackAlignment(16) +PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &FS, + bool is64Bit) + : StackAlignment(16) , DarwinDirective(PPC::DIR_NONE) , IsGigaProcessor(false) , Has64BitSupport(false) @@ -95,7 +94,6 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M, // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. - const std::string &TT = M.getTargetTriple(); if (TT.length() > 7) { // Determine which version of darwin this is. size_t DarwinPos = TT.find("-darwin"); @@ -138,7 +136,8 @@ void PPCSubtarget::SetJITMode() { /// hasLazyResolverStub - Return true if accesses to the specified global have /// to go through a dyld lazy resolution stub. This means that an extra load /// is required to get the address of the global. -bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const { +bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV, + const TargetMachine &TM) const { // We never hae stubs if HasLazyResolverStubs=false or if in static mode. if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static) return false; diff --git a/lib/Target/PowerPC/PPCSubtarget.h b/lib/Target/PowerPC/PPCSubtarget.h index f633cc6..45ff91c 100644 --- a/lib/Target/PowerPC/PPCSubtarget.h +++ b/lib/Target/PowerPC/PPCSubtarget.h @@ -39,7 +39,6 @@ namespace PPC { }; } -class Module; class GlobalValue; class TargetMachine; @@ -49,8 +48,6 @@ public: OldMnemonic, NewMnemonic, Unset }; protected: - const TargetMachine &TM; - /// stackAlignment - The minimum alignment known to hold of the stack frame on /// entry to the function and which must be maintained by every function. unsigned StackAlignment; @@ -79,10 +76,9 @@ protected: unsigned char DarwinVers; // Is any darwin-ppc platform. public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - PPCSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS, bool is64Bit); + PPCSubtarget(const std::string &TT, const std::string &FS, bool is64Bit); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. @@ -132,7 +128,8 @@ public: /// hasLazyResolverStub - Return true if accesses to the specified global have /// to go through a dyld lazy resolution stub. This means that an extra load /// is required to get the address of the global. - bool hasLazyResolverStub(const GlobalValue *GV) const; + bool hasLazyResolverStub(const GlobalValue *GV, + const TargetMachine &TM) const; // Specific obvious features. bool hasFSQRT() const { return HasFSQRT; } diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index bb228c6..da6ebc4 100644 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -37,7 +37,7 @@ const TargetAsmInfo *PPCTargetMachine::createTargetAsmInfo() const { PPCTargetMachine::PPCTargetMachine(const Target&T, const Module &M, const std::string &FS, bool is64Bit) : LLVMTargetMachine(T), - Subtarget(*this, M, FS, is64Bit), + Subtarget(M.getTargetTriple(), FS, is64Bit), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()), MachOWriterInfo(*this) { diff --git a/lib/Target/Sparc/SparcSubtarget.cpp b/lib/Target/Sparc/SparcSubtarget.cpp index aaddbff..8a88cc0 100644 --- a/lib/Target/Sparc/SparcSubtarget.cpp +++ b/lib/Target/Sparc/SparcSubtarget.cpp @@ -22,7 +22,7 @@ namespace { cl::desc("Enable V9 instructions in the V8 target")); } -SparcSubtarget::SparcSubtarget(const Module &M, const std::string &FS) { +SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &FS) { // Set the default features. IsV9 = false; V8DeprecatedInsts = false; diff --git a/lib/Target/Sparc/SparcSubtarget.h b/lib/Target/Sparc/SparcSubtarget.h index e5a5ba4..4377034 100644 --- a/lib/Target/Sparc/SparcSubtarget.h +++ b/lib/Target/Sparc/SparcSubtarget.h @@ -18,14 +18,13 @@ #include namespace llvm { - class Module; - + class SparcSubtarget : public TargetSubtarget { bool IsV9; bool V8DeprecatedInsts; bool IsVIS; public: - SparcSubtarget(const Module &M, const std::string &FS); + SparcSubtarget(const std::string &TT, const std::string &FS); bool isV9() const { return IsV9; } bool isVIS() const { return IsVIS; } diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 17a419f..48924d6 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -34,7 +34,7 @@ SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M, const std::string &FS) : LLVMTargetMachine(T), DataLayout("E-p:32:32-f128:128:128"), - Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget), + Subtarget(M.getTargetTriple(), FS), TLInfo(*this), InstrInfo(Subtarget), FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { } diff --git a/lib/Target/SystemZ/SystemZSubtarget.cpp b/lib/Target/SystemZ/SystemZSubtarget.cpp index 18a8e16..a8b5e1f 100644 --- a/lib/Target/SystemZ/SystemZSubtarget.cpp +++ b/lib/Target/SystemZ/SystemZSubtarget.cpp @@ -19,7 +19,7 @@ using namespace llvm; -SystemZSubtarget::SystemZSubtarget(const TargetMachine &TM, const Module &M, +SystemZSubtarget::SystemZSubtarget(const std::string &TT, const std::string &FS): HasZ10Insts(false) { std::string CPU = "z9"; diff --git a/lib/Target/SystemZ/SystemZSubtarget.h b/lib/Target/SystemZ/SystemZSubtarget.h index fd8212c..405d6e9 100644 --- a/lib/Target/SystemZ/SystemZSubtarget.h +++ b/lib/Target/SystemZ/SystemZSubtarget.h @@ -19,18 +19,16 @@ #include namespace llvm { -class Module; -class TargetMachine; class GlobalValue; +class TargetMachine; class SystemZSubtarget : public TargetSubtarget { bool HasZ10Insts; public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - SystemZSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS); + SystemZSubtarget(const std::string &TT, const std::string &FS); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. diff --git a/lib/Target/SystemZ/SystemZTargetMachine.cpp b/lib/Target/SystemZ/SystemZTargetMachine.cpp index 8bebf5b..6a9c10c 100644 --- a/lib/Target/SystemZ/SystemZTargetMachine.cpp +++ b/lib/Target/SystemZ/SystemZTargetMachine.cpp @@ -33,7 +33,7 @@ SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Module &M, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(*this, M, FS), + Subtarget(M.getTargetTriple(), 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), diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp index 733f02f..6e5d8d8 100644 --- a/lib/Target/X86/X86Subtarget.cpp +++ b/lib/Target/X86/X86Subtarget.cpp @@ -15,7 +15,7 @@ #include "X86Subtarget.h" #include "X86InstrInfo.h" #include "X86GenSubtarget.inc" -#include "llvm/Module.h" +#include "llvm/GlobalValue.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Target/TargetMachine.h" @@ -383,7 +383,8 @@ static const char *GetCurrentX86CPU() { } } -X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit) +X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS, + bool is64Bit) : AsmFlavor(AsmWriterFlavor) , PICStyle(PICStyles::None) , X86SSELevel(NoMMXSSE) @@ -434,7 +435,6 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit) // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. - const std::string& TT = M.getTargetTriple(); if (TT.length() > 5) { size_t Pos; if ((Pos = TT.find("-darwin")) != std::string::npos) { diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 6397a56..9b8a5a7 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -18,7 +18,6 @@ #include namespace llvm { -class Module; class GlobalValue; class TargetMachine; @@ -101,7 +100,7 @@ protected: unsigned MaxInlineSizeThreshold; private: - /// Is64Bit - True if the processor supports 64-bit instructions and module + /// Is64Bit - True if the processor supports 64-bit instructions and /// pointer size is 64 bit. bool Is64Bit; @@ -111,9 +110,9 @@ public: } TargetType; /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - X86Subtarget(const Module &M, const std::string &FS, bool is64Bit); + X86Subtarget(const std::string &TT, const std::string &FS, bool is64Bit); /// getStackAlignment - Returns the minimum alignment known to hold of the /// stack frame on entry to the function and which must be maintained by every diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index ee0daed..56c0e92 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -62,7 +62,7 @@ X86_64TargetMachine::X86_64TargetMachine(const Target &T, const Module &M, X86TargetMachine::X86TargetMachine(const Target &T, const Module &M, const std::string &FS, bool is64Bit) : LLVMTargetMachine(T), - Subtarget(M, FS, is64Bit), + Subtarget(M.getTargetTriple(), FS, is64Bit), DataLayout(Subtarget.getDataLayout()), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4), diff --git a/lib/Target/XCore/XCoreSubtarget.cpp b/lib/Target/XCore/XCoreSubtarget.cpp index dc53da4..5fb1eaa 100644 --- a/lib/Target/XCore/XCoreSubtarget.cpp +++ b/lib/Target/XCore/XCoreSubtarget.cpp @@ -16,8 +16,7 @@ #include "XCoreGenSubtarget.inc" using namespace llvm; -XCoreSubtarget::XCoreSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS) +XCoreSubtarget::XCoreSubtarget(const std::string &TT, const std::string &FS) : IsXS1A(false), IsXS1B(false) { diff --git a/lib/Target/XCore/XCoreSubtarget.h b/lib/Target/XCore/XCoreSubtarget.h index ff6475b..4839351 100644 --- a/lib/Target/XCore/XCoreSubtarget.h +++ b/lib/Target/XCore/XCoreSubtarget.h @@ -20,7 +20,6 @@ #include namespace llvm { -class Module; class XCoreSubtarget : public TargetSubtarget { bool IsXS1A; @@ -28,10 +27,9 @@ class XCoreSubtarget : public TargetSubtarget { public: /// This constructor initializes the data members to match that - /// of the specified module. + /// of the specified triple. /// - XCoreSubtarget(const TargetMachine &TM, const Module &M, - const std::string &FS); + XCoreSubtarget(const std::string &TT, const std::string &FS); bool isXS1A() const { return IsXS1A; } bool isXS1B() const { return IsXS1B; } diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp index eac8ca1..570e3fd 100644 --- a/lib/Target/XCore/XCoreTargetMachine.cpp +++ b/lib/Target/XCore/XCoreTargetMachine.cpp @@ -26,7 +26,7 @@ const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const { XCoreTargetMachine::XCoreTargetMachine(const Target &T, const Module &M, const std::string &FS) : LLVMTargetMachine(T), - Subtarget(*this, M, FS), + Subtarget(M.getTargetTriple(), 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(), -- cgit v1.1