[llvm] r230037 - Get the cached subtarget off the MachineFunction rather than

Eric Christopher echristo at gmail.com
Fri Feb 20 10:44:15 PST 2015


Author: echristo
Date: Fri Feb 20 12:44:15 2015
New Revision: 230037

URL: http://llvm.org/viewvc/llvm-project?rev=230037&view=rev
Log:
Get the cached subtarget off the MachineFunction rather than
inquiring for a new one from the TargetMachine.

Modified:
    llvm/trunk/lib/CodeGen/GCRootLowering.cpp
    llvm/trunk/lib/Target/PowerPC/PPCTLSDynamicCall.cpp

Modified: llvm/trunk/lib/CodeGen/GCRootLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCRootLowering.cpp?rev=230037&r1=230036&r2=230037&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GCRootLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/GCRootLowering.cpp Fri Feb 20 12:44:15 2015
@@ -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::FindSafePoin
 }
 
 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::runOnMachine
   if (!FI->getStrategy().needsSafePoints())
     return false;
 
-  TM = &MF.getTarget();
   MMI = &getAnalysis<MachineModuleInfo>();
-  TII = TM->getSubtargetImpl()->getInstrInfo();
+  TII = MF.getSubtarget().getInstrInfo();
 
   // Find the size of the stack frame.
   FI->setFrameSize(MF.getFrameInfo()->getStackSize());

Modified: llvm/trunk/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTLSDynamicCall.cpp?rev=230037&r1=230036&r2=230037&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTLSDynamicCall.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTLSDynamicCall.cpp Fri Feb 20 12:44:15 2015
@@ -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<PPCSubtarget>().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<const PPCTargetMachine *>(&MF.getTarget());
-      TII = TM->getSubtargetImpl()->getInstrInfo();
+      TII = MF.getSubtarget<PPCSubtarget>().getInstrInfo();
       LIS = &getAnalysis<LiveIntervals>();
 
       bool Changed = false;





More information about the llvm-commits mailing list