Lines Matching refs:MF
46 bool WebAssemblyFrameLowering::hasBP(const MachineFunction &MF) const { in hasBP()
48 MF.getSubtarget<WebAssemblySubtarget>().getRegisterInfo(); in hasBP()
49 return RegInfo->needsStackRealignment(MF); in hasBP()
54 bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { in hasFP()
55 const MachineFrameInfo &MFI = MF.getFrameInfo(); in hasFP()
64 bool NeedsFixedReference = !hasBP(MF) || HasFixedSizedObjects; in hasFP()
77 const MachineFunction &MF) const { in hasReservedCallFrame()
78 return !MF.getFrameInfo().hasVarSizedObjects(); in hasReservedCallFrame()
84 const MachineFunction &MF) const { in needsSPForLocalFrame()
85 auto &MFI = MF.getFrameInfo(); in needsSPForLocalFrame()
86 return MFI.getStackSize() || MFI.adjustsStack() || hasFP(MF); in needsSPForLocalFrame()
93 const MachineFunction &MF) const { in needsPrologForEH()
94 auto EHType = MF.getTarget().getMCAsmInfo()->getExceptionHandlingType(); in needsPrologForEH()
96 MF.getFunction().hasPersonalityFn() && MF.getFrameInfo().hasCalls(); in needsPrologForEH()
102 bool WebAssemblyFrameLowering::needsSP(const MachineFunction &MF) const { in needsSP()
103 return needsSPForLocalFrame(MF) || needsPrologForEH(MF); in needsSP()
111 const MachineFunction &MF) const { in needsSPWriteback()
112 auto &MFI = MF.getFrameInfo(); in needsSPWriteback()
113 assert(needsSP(MF)); in needsSPWriteback()
122 !MF.getFunction().hasFnAttribute(Attribute::NoRedZone); in needsSPWriteback()
123 return needsSPForLocalFrame(MF) && !CanUseRedZone; in needsSPWriteback()
127 unsigned SrcReg, MachineFunction &MF, MachineBasicBlock &MBB, in writeSPToGlobal() argument
129 const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); in writeSPToGlobal()
132 auto *SPSymbol = MF.createExternalSymbolName(ES); in writeSPToGlobal()
140 MachineFunction &MF, MachineBasicBlock &MBB, in eliminateCallFramePseudoInstr() argument
142 assert(!I->getOperand(0).getImm() && (hasFP(MF) || hasBP(MF)) && in eliminateCallFramePseudoInstr()
144 const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); in eliminateCallFramePseudoInstr()
146 needsSPWriteback(MF)) { in eliminateCallFramePseudoInstr()
148 writeSPToGlobal(WebAssembly::SP32, MF, MBB, I, DL); in eliminateCallFramePseudoInstr()
153 void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, in emitPrologue() argument
156 auto &MFI = MF.getFrameInfo(); in emitPrologue()
160 if (!needsSP(MF)) in emitPrologue()
164 const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); in emitPrologue()
165 auto &MRI = MF.getRegInfo(); in emitPrologue()
173 MRI.getTargetRegisterInfo()->getPointerRegClass(MF); in emitPrologue()
179 auto *SPSymbol = MF.createExternalSymbolName(ES); in emitPrologue()
183 bool HasBP = hasBP(MF); in emitPrologue()
185 auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); in emitPrologue()
213 if (hasFP(MF)) { in emitPrologue()
220 if (StackSize && needsSPWriteback(MF)) { in emitPrologue()
221 writeSPToGlobal(WebAssembly::SP32, MF, MBB, InsertPt, DL); in emitPrologue()
225 void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF, in emitEpilogue() argument
227 uint64_t StackSize = MF.getFrameInfo().getStackSize(); in emitEpilogue()
228 if (!needsSP(MF) || !needsSPWriteback(MF)) in emitEpilogue()
230 const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); in emitEpilogue()
231 auto &MRI = MF.getRegInfo(); in emitEpilogue()
241 if (hasBP(MF)) { in emitEpilogue()
242 auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); in emitEpilogue()
246 MRI.getTargetRegisterInfo()->getPointerRegClass(MF); in emitEpilogue()
254 .addReg(hasFP(MF) ? WebAssembly::FP32 : WebAssembly::SP32) in emitEpilogue()
257 SPReg = hasFP(MF) ? WebAssembly::FP32 : WebAssembly::SP32; in emitEpilogue()
260 writeSPToGlobal(SPReg, MF, MBB, InsertPt, DL); in emitEpilogue()