Lines Matching defs:MF
57 bool runOnMachineFunction(MachineFunction &MF) override;
70 void placeMarkers(MachineFunction &MF);
76 bool fixCallUnwindMismatches(MachineFunction &MF);
77 bool fixCatchUnwindMismatches(MachineFunction &MF);
80 void recalculateScopeTops(MachineFunction &MF);
81 void removeUnnecessaryInstrs(MachineFunction &MF);
92 void rewriteDepthImmediates(MachineFunction &MF);
93 void fixEndsAtEndOfFunction(MachineFunction &MF);
94 void cleanupFunctionData(MachineFunction &MF);
110 MachineBasicBlock *getAppendixBlock(MachineFunction &MF) {
112 AppendixBB = MF.CreateMachineBasicBlock();
115 MF.push_back(AppendixBB);
127 MachineBasicBlock *getFakeCallerBlock(MachineFunction &MF) {
129 FakeCallerBB = MF.CreateMachineBasicBlock();
253 MachineFunction &MF = *MBB.getParent();
255 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
256 const auto &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
276 assert(&MBB != &MF.front() && "Header blocks shouldn't have predecessors");
398 MachineFunction &MF = *MBB.getParent();
402 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
412 if (Iter == MF.end()) {
413 getAppendixBlock(MF);
466 MachineFunction &MF = *MBB.getParent();
468 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
472 const auto &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
494 if (Iter == MF.end()) {
495 getAppendixBlock(MF);
500 assert(Cont != &MF.front());
664 void WebAssemblyCFGStackify::removeUnnecessaryInstrs(MachineFunction &MF) {
665 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
700 for (auto &MBB : MF) {
754 for (auto &MBB : MF) {
787 MachineFunction &MF = *MBB.getParent();
788 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
789 auto &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
790 auto &MRI = MF.getRegInfo();
851 MachineFunction &MF = *BeginBB->getParent();
852 const auto &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
853 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
877 MachineBasicBlock *DelegateBB = MF.CreateMachineBasicBlock();
887 MF.insert(std::next(EndBB->getIterator()), DelegateBB);
925 PostBB = MF.CreateMachineBasicBlock();
926 MF.insert(std::next(PreBB->getIterator()), PostBB);
927 MF.insert(std::next(PreBB->getIterator()), DelegateBB);
946 PreBB = MF.CreateMachineBasicBlock();
948 MF.insert(PostBB->getIterator(), PreBB);
949 MF.insert(PostBB->getIterator(), DelegateBB);
967 bool WebAssemblyCFGStackify::fixCallUnwindMismatches(MachineFunction &MF) {
1097 for (auto &MBB : reverse(MF)) {
1116 MachineBasicBlock *UnwindDest = getFakeCallerBlock(MF);
1162 UnwindDestToTryRanges[getFakeCallerBlock(MF)].push_back(
1173 for (auto &MBB : reverse(MF)) {
1254 bool WebAssemblyCFGStackify::fixCatchUnwindMismatches(MachineFunction &MF) {
1292 const auto *EHInfo = MF.getWasmEHFuncInfo();
1299 for (auto &MBB : reverse(MF)) {
1324 EHPadToUnwindDest[EHPad] = getFakeCallerBlock(MF);
1408 for (auto &MBB : MF) {
1415 for (; std::next(BrDest->getIterator()) != MF.end();
1437 void WebAssemblyCFGStackify::recalculateScopeTops(MachineFunction &MF) {
1440 MF.RenumberBlocks();
1442 ScopeTops.resize(MF.getNumBlockIDs());
1443 for (auto &MBB : reverse(MF)) {
1470 void WebAssemblyCFGStackify::fixEndsAtEndOfFunction(MachineFunction &MF) {
1471 const auto &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
1485 Worklist.push_back(MF.rbegin()->rbegin());
1527 static void appendEndToFunction(MachineFunction &MF,
1529 BuildMI(MF.back(), MF.back().end(),
1530 MF.back().findPrevDebugLoc(MF.back().end()),
1535 void WebAssemblyCFGStackify::placeMarkers(MachineFunction &MF) {
1538 ScopeTops.resize(MF.getNumBlockIDs() + 1);
1540 for (auto &MBB : MF)
1543 const MCAsmInfo *MCAI = MF.getTarget().getMCAsmInfo();
1544 for (auto &MBB : MF) {
1548 MF.getFunction().hasPersonalityFn())
1557 MF.getFunction().hasPersonalityFn()) {
1558 bool Changed = fixCallUnwindMismatches(MF);
1559 Changed |= fixCatchUnwindMismatches(MF);
1561 recalculateScopeTops(MF);
1629 void WebAssemblyCFGStackify::rewriteDepthImmediates(MachineFunction &MF) {
1632 for (auto &MBB : reverse(MF)) {
1675 MI.addOperand(MF, MO);
1688 void WebAssemblyCFGStackify::cleanupFunctionData(MachineFunction &MF) {
1690 MF.deleteMachineBasicBlock(FakeCallerBB);
1702 bool WebAssemblyCFGStackify::runOnMachineFunction(MachineFunction &MF) {
1705 << MF.getName() << '\n');
1706 const MCAsmInfo *MCAI = MF.getTarget().getMCAsmInfo();
1711 MF.getRegInfo().invalidateLiveness();
1714 placeMarkers(MF);
1718 MF.getFunction().hasPersonalityFn())
1719 removeUnnecessaryInstrs(MF);
1722 rewriteDepthImmediates(MF);
1726 fixEndsAtEndOfFunction(MF);
1729 const auto &TII = *MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
1730 if (!MF.getSubtarget<WebAssemblySubtarget>()
1733 appendEndToFunction(MF, TII);
1735 cleanupFunctionData(MF);
1737 MF.getInfo<WebAssemblyFunctionInfo>()->setCFGStackified();