diff options
author | Matthias Braun <matze@braunis.de> | 2017-12-15 22:22:58 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2017-12-15 22:22:58 +0000 |
commit | f1caa2833f5052c419faa0007a38e0b242d5b034 (patch) | |
tree | 7cc0d98626eab1a09fdde0d18893ae1bdb92450a /llvm/lib/CodeGen/PrologEpilogInserter.cpp | |
parent | 8539edb0f37613ba4e9a5c5e9bd059221a9336d8 (diff) | |
download | llvm-f1caa2833f5052c419faa0007a38e0b242d5b034.zip llvm-f1caa2833f5052c419faa0007a38e0b242d5b034.tar.gz llvm-f1caa2833f5052c419faa0007a38e0b242d5b034.tar.bz2 |
MachineFunction: Return reference from getFunction(); NFC
The Function can never be nullptr so we can return a reference.
llvm-svn: 320884
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 57c2755..a8d8ad8 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -171,7 +171,7 @@ using StackObjSet = SmallSetVector<int, 8>; /// runOnMachineFunction - Insert prolog/epilog code and replace abstract /// frame indexes with appropriate references. bool PEI::runOnMachineFunction(MachineFunction &Fn) { - const Function* F = Fn.getFunction(); + const Function &F = Fn.getFunction(); const TargetRegisterInfo *TRI = Fn.getSubtarget().getRegisterInfo(); const TargetFrameLowering *TFI = Fn.getSubtarget().getFrameLowering(); @@ -206,7 +206,7 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) { // called functions. Because of this, calculateCalleeSavedRegisters() // must be called before this function in order to set the AdjustsStack // and MaxCallFrameSize variables. - if (!F->hasFnAttribute(Attribute::Naked)) + if (!F.hasFnAttribute(Attribute::Naked)) insertPrologEpilogCode(Fn); // Replace all MO_FrameIndex operands with physical register references @@ -224,8 +224,8 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) { MachineFrameInfo &MFI = Fn.getFrameInfo(); uint64_t StackSize = MFI.getStackSize(); if (WarnStackSize.getNumOccurrences() > 0 && WarnStackSize < StackSize) { - DiagnosticInfoStackSize DiagStackSize(*F, StackSize); - F->getContext().diagnose(DiagStackSize); + DiagnosticInfoStackSize DiagStackSize(F, StackSize); + F.getContext().diagnose(DiagStackSize); } delete RS; @@ -508,7 +508,7 @@ void PEI::spillCalleeSavedRegs(MachineFunction &Fn) { assert(Fn.getProperties().hasProperty( MachineFunctionProperties::Property::NoVRegs)); - const Function *F = Fn.getFunction(); + const Function &F = Fn.getFunction(); const TargetFrameLowering *TFI = Fn.getSubtarget().getFrameLowering(); MachineFrameInfo &MFI = Fn.getFrameInfo(); MinCSFrameIndex = std::numeric_limits<unsigned>::max(); @@ -522,7 +522,7 @@ void PEI::spillCalleeSavedRegs(MachineFunction &Fn) { assignCalleeSavedSpillSlots(Fn, SavedRegs, MinCSFrameIndex, MaxCSFrameIndex); // Add the code to save and restore the callee saved registers. - if (!F->hasFnAttribute(Attribute::Naked)) { + if (!F.hasFnAttribute(Attribute::Naked)) { MFI.setCalleeSavedInfoValid(true); std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo(); @@ -952,7 +952,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &Fn) { ORE->emit([&]() { return MachineOptimizationRemarkAnalysis(DEBUG_TYPE, "StackSize", - Fn.getFunction()->getSubprogram(), + Fn.getFunction().getSubprogram(), &Fn.front()) << ore::NV("NumStackBytes", StackSize) << " stack bytes in function"; }); @@ -993,7 +993,7 @@ void PEI::insertPrologEpilogCode(MachineFunction &Fn) { // approach is rather similar to that of Segmented Stacks, but it uses a // different conditional check and another BIF for allocating more stack // space. - if (Fn.getFunction()->getCallingConv() == CallingConv::HiPE) + if (Fn.getFunction().getCallingConv() == CallingConv::HiPE) for (MachineBasicBlock *SaveBlock : SaveBlocks) TFI.adjustForHiPEPrologue(Fn, *SaveBlock); } |