Lines Matching refs:MF
34 bool LoongArchFrameLowering::hasFP(const MachineFunction &MF) const { in hasFP()
35 const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); in hasFP()
37 const MachineFrameInfo &MFI = MF.getFrameInfo(); in hasFP()
38 return MF.getTarget().Options.DisableFramePointerElim(MF) || in hasFP()
39 RegInfo->hasStackRealignment(MF) || MFI.hasVarSizedObjects() || in hasFP()
43 bool LoongArchFrameLowering::hasBP(const MachineFunction &MF) const { in hasBP()
44 const MachineFrameInfo &MFI = MF.getFrameInfo(); in hasBP()
47 return MFI.hasVarSizedObjects() && TRI->hasStackRealignment(MF); in hasBP()
109 void LoongArchFrameLowering::determineFrameLayout(MachineFunction &MF) const { in determineFrameLayout()
110 MachineFrameInfo &MFI = MF.getFrameInfo(); in determineFrameLayout()
123 const MachineFunction &MF) { in estimateFunctionSizeInBytes() argument
125 for (auto &MBB : MF) in estimateFunctionSizeInBytes()
131 static bool needScavSlotForCFR(MachineFunction &MF) { in needScavSlotForCFR() argument
132 if (!MF.getSubtarget<LoongArchSubtarget>().hasBasicF()) in needScavSlotForCFR()
134 for (auto &MBB : MF) in needScavSlotForCFR()
142 MachineFunction &MF, RegScavenger *RS) const { in processFunctionBeforeFrameFinalized() argument
147 MF.getInfo<LoongArchMachineFunctionInfo>(); in processFunctionBeforeFrameFinalized()
148 MachineFrameInfo &MFI = MF.getFrameInfo(); in processFunctionBeforeFrameFinalized()
153 bool IsLargeFunction = !isInt<27>(estimateFunctionSizeInBytes(TII, MF)); in processFunctionBeforeFrameFinalized()
160 if (!isInt<11>(MFI.estimateStackSize(MF))) in processFunctionBeforeFrameFinalized()
164 if (needScavSlotForCFR(MF)) in processFunctionBeforeFrameFinalized()
179 void LoongArchFrameLowering::emitPrologue(MachineFunction &MF, in emitPrologue() argument
181 MachineFrameInfo &MFI = MF.getFrameInfo(); in emitPrologue()
182 auto *LoongArchFI = MF.getInfo<LoongArchMachineFunctionInfo>(); in emitPrologue()
196 if (MF.getFunction().getCallingConv() == CallingConv::GHC) in emitPrologue()
199 determineFrameLayout(MF); in emitPrologue()
209 uint64_t FirstSPAdjustAmount = getFirstSPAdjustAmount(MF, true); in emitPrologue()
220 MF.addFrameInst(MCCFIInstruction::cfiDefCfaOffset(nullptr, StackSize)); in emitPrologue()
238 unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset( in emitPrologue()
246 if (hasFP(MF)) { in emitPrologue()
252 unsigned CFIIndex = MF.addFrameInst( in emitPrologue()
262 if (hasFP(MF)) { in emitPrologue()
283 unsigned CFIIndex = MF.addFrameInst( in emitPrologue()
291 if (hasFP(MF)) { in emitPrologue()
293 if (RI->hasStackRealignment(MF)) { in emitPrologue()
307 if (hasBP(MF)) { in emitPrologue()
319 void LoongArchFrameLowering::emitEpilogue(MachineFunction &MF, in emitEpilogue() argument
322 MachineFrameInfo &MFI = MF.getFrameInfo(); in emitEpilogue()
323 auto *LoongArchFI = MF.getInfo<LoongArchMachineFunctionInfo>(); in emitEpilogue()
327 if (MF.getFunction().getCallingConv() == CallingConv::GHC) in emitEpilogue()
342 if (RI->hasStackRealignment(MF) || MFI.hasVarSizedObjects()) { in emitEpilogue()
343 assert(hasFP(MF) && "frame pointer should not have been eliminated"); in emitEpilogue()
349 uint64_t FirstSPAdjustAmount = getFirstSPAdjustAmount(MF); in emitEpilogue()
373 LoongArchFrameLowering::getFirstSPAdjustAmount(const MachineFunction &MF, in getFirstSPAdjustAmount() argument
375 const MachineFrameInfo &MFI = MF.getFrameInfo(); in getFirstSPAdjustAmount()
397 void LoongArchFrameLowering::determineCalleeSaves(MachineFunction &MF, in determineCalleeSaves() argument
400 TargetFrameLowering::determineCalleeSaves(MF, SavedRegs, RS); in determineCalleeSaves()
403 if (hasFP(MF)) { in determineCalleeSaves()
408 if (hasBP(MF)) in determineCalleeSaves()
416 const MachineFunction &MF) const { in hasReservedCallFrame()
417 return !MF.getFrameInfo().hasVarSizedObjects(); in hasReservedCallFrame()
423 MachineFunction &MF, MachineBasicBlock &MBB, in eliminateCallFramePseudoInstr() argument
428 if (!hasReservedCallFrame(MF)) { in eliminateCallFramePseudoInstr()
456 MachineFunction *MF = MBB.getParent(); in spillCalleeSavedRegisters() local
457 const TargetInstrInfo &TII = *MF->getSubtarget().getInstrInfo(); in spillCalleeSavedRegisters()
465 !(Reg == LoongArch::R1 && MF->getFrameInfo().isReturnAddressTaken()); in spillCalleeSavedRegisters()
475 const MachineFunction &MF, int FI, Register &FrameReg) const { in getFrameIndexReference() argument
476 const MachineFrameInfo &MFI = MF.getFrameInfo(); in getFrameIndexReference()
477 const TargetRegisterInfo *RI = MF.getSubtarget().getRegisterInfo(); in getFrameIndexReference()
478 auto *LoongArchFI = MF.getInfo<LoongArchMachineFunctionInfo>(); in getFrameIndexReference()
480 uint64_t FirstSPAdjustAmount = getFirstSPAdjustAmount(MF); in getFrameIndexReference()
503 } else if (RI->hasStackRealignment(MF) && !MFI.isFixedObjectIndex(FI)) { in getFrameIndexReference()
507 FrameReg = hasBP(MF) ? LoongArchABI::getBPReg() : LoongArch::R3; in getFrameIndexReference()
510 FrameReg = RI->getFrameRegister(MF); in getFrameIndexReference()
511 if (hasFP(MF)) in getFrameIndexReference()
521 const MachineFunction &MF) const { in enableShrinkWrapping()
523 if (MF.getFunction().hasOptNone()) in enableShrinkWrapping()