diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index 5339bf14ac7..0d304323547 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -23,7 +23,7 @@ using namespace llvm; SystemZInstrInfo::SystemZInstrInfo(SystemZTargetMachine &tm) : SystemZGenInstrInfo(SystemZ::ADJCALLSTACKDOWN, SystemZ::ADJCALLSTACKUP), - RI(tm, *this) { + RI(tm) { } // MI is a 128-bit load or store. Split it into two 64-bit loads or stores, diff --git a/lib/Target/SystemZ/SystemZLongBranch.cpp b/lib/Target/SystemZ/SystemZLongBranch.cpp index 24afb072ae8..2cb5823068d 100644 --- a/lib/Target/SystemZ/SystemZLongBranch.cpp +++ b/lib/Target/SystemZ/SystemZLongBranch.cpp @@ -133,8 +133,7 @@ namespace { public: static char ID; SystemZLongBranch(const SystemZTargetMachine &tm) - : MachineFunctionPass(ID), - TII(static_cast(tm.getInstrInfo())) {} + : MachineFunctionPass(ID), TII(0) {} virtual const char *getPassName() const { return "SystemZ Long Branch"; @@ -402,6 +401,7 @@ void SystemZLongBranch::relaxBranches() { } bool SystemZLongBranch::runOnMachineFunction(MachineFunction &F) { + TII = static_cast(F.getTarget().getInstrInfo()); MF = &F; uint64_t Size = initMBBInfo(); if (Size <= MaxForwardRange || !mustRelaxABranch()) diff --git a/lib/Target/SystemZ/SystemZRegisterInfo.cpp b/lib/Target/SystemZ/SystemZRegisterInfo.cpp index a0ae7ed0001..c695bb3dad1 100644 --- a/lib/Target/SystemZ/SystemZRegisterInfo.cpp +++ b/lib/Target/SystemZ/SystemZRegisterInfo.cpp @@ -17,9 +17,8 @@ using namespace llvm; -SystemZRegisterInfo::SystemZRegisterInfo(SystemZTargetMachine &tm, - const SystemZInstrInfo &tii) - : SystemZGenRegisterInfo(SystemZ::R14D), TM(tm), TII(tii) {} +SystemZRegisterInfo::SystemZRegisterInfo(SystemZTargetMachine &tm) + : SystemZGenRegisterInfo(SystemZ::R14D), TM(tm) {} const uint16_t* SystemZRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { @@ -61,6 +60,8 @@ SystemZRegisterInfo::saveScavengerRegister(MachineBasicBlock &MBB, const TargetRegisterClass *RC, unsigned Reg) const { MachineFunction &MF = *MBB.getParent(); + const SystemZInstrInfo &TII = + *static_cast(TM.getInstrInfo()); const SystemZFrameLowering *TFI = static_cast(TM.getFrameLowering()); unsigned Base = getFrameRegister(MF); @@ -86,6 +87,8 @@ SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI, MachineBasicBlock &MBB = *MI->getParent(); MachineFunction &MF = *MBB.getParent(); + const SystemZInstrInfo &TII = + *static_cast(TM.getInstrInfo()); const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering(); DebugLoc DL = MI->getDebugLoc(); diff --git a/lib/Target/SystemZ/SystemZRegisterInfo.h b/lib/Target/SystemZ/SystemZRegisterInfo.h index 91a70dea29c..047cb4a6323 100644 --- a/lib/Target/SystemZ/SystemZRegisterInfo.h +++ b/lib/Target/SystemZ/SystemZRegisterInfo.h @@ -35,10 +35,9 @@ class SystemZInstrInfo; struct SystemZRegisterInfo : public SystemZGenRegisterInfo { private: SystemZTargetMachine &TM; - const SystemZInstrInfo &TII; public: - SystemZRegisterInfo(SystemZTargetMachine &tm, const SystemZInstrInfo &tii); + SystemZRegisterInfo(SystemZTargetMachine &tm); // Override TargetRegisterInfo.h. virtual bool requiresRegisterScavenging(const MachineFunction &MF) const