From 6de800e0566f1cbd3e8e51137fb8943ac1608724 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 20 Feb 2015 18:44:15 +0000 Subject: [PATCH] Get the cached subtarget off the MachineFunction rather than inquiring for a new one from the TargetMachine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230037 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/GCRootLowering.cpp | 6 ++---- lib/Target/PowerPC/PPCTLSDynamicCall.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/CodeGen/GCRootLowering.cpp b/lib/CodeGen/GCRootLowering.cpp index d69bb0ff805..9d38e4cad13 100644 --- a/lib/CodeGen/GCRootLowering.cpp +++ b/lib/CodeGen/GCRootLowering.cpp @@ -57,7 +57,6 @@ public: /// in the machine code. It inserts labels at safe points and populates a /// GCMetadata record for each function. class GCMachineCodeAnalysis : public MachineFunctionPass { - const TargetMachine *TM; GCFunctionInfo *FI; MachineModuleInfo *MMI; const TargetInstrInfo *TII; @@ -312,7 +311,7 @@ void GCMachineCodeAnalysis::FindSafePoints(MachineFunction &MF) { } void GCMachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) { - const TargetFrameLowering *TFI = TM->getSubtargetImpl()->getFrameLowering(); + const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering(); assert(TFI && "TargetRegisterInfo not available!"); for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(); @@ -336,9 +335,8 @@ bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { if (!FI->getStrategy().needsSafePoints()) return false; - TM = &MF.getTarget(); MMI = &getAnalysis(); - TII = TM->getSubtargetImpl()->getInstrInfo(); + TII = MF.getSubtarget().getInstrInfo(); // Find the size of the stack frame. FI->setFrameSize(MF.getFrameInfo()->getStackSize()); diff --git a/lib/Target/PowerPC/PPCTLSDynamicCall.cpp b/lib/Target/PowerPC/PPCTLSDynamicCall.cpp index 40cccd3cdaf..270fc712be1 100644 --- a/lib/Target/PowerPC/PPCTLSDynamicCall.cpp +++ b/lib/Target/PowerPC/PPCTLSDynamicCall.cpp @@ -46,14 +46,13 @@ namespace { initializePPCTLSDynamicCallPass(*PassRegistry::getPassRegistry()); } - const PPCTargetMachine *TM; const PPCInstrInfo *TII; LiveIntervals *LIS; protected: bool processBlock(MachineBasicBlock &MBB) { bool Changed = false; - bool Is64Bit = TM->getSubtargetImpl()->isPPC64(); + bool Is64Bit = MBB.getParent()->getSubtarget().isPPC64(); for (MachineBasicBlock::iterator I = MBB.begin(), IE = MBB.end(); I != IE; ++I) { @@ -133,8 +132,7 @@ protected: public: bool runOnMachineFunction(MachineFunction &MF) override { - TM = static_cast(&MF.getTarget()); - TII = TM->getSubtargetImpl()->getInstrInfo(); + TII = MF.getSubtarget().getInstrInfo(); LIS = &getAnalysis(); bool Changed = false; -- 2.34.1