diff options
| author | Matthias Braun <matze@braunis.de> | 2016-07-28 18:40:00 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2016-07-28 18:40:00 +0000 |
| commit | 941a705b7bf155fc581632ec7d80f22a139bdac0 (patch) | |
| tree | cd87202aa17c3e46adca731ccbf7b73ec1b92d81 /llvm/lib/Target/XCore/XCoreFrameLowering.cpp | |
| parent | 51524b755616c9562a00371b1539784320c0b504 (diff) | |
| download | bcm5719-llvm-941a705b7bf155fc581632ec7d80f22a139bdac0.tar.gz bcm5719-llvm-941a705b7bf155fc581632ec7d80f22a139bdac0.zip | |
MachineFunction: Return reference for getFrameInfo(); NFC
getFrameInfo() never returns nullptr so we should use a reference
instead of a pointer.
llvm-svn: 277017
Diffstat (limited to 'llvm/lib/Target/XCore/XCoreFrameLowering.cpp')
| -rw-r--r-- | llvm/lib/Target/XCore/XCoreFrameLowering.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp index d40aa356fd2..6ea9197dc7d 100644 --- a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp @@ -136,16 +136,16 @@ static void IfNeededLDAWSP(MachineBasicBlock &MBB, /// Registers are ordered according to their frame offset. /// As offsets are negative, the largest offsets will be first. static void GetSpillList(SmallVectorImpl<StackSlotInfo> &SpillList, - MachineFrameInfo *MFI, XCoreFunctionInfo *XFI, + MachineFrameInfo &MFI, XCoreFunctionInfo *XFI, bool fetchLR, bool fetchFP) { if (fetchLR) { - int Offset = MFI->getObjectOffset(XFI->getLRSpillSlot()); + int Offset = MFI.getObjectOffset(XFI->getLRSpillSlot()); SpillList.push_back(StackSlotInfo(XFI->getLRSpillSlot(), Offset, XCore::LR)); } if (fetchFP) { - int Offset = MFI->getObjectOffset(XFI->getFPSpillSlot()); + int Offset = MFI.getObjectOffset(XFI->getFPSpillSlot()); SpillList.push_back(StackSlotInfo(XFI->getFPSpillSlot(), Offset, FramePtr)); @@ -158,16 +158,16 @@ static void GetSpillList(SmallVectorImpl<StackSlotInfo> &SpillList, /// Registers are ordered according to their frame offset. /// As offsets are negative, the largest offsets will be first. static void GetEHSpillList(SmallVectorImpl<StackSlotInfo> &SpillList, - MachineFrameInfo *MFI, XCoreFunctionInfo *XFI, + MachineFrameInfo &MFI, XCoreFunctionInfo *XFI, const Constant *PersonalityFn, const TargetLowering *TL) { assert(XFI->hasEHSpillSlot() && "There are no EH register spill slots"); const int *EHSlot = XFI->getEHSpillSlot(); SpillList.push_back( - StackSlotInfo(EHSlot[0], MFI->getObjectOffset(EHSlot[0]), + StackSlotInfo(EHSlot[0], MFI.getObjectOffset(EHSlot[0]), TL->getExceptionPointerRegister(PersonalityFn))); SpillList.push_back( - StackSlotInfo(EHSlot[0], MFI->getObjectOffset(EHSlot[1]), + StackSlotInfo(EHSlot[0], MFI.getObjectOffset(EHSlot[1]), TL->getExceptionSelectorRegister(PersonalityFn))); std::sort(SpillList.begin(), SpillList.end(), CompareSSIOffset); } @@ -176,7 +176,7 @@ static MachineMemOperand *getFrameIndexMMO(MachineBasicBlock &MBB, int FrameIndex, MachineMemOperand::Flags flags) { MachineFunction *MF = MBB.getParent(); - const MachineFrameInfo &MFI = *MF->getFrameInfo(); + const MachineFrameInfo &MFI = MF->getFrameInfo(); MachineMemOperand *MMO = MF->getMachineMemOperand( MachinePointerInfo::getFixedStack(*MF, FrameIndex), flags, MFI.getObjectSize(FrameIndex), MFI.getObjectAlignment(FrameIndex)); @@ -217,14 +217,14 @@ XCoreFrameLowering::XCoreFrameLowering(const XCoreSubtarget &sti) bool XCoreFrameLowering::hasFP(const MachineFunction &MF) const { return MF.getTarget().Options.DisableFramePointerElim(MF) || - MF.getFrameInfo()->hasVarSizedObjects(); + MF.getFrameInfo().hasVarSizedObjects(); } void XCoreFrameLowering::emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const { assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported"); MachineBasicBlock::iterator MBBI = MBB.begin(); - MachineFrameInfo *MFI = MF.getFrameInfo(); + MachineFrameInfo &MFI = MF.getFrameInfo(); MachineModuleInfo *MMI = &MF.getMMI(); const MCRegisterInfo *MRI = MMI->getContext().getRegisterInfo(); const XCoreInstrInfo &TII = *MF.getSubtarget<XCoreSubtarget>().getInstrInfo(); @@ -233,9 +233,9 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF, // to determine the end of the prologue. DebugLoc dl; - if (MFI->getMaxAlignment() > getStackAlignment()) + if (MFI.getMaxAlignment() > getStackAlignment()) report_fatal_error("emitPrologue unsupported alignment: " - + Twine(MFI->getMaxAlignment())); + + Twine(MFI.getMaxAlignment())); const AttributeSet &PAL = MF.getFunction()->getAttributes(); if (PAL.hasAttrSomewhere(Attribute::Nest)) @@ -244,13 +244,13 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF, // Work out frame sizes. // We will adjust the SP in stages towards the final FrameSize. - assert(MFI->getStackSize()%4 == 0 && "Misaligned frame size"); - const int FrameSize = MFI->getStackSize() / 4; + assert(MFI.getStackSize()%4 == 0 && "Misaligned frame size"); + const int FrameSize = MFI.getStackSize() / 4; int Adjusted = 0; bool saveLR = XFI->hasLRSpillSlot(); bool UseENTSP = saveLR && FrameSize - && (MFI->getObjectOffset(XFI->getLRSpillSlot()) == 0); + && (MFI.getObjectOffset(XFI->getLRSpillSlot()) == 0); if (UseENTSP) saveLR = false; bool FP = hasFP(MF); @@ -316,7 +316,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF, MachineBasicBlock::iterator Pos = SpillLabel.first; ++Pos; const CalleeSavedInfo &CSI = SpillLabel.second; - int Offset = MFI->getObjectOffset(CSI.getFrameIdx()); + int Offset = MFI.getObjectOffset(CSI.getFrameIdx()); unsigned DRegNum = MRI->getDwarfRegNum(CSI.getReg(), true); EmitCfiOffset(MBB, Pos, dl, TII, MMI, DRegNum, Offset); } @@ -342,7 +342,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF, void XCoreFrameLowering::emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { - MachineFrameInfo *MFI = MF.getFrameInfo(); + MachineFrameInfo &MFI = MF.getFrameInfo(); MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr(); const XCoreInstrInfo &TII = *MF.getSubtarget<XCoreSubtarget>().getInstrInfo(); XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>(); @@ -351,7 +351,7 @@ void XCoreFrameLowering::emitEpilogue(MachineFunction &MF, // Work out frame sizes. // We will adjust the SP in stages towards the final FrameSize. - int RemainingAdj = MFI->getStackSize(); + int RemainingAdj = MFI.getStackSize(); assert(RemainingAdj%4 == 0 && "Misaligned frame size"); RemainingAdj /= 4; @@ -377,7 +377,7 @@ void XCoreFrameLowering::emitEpilogue(MachineFunction &MF, bool restoreLR = XFI->hasLRSpillSlot(); bool UseRETSP = restoreLR && RemainingAdj - && (MFI->getObjectOffset(XFI->getLRSpillSlot()) == 0); + && (MFI.getObjectOffset(XFI->getLRSpillSlot()) == 0); if (UseRETSP) restoreLR = false; bool FP = hasFP(MF); @@ -542,7 +542,7 @@ void XCoreFrameLowering::determineCalleeSaves(MachineFunction &MF, bool LRUsed = MRI.isPhysRegModified(XCore::LR); if (!LRUsed && !MF.getFunction()->isVarArg() && - MF.getFrameInfo()->estimateStackSize(MF)) + MF.getFrameInfo().estimateStackSize(MF)) // If we need to extend the stack it is more efficient to use entsp / retsp. // We force the LR to be saved so these instructions are used. LRUsed = true; @@ -573,7 +573,7 @@ void XCoreFrameLowering:: processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const { assert(RS && "requiresRegisterScavenging failed"); - MachineFrameInfo *MFI = MF.getFrameInfo(); + MachineFrameInfo &MFI = MF.getFrameInfo(); const TargetRegisterClass *RC = &XCore::GRRegsRegClass; XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>(); // Reserve slots close to SP or frame pointer for Scavenging spills. @@ -581,11 +581,11 @@ processFunctionBeforeFrameFinalized(MachineFunction &MF, // When using SP for large frames, we may need 2 scratch registers. // When using FP, for large or small frames, we may need 1 scratch register. if (XFI->isLargeFrame(MF) || hasFP(MF)) - RS->addScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(), - RC->getAlignment(), - false)); + RS->addScavengingFrameIndex(MFI.CreateStackObject(RC->getSize(), + RC->getAlignment(), + false)); if (XFI->isLargeFrame(MF) && !hasFP(MF)) - RS->addScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(), - RC->getAlignment(), - false)); + RS->addScavengingFrameIndex(MFI.CreateStackObject(RC->getSize(), + RC->getAlignment(), + false)); } |

