Lines Matching refs:MF
54 WebAssemblyFrameLowering::getLocalForStackObject(MachineFunction &MF, in getLocalForStackObject() argument
56 MachineFrameInfo &MFI = MF.getFrameInfo(); in getLocalForStackObject()
73 *MF.getSubtarget<WebAssemblySubtarget>().getTargetLowering(); in getLocalForStackObject()
74 WebAssemblyFunctionInfo *FuncInfo = MF.getInfo<WebAssemblyFunctionInfo>(); in getLocalForStackObject()
75 ComputeValueVTs(TLI, MF.getDataLayout(), AI->getAllocatedType(), ValueVTs); in getLocalForStackObject()
94 bool WebAssemblyFrameLowering::hasBP(const MachineFunction &MF) const { in hasBP()
96 MF.getSubtarget<WebAssemblySubtarget>().getRegisterInfo(); in hasBP()
97 return RegInfo->hasStackRealignment(MF); in hasBP()
102 bool WebAssemblyFrameLowering::hasFP(const MachineFunction &MF) const { in hasFP()
103 const MachineFrameInfo &MFI = MF.getFrameInfo(); in hasFP()
112 bool NeedsFixedReference = !hasBP(MF) || HasFixedSizedObjects; in hasFP()
125 const MachineFunction &MF) const { in hasReservedCallFrame()
126 return !MF.getFrameInfo().hasVarSizedObjects(); in hasReservedCallFrame()
132 const MachineFunction &MF) const { in needsSPForLocalFrame()
133 auto &MFI = MF.getFrameInfo(); in needsSPForLocalFrame()
134 return MFI.getStackSize() || MFI.adjustsStack() || hasFP(MF); in needsSPForLocalFrame()
141 const MachineFunction &MF) const { in needsPrologForEH()
142 auto EHType = MF.getTarget().getMCAsmInfo()->getExceptionHandlingType(); in needsPrologForEH()
144 MF.getFunction().hasPersonalityFn() && MF.getFrameInfo().hasCalls(); in needsPrologForEH()
150 bool WebAssemblyFrameLowering::needsSP(const MachineFunction &MF) const { in needsSP()
151 return needsSPForLocalFrame(MF) || needsPrologForEH(MF); in needsSP()
159 const MachineFunction &MF) const { in needsSPWriteback()
160 auto &MFI = MF.getFrameInfo(); in needsSPWriteback()
161 assert(needsSP(MF)); in needsSPWriteback()
170 !MF.getFunction().hasFnAttribute(Attribute::NoRedZone); in needsSPWriteback()
171 return needsSPForLocalFrame(MF) && !CanUseRedZone; in needsSPWriteback()
174 unsigned WebAssemblyFrameLowering::getSPReg(const MachineFunction &MF) { in getSPReg() argument
175 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getSPReg()
180 unsigned WebAssemblyFrameLowering::getFPReg(const MachineFunction &MF) { in getFPReg() argument
181 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getFPReg()
187 WebAssemblyFrameLowering::getOpcConst(const MachineFunction &MF) { in getOpcConst() argument
188 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcConst()
193 unsigned WebAssemblyFrameLowering::getOpcAdd(const MachineFunction &MF) { in getOpcAdd() argument
194 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcAdd()
199 unsigned WebAssemblyFrameLowering::getOpcSub(const MachineFunction &MF) { in getOpcSub() argument
200 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcSub()
205 unsigned WebAssemblyFrameLowering::getOpcAnd(const MachineFunction &MF) { in getOpcAnd() argument
206 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcAnd()
212 WebAssemblyFrameLowering::getOpcGlobGet(const MachineFunction &MF) { in getOpcGlobGet() argument
213 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcGlobGet()
219 WebAssemblyFrameLowering::getOpcGlobSet(const MachineFunction &MF) { in getOpcGlobSet() argument
220 return MF.getSubtarget<WebAssemblySubtarget>().hasAddr64() in getOpcGlobSet()
226 unsigned SrcReg, MachineFunction &MF, MachineBasicBlock &MBB, in writeSPToGlobal() argument
228 const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo(); in writeSPToGlobal()
231 auto *SPSymbol = MF.createExternalSymbolName(ES); in writeSPToGlobal()
233 BuildMI(MBB, InsertStore, DL, TII->get(getOpcGlobSet(MF))) in writeSPToGlobal()
240 MachineFunction &MF, MachineBasicBlock &MBB, in eliminateCallFramePseudoInstr() argument
242 assert(!I->getOperand(0).getImm() && (hasFP(MF) || hasBP(MF)) && in eliminateCallFramePseudoInstr()
244 auto &ST = MF.getSubtarget<WebAssemblySubtarget>(); in eliminateCallFramePseudoInstr()
247 needsSPWriteback(MF)) { in eliminateCallFramePseudoInstr()
249 writeSPToGlobal(getSPReg(MF), MF, MBB, I, DL); in eliminateCallFramePseudoInstr()
254 void WebAssemblyFrameLowering::emitPrologue(MachineFunction &MF, in emitPrologue() argument
257 auto &MFI = MF.getFrameInfo(); in emitPrologue()
261 if (!needsSP(MF)) in emitPrologue()
265 auto &ST = MF.getSubtarget<WebAssemblySubtarget>(); in emitPrologue()
267 auto &MRI = MF.getRegInfo(); in emitPrologue()
276 MRI.getTargetRegisterInfo()->getPointerRegClass(MF); in emitPrologue()
277 unsigned SPReg = getSPReg(MF); in emitPrologue()
282 auto *SPSymbol = MF.createExternalSymbolName(ES); in emitPrologue()
283 BuildMI(MBB, InsertPt, DL, TII->get(getOpcGlobGet(MF)), SPReg) in emitPrologue()
286 bool HasBP = hasBP(MF); in emitPrologue()
288 auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); in emitPrologue()
297 BuildMI(MBB, InsertPt, DL, TII->get(getOpcConst(MF)), OffsetReg) in emitPrologue()
299 BuildMI(MBB, InsertPt, DL, TII->get(getOpcSub(MF)), getSPReg(MF)) in emitPrologue()
306 BuildMI(MBB, InsertPt, DL, TII->get(getOpcConst(MF)), BitmaskReg) in emitPrologue()
308 BuildMI(MBB, InsertPt, DL, TII->get(getOpcAnd(MF)), getSPReg(MF)) in emitPrologue()
309 .addReg(getSPReg(MF)) in emitPrologue()
312 if (hasFP(MF)) { in emitPrologue()
316 BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::COPY), getFPReg(MF)) in emitPrologue()
317 .addReg(getSPReg(MF)); in emitPrologue()
319 if (StackSize && needsSPWriteback(MF)) { in emitPrologue()
320 writeSPToGlobal(getSPReg(MF), MF, MBB, InsertPt, DL); in emitPrologue()
324 void WebAssemblyFrameLowering::emitEpilogue(MachineFunction &MF, in emitEpilogue() argument
326 uint64_t StackSize = MF.getFrameInfo().getStackSize(); in emitEpilogue()
327 if (!needsSP(MF) || !needsSPWriteback(MF)) in emitEpilogue()
329 auto &ST = MF.getSubtarget<WebAssemblySubtarget>(); in emitEpilogue()
331 auto &MRI = MF.getRegInfo(); in emitEpilogue()
341 unsigned SPFPReg = hasFP(MF) ? getFPReg(MF) : getSPReg(MF); in emitEpilogue()
342 if (hasBP(MF)) { in emitEpilogue()
343 auto FI = MF.getInfo<WebAssemblyFunctionInfo>(); in emitEpilogue()
347 MRI.getTargetRegisterInfo()->getPointerRegClass(MF); in emitEpilogue()
349 BuildMI(MBB, InsertPt, DL, TII->get(getOpcConst(MF)), OffsetReg) in emitEpilogue()
355 BuildMI(MBB, InsertPt, DL, TII->get(getOpcAdd(MF)), SPReg) in emitEpilogue()
362 writeSPToGlobal(SPReg, MF, MBB, InsertPt, DL); in emitEpilogue()
376 WebAssemblyFrameLowering::getDwarfFrameBase(const MachineFunction &MF) const { in getDwarfFrameBase()
379 const WebAssemblyFunctionInfo &MFI = *MF.getInfo<WebAssemblyFunctionInfo>(); in getDwarfFrameBase()
380 if (needsSP(MF) && MFI.isFrameBaseVirtual()) { in getDwarfFrameBase()