From 6b6db77824e369da3d0f63086af9dc548486189a Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 2 Feb 2015 23:03:43 +0000 Subject: [PATCH] Use the function template getSubtarget off of the machine function, and use it in all locations. llvm-svn: 227890 --- llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp index 73f72da..8c2040d 100644 --- a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp +++ b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp @@ -495,8 +495,8 @@ getUnderlyingObjects(const MachineInstr &MI, // Replace Branch with the compact branch instruction. Iter Filler::replaceWithCompactBranch(MachineBasicBlock &MBB, Iter Branch, DebugLoc DL) { - const MipsInstrInfo *TII = static_cast( - MBB.getParent()->getSubtarget().getInstrInfo()); + const MipsInstrInfo *TII = + MBB.getParent()->getSubtarget().getInstrInfo(); unsigned NewOpcode = (((unsigned) Branch->getOpcode()) == Mips::BEQ) ? Mips::BEQZC_MM @@ -538,8 +538,7 @@ static int getEquivalentCallShort(int Opcode) { /// We assume there is only one delay slot per delayed instruction. bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) { bool Changed = false; - const MipsSubtarget &STI = - static_cast(MBB.getParent()->getSubtarget()); + const MipsSubtarget &STI = MBB.getParent()->getSubtarget(); bool InMicroMipsMode = STI.inMicroMipsMode(); const MipsInstrInfo *TII = STI.getInstrInfo(); @@ -623,8 +622,8 @@ bool Filler::searchRange(MachineBasicBlock &MBB, IterTy Begin, IterTy End, if (delayHasHazard(*I, RegDU, IM)) continue; - if (static_cast(MBB.getParent()->getSubtarget()) - .isTargetNaCl()) { + const MipsSubtarget &STI = MBB.getParent()->getSubtarget(); + if (STI.isTargetNaCl()) { // In NaCl, instructions that must be masked are forbidden in delay slots. // We only check for loads, stores and SP changes. Calls, returns and // branches are not checked because non-NaCl targets never put them in @@ -632,14 +631,12 @@ bool Filler::searchRange(MachineBasicBlock &MBB, IterTy Begin, IterTy End, unsigned AddrIdx; if ((isBasePlusOffsetMemoryAccess(I->getOpcode(), &AddrIdx) && baseRegNeedsLoadStoreMask(I->getOperand(AddrIdx).getReg())) || - I->modifiesRegister(Mips::SP, - TM.getSubtargetImpl()->getRegisterInfo())) + I->modifiesRegister(Mips::SP, STI.getRegisterInfo())) continue; } - bool InMicroMipsMode = TM.getSubtarget().inMicroMipsMode(); - const MipsInstrInfo *TII = static_cast( - TM.getSubtargetImpl()->getInstrInfo()); + bool InMicroMipsMode = STI.inMicroMipsMode(); + const MipsInstrInfo *TII = STI.getInstrInfo(); unsigned Opcode = (*Slot).getOpcode(); if (InMicroMipsMode && TII->GetInstSizeInBytes(&(*I)) == 2 && (Opcode == Mips::JR || Opcode == Mips::PseudoIndirectBranch || @@ -754,8 +751,8 @@ MachineBasicBlock *Filler::selectSuccBB(MachineBasicBlock &B) const { std::pair Filler::getBranch(MachineBasicBlock &MBB, const MachineBasicBlock &Dst) const { - const MipsInstrInfo *TII = static_cast( - MBB.getParent()->getSubtarget().getInstrInfo()); + const MipsInstrInfo *TII = + MBB.getParent()->getSubtarget().getInstrInfo(); MachineBasicBlock *TrueBB = nullptr, *FalseBB = nullptr; SmallVector BranchInstrs; SmallVector Cond; -- 2.7.4