Stash the TargetMachine on the subtarget so we can access it later.

Clean up a subtarget function that has it passed in while we're at it.

llvm-svn: 229164
This commit is contained in:
Eric Christopher 2015-02-13 22:23:04 +00:00
parent a4ae213193
commit e8dbfe1cf8
3 changed files with 6 additions and 6 deletions

View File

@ -1577,7 +1577,7 @@ static bool GetLabelAccessInfo(const TargetMachine &TM,
// If this is a reference to a global value that requires a non-lazy-ptr, make // If this is a reference to a global value that requires a non-lazy-ptr, make
// sure that instruction lowering adds it. // sure that instruction lowering adds it.
if (GV && Subtarget.hasLazyResolverStub(GV, TM)) { if (GV && Subtarget.hasLazyResolverStub(GV)) {
HiOpFlags |= PPCII::MO_NLP_FLAG; HiOpFlags |= PPCII::MO_NLP_FLAG;
LoOpFlags |= PPCII::MO_NLP_FLAG; LoOpFlags |= PPCII::MO_NLP_FLAG;

View File

@ -51,7 +51,7 @@ PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &CPU,
TargetTriple.getArch() == Triple::ppc64le), TargetTriple.getArch() == Triple::ppc64le),
TargetABI(PPC_ABI_UNKNOWN), TargetABI(PPC_ABI_UNKNOWN),
FrameLowering(initializeSubtargetDependencies(CPU, FS)), InstrInfo(*this), FrameLowering(initializeSubtargetDependencies(CPU, FS)), InstrInfo(*this),
TLInfo(TM, *this), TSInfo(TM.getDataLayout()) {} TLInfo(TM, *this), TSInfo(TM.getDataLayout()), TM(TM) {}
void PPCSubtarget::initializeEnvironment() { void PPCSubtarget::initializeEnvironment() {
StackAlignment = 16; StackAlignment = 16;
@ -147,8 +147,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
/// hasLazyResolverStub - Return true if accesses to the specified global have /// hasLazyResolverStub - Return true if accesses to the specified global have
/// to go through a dyld lazy resolution stub. This means that an extra load /// to go through a dyld lazy resolution stub. This means that an extra load
/// is required to get the address of the global. /// is required to get the address of the global.
bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV, bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const {
const TargetMachine &TM) const {
// We never have stubs if HasLazyResolverStubs=false or if in static mode. // We never have stubs if HasLazyResolverStubs=false or if in static mode.
if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static) if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static)
return false; return false;

View File

@ -124,6 +124,7 @@ protected:
PPCInstrInfo InstrInfo; PPCInstrInfo InstrInfo;
PPCTargetLowering TLInfo; PPCTargetLowering TLInfo;
PPCSelectionDAGInfo TSInfo; PPCSelectionDAGInfo TSInfo;
const PPCTargetMachine &TM;
public: public:
/// This constructor initializes the data members to match that /// This constructor initializes the data members to match that
@ -164,6 +165,7 @@ public:
const PPCRegisterInfo *getRegisterInfo() const override { const PPCRegisterInfo *getRegisterInfo() const override {
return &getInstrInfo()->getRegisterInfo(); return &getInstrInfo()->getRegisterInfo();
} }
const PPCTargetMachine &getTargetMachine() const { return TM; }
/// initializeSubtargetDependencies - Initializes using a CPU and feature string /// initializeSubtargetDependencies - Initializes using a CPU and feature string
/// so that we can use initializer lists for subtarget initialization. /// so that we can use initializer lists for subtarget initialization.
@ -194,8 +196,7 @@ public:
/// hasLazyResolverStub - Return true if accesses to the specified global have /// hasLazyResolverStub - Return true if accesses to the specified global have
/// to go through a dyld lazy resolution stub. This means that an extra load /// to go through a dyld lazy resolution stub. This means that an extra load
/// is required to get the address of the global. /// is required to get the address of the global.
bool hasLazyResolverStub(const GlobalValue *GV, bool hasLazyResolverStub(const GlobalValue *GV) const;
const TargetMachine &TM) const;
// isLittleEndian - True if generating little-endian code // isLittleEndian - True if generating little-endian code
bool isLittleEndian() const { return IsLittleEndian; } bool isLittleEndian() const { return IsLittleEndian; }