Lines Matching defs:MBB
71 void placeBlockMarker(MachineBasicBlock &MBB);
72 void placeLoopMarker(MachineBasicBlock &MBB);
73 void placeTryMarker(MachineBasicBlock &MBB);
87 const MachineBasicBlock *MBB);
89 const MachineBasicBlock *MBB);
157 /// Test whether Pred has any terminators explicitly branching to MBB, as
163 MachineBasicBlock *MBB) {
166 if (MO.isMBB() && MO.getMBB() == MBB)
171 // Returns an iterator to the earliest position possible within the MBB,
178 getEarliestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
180 auto InsertPos = MBB->end();
181 while (InsertPos != MBB->begin()) {
185 for (auto Pos = InsertPos, E = MBB->begin(); Pos != E; --Pos)
195 // Returns an iterator to the latest position possible within the MBB,
202 getLatestInsertPos(MachineBasicBlock *MBB, const Container &BeforeSet,
204 auto InsertPos = MBB->begin();
205 while (InsertPos != MBB->end()) {
209 for (auto Pos = InsertPos, E = MBB->end(); Pos != E; ++Pos)
248 /// Insert a BLOCK marker for branches to MBB (if needed).
251 void WebAssemblyCFGStackify::placeBlockMarker(MachineBasicBlock &MBB) {
252 assert(!MBB.isEHPad());
253 MachineFunction &MF = *MBB.getParent();
263 int MBBNumber = MBB.getNumber();
264 for (MachineBasicBlock *Pred : MBB.predecessors()) {
267 if (explicitlyBranchesTo(Pred, &MBB))
276 assert(&MBB != &MF.front() && "Header blocks shouldn't have predecessors");
277 MachineBasicBlock *LayoutPred = MBB.getPrevNode();
302 // loop is above MBB, it should be after the BLOCK, because the loop is
306 if (MBB.getNumber() > LoopBottom->getNumber())
320 if (BeginToEnd[&MI]->getParent()->getNumber() <= MBB.getNumber())
363 for (auto &MI : MBB) {
387 InsertPos = getEarliestInsertPos(&MBB, BeforeSet, AfterSet);
388 MachineInstr *End = BuildMI(MBB, InsertPos, MBB.findPrevDebugLoc(InsertPos),
393 updateScopeTops(Header, &MBB);
396 /// Insert a LOOP marker for a loop starting at MBB (if it's a loop header).
397 void WebAssemblyCFGStackify::placeLoopMarker(MachineBasicBlock &MBB) {
398 MachineFunction &MF = *MBB.getParent();
404 MachineLoop *Loop = MLI.getLoopFor(&MBB);
405 if (!Loop || Loop->getHeader() != &MBB)
421 for (const auto &MI : MBB) {
433 auto InsertPos = getEarliestInsertPos(&MBB, BeforeSet, AfterSet);
434 MachineInstr *Begin = BuildMI(MBB, InsertPos, MBB.findDebugLoc(InsertPos),
442 for (const auto &MI : MBB)
459 ScopeTops[AfterLoop->getNumber()]->getNumber() < MBB.getNumber()) &&
461 updateScopeTops(&MBB, AfterLoop);
464 void WebAssemblyCFGStackify::placeTryMarker(MachineBasicBlock &MBB) {
465 assert(MBB.isEHPad());
466 MachineFunction &MF = *MBB.getParent();
476 int MBBNumber = MBB.getNumber();
477 for (auto *Pred : MBB.predecessors()) {
480 assert(!explicitlyBranchesTo(Pred, &MBB) &&
489 WebAssemblyException *WE = WEI.getExceptionFor(&MBB);
526 // loop is above MBB, it should be after the TRY, because the loop is nested
530 if (MBB.getNumber() > LoopBottom->getNumber())
557 // If Header unwinds to MBB (= Header contains 'invoke'), the try block should
563 if (MBB.isPredecessor(Header)) {
647 registerTryScope(Begin, End, &MBB);
660 for (auto *End : {&MBB, Cont})
700 for (auto &MBB : MF) {
701 if (!MBB.isEHPad())
706 MachineBasicBlock *EHPadLayoutPred = MBB.getPrevNode();
708 MachineBasicBlock *Cont = &MBB;
754 for (auto &MBB : MF) {
755 for (auto &MI : MBB) {
783 // When MBB is split into MBB and Split, we should unstackify defs in MBB that
785 static void unstackifyVRegsUsedInSplitBB(MachineBasicBlock &MBB,
787 MachineFunction &MF = *MBB.getParent();
797 if (Def->getParent() == &MBB)
825 for (MachineInstr &MI : llvm::make_early_inc_range(MBB)) {
836 BuildMI(MBB, &MI, MI.getDebugLoc(), TII.get(CopyOpc), TeeReg)
838 BuildMI(MBB, &MI, MI.getDebugLoc(), TII.get(CopyOpc), Reg).addReg(DefReg);
1097 for (auto &MBB : reverse(MF)) {
1099 for (auto &MI : reverse(MBB)) {
1107 // seen one, we can skip the rest of BB. Also if MBB has no EH pad
1109 if (SeenThrowableInstInBB || !MBB.hasEHPadSuccessor() ||
1117 for (auto *Succ : MBB.successors()) {
1133 if (RangeBegin->getIterator() != MBB.begin() &&
1136 if (std::next(RangeEnd->getIterator()) != MBB.end() &&
1143 LLVM_DEBUG(dbgs() << "- Call unwind mismatch: MBB = " << MBB.getName()
1164 LLVM_DEBUG(dbgs() << "- Call unwind mismatch: MBB = "
1173 for (auto &MBB : reverse(MF)) {
1175 for (auto &MI : reverse(MBB)) {
1178 // If MBB has an EH pad successor and this is the last instruction that
1181 if (MBB.hasEHPadSuccessor() && MayThrow && !SeenThrowableInstInBB)
1230 auto *MBB = RangeBegin->getParent();
1238 for (auto *Succ : MBB->successors()) {
1245 MBB->removeSuccessor(EHPad);
1299 for (auto &MBB : reverse(MF)) {
1300 for (auto &MI : reverse(MBB)) {
1304 EHPadStack.push_back(&MBB);
1306 auto *EHPad = &MBB;
1408 for (auto &MBB : MF) {
1409 for (auto &MI : MBB) {
1443 for (auto &MBB : reverse(MF)) {
1444 for (auto &MI : reverse(MBB)) {
1445 if (ScopeTops[MBB.getNumber()])
1452 updateScopeTops(EndToBegin[&MI]->getParent(), &MBB);
1456 updateScopeTops(EHPadToTry[&MBB]->getParent(), &MBB);
1488 auto *MBB = It->getParent();
1489 while (It != MBB->rend()) {
1518 Worklist.push_back(MBB->getPrevNode()->rbegin());
1539 // Place the LOOP for MBB if MBB is the header of a loop.
1540 for (auto &MBB : MF)
1541 placeLoopMarker(MBB);
1544 for (auto &MBB : MF) {
1545 if (MBB.isEHPad()) {
1546 // Place the TRY for MBB if MBB is the EH pad of an exception.
1549 placeTryMarker(MBB);
1551 // Place the BLOCK for MBB if MBB is branched to from above.
1552 placeBlockMarker(MBB);
1566 const SmallVectorImpl<EndMarkerInfo> &Stack, const MachineBasicBlock *MBB) {
1569 if (X.first == MBB)
1578 const SmallVectorImpl<EndMarkerInfo> &Stack, const MachineBasicBlock *MBB) {
1579 if (MBB == FakeCallerBB)
1585 if (!MBB->isEHPad()) // Target is a delegate BB
1586 return getBranchDepth(Stack, MBB);
1602 const MachineInstr *EndTry = BeginToEnd[EHPadToTry[MBB]];
1632 for (auto &MBB : reverse(MF)) {
1633 for (MachineInstr &MI : llvm::reverse(MBB)) {
1638 MBB.getNumber() &&
1644 assert(Stack.back().first == &MBB && "Loop top should be balanced");
1650 Stack.push_back(std::make_pair(&MBB, &MI));
1659 // Rewrite MBB operands to be depth immediates.
1680 Stack.push_back(std::make_pair(&MBB, &MI));
1721 // Convert MBB operands in terminators to relative depth immediates.