Lines Matching defs:MBB
99 // Is this MBB reachable from the MF entry point?
106 // Regs killed in MBB. They may be defined again, and will then be in both
110 // Regs defined in MBB and live out. Note that vregs passing through may
114 // Vregs that pass through MBB untouched. This set is disjoint from
118 // Vregs that must pass through MBB because they are needed by a successor
180 // Extra register info per MBB.
198 void visitMachineBasicBlockBefore(const MachineBasicBlock *MBB);
204 void visitMachineBasicBlockAfter(const MachineBasicBlock *MBB);
211 void report(const char *msg, const MachineBasicBlock *MBB);
224 void markReachable(const MachineBasicBlock *MBB);
226 void checkPHIOps(const MachineBasicBlock *MBB);
407 void MachineVerifier::report(const char *msg, const MachineBasicBlock *MBB) {
408 assert(MBB);
409 report(msg, MBB->getParent());
410 errs() << "- basic block: BB#" << MBB->getNumber()
411 << ' ' << MBB->getName()
412 << " (" << (const void*)MBB << ')';
414 errs() << " [" << Indexes->getMBBStartIdx(MBB)
415 << ';' << Indexes->getMBBEndIdx(MBB) << ')';
458 void MachineVerifier::markReachable(const MachineBasicBlock *MBB) {
459 BBInfo &MInfo = MBBInfoMap[MBB];
462 for (MachineBasicBlock::const_succ_iterator SuI = MBB->succ_begin(),
463 SuE = MBB->succ_end(); SuI != SuE; ++SuI)
486 for (const auto &MBB : *MF) {
487 FunctionBlocks.insert(&MBB);
488 BBInfo &MInfo = MBBInfoMap[&MBB];
490 MInfo.Preds.insert(MBB.pred_begin(), MBB.pred_end());
491 if (MInfo.Preds.size() != MBB.pred_size())
492 MBB has duplicate entries in its predecessor list.", &MBB);
494 MInfo.Succs.insert(MBB.succ_begin(), MBB.succ_end());
495 if (MInfo.Succs.size() != MBB.succ_size())
496 report("MBB has duplicate entries in its successor list.", &MBB);
516 MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
522 for (const auto &LI : MBB->liveins()) {
523 if (isAllocatable(LI.PhysReg) && !MBB->isEHPad() &&
524 MBB != MBB->getParent()->begin()) {
525 report("MBB has allocable live-in, but isn't entry or landing-pad.", MBB);
532 for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
533 E = MBB->succ_end(); I != E; ++I) {
537 report("MBB has successor that isn't part of the function.", MBB);
538 if (!MBBInfoMap[*I].Preds.count(MBB)) {
539 report("Inconsistent CFG", MBB);
540 errs() << "MBB is not in the predecessor list of the successor BB#"
546 for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(),
547 E = MBB->pred_end(); I != E; ++I) {
549 report("MBB has predecessor that isn't part of the function.", MBB);
550 if (!MBBInfoMap[*I].Succs.count(MBB)) {
551 report("Inconsistent CFG", MBB);
552 errs() << "MBB is not in the successor list of the predecessor BB#"
558 const BasicBlock *BB = MBB->getBasicBlock();
565 report("MBB has more than one landing pad successor", MBB);
570 if (!TII->AnalyzeBranch(*const_cast<MachineBasicBlock *>(MBB),
576 MachineFunction::const_iterator MBBI = MBB->getIterator();
582 } else if (MBB->succ_size() == LandingPadSuccs.size()) {
586 } else if (MBB->succ_size() != 1+LandingPadSuccs.size()) {
587 report("MBB exits via unconditional fall-through but doesn't have "
588 "exactly one CFG successor!", MBB);
589 } else if (!MBB->isSuccessor(&*MBBI)) {
590 report("MBB exits via unconditional fall-through but its successor "
591 "differs from its CFG successor!", MBB);
593 if (!MBB->empty() && MBB->back().isBarrier() &&
594 !TII->isPredicated(&MBB->back())) {
595 report("MBB exits via unconditional fall-through but ends with a "
596 "barrier instruction!", MBB);
599 report("MBB exits via unconditional fall-through but has a condition!",
600 MBB);
606 if (MBB->succ_size() != 1+LandingPadSuccs.size() &&
607 (MBB->succ_size() != 1 || LandingPadSuccs.size() != 1 ||
608 *MBB->succ_begin() != *LandingPadSuccs.begin())) {
609 report("MBB exits via unconditional branch but doesn't have "
610 "exactly one CFG successor!", MBB);
611 } else if (!MBB->isSuccessor(TBB)) {
612 report("MBB exits via unconditional branch but the CFG "
613 "successor doesn't match the actual successor!", MBB);
615 if (MBB->empty()) {
616 report("MBB exits via unconditional branch but doesn't contain "
617 "any instructions!", MBB);
618 } else if (!MBB->back().isBarrier()) {
619 report("MBB exits via unconditional branch but doesn't end with a "
620 "barrier instruction!", MBB);
621 } else if (!MBB->back().isTerminator()) {
622 report("MBB exits via unconditional branch but the branch isn't a "
623 "terminator instruction!", MBB);
627 MachineFunction::const_iterator MBBI = MBB->getIterator();
630 report("MBB conditionally falls through out of function!", MBB);
631 } else if (MBB->succ_size() == 1) {
634 report("MBB exits via conditional branch/fall-through but only has "
635 "one CFG successor!", MBB);
636 else if (TBB != *MBB->succ_begin())
637 report("MBB exits via conditional branch/fall-through but the CFG "
638 "successor don't match the actual successor!", MBB);
639 } else if (MBB->succ_size() != 2) {
640 report("MBB exits via conditional branch/fall-through but doesn't have "
641 "exactly two CFG successors!", MBB);
642 } else if (!matchPair(MBB->succ_begin(), TBB, &*MBBI)) {
643 report("MBB exits via conditional branch/fall-through but the CFG "
644 "successors don't match the actual successors!", MBB);
646 if (MBB->empty()) {
647 report("MBB exits via conditional branch/fall-through but doesn't "
648 "contain any instructions!", MBB);
649 } else if (MBB->back().isBarrier()) {
650 report("MBB exits via conditional branch/fall-through but ends with a "
651 "barrier instruction!", MBB);
652 } else if (!MBB->back().isTerminator()) {
653 report("MBB exits via conditional branch/fall-through but the branch "
654 "isn't a terminator instruction!", MBB);
659 if (MBB->succ_size() == 1) {
662 report("MBB exits via conditional branch/branch through but only has "
663 "one CFG successor!", MBB);
664 else if (TBB != *MBB->succ_begin())
665 report("MBB exits via conditional branch/branch through but the CFG "
666 "successor don't match the actual successor!", MBB);
667 } else if (MBB->succ_size() != 2) {
668 report("MBB exits via conditional branch/branch but doesn't have "
669 "exactly two CFG successors!", MBB);
670 } else if (!matchPair(MBB->succ_begin(), TBB, FBB)) {
671 report("MBB exits via conditional branch/branch but the CFG "
672 "successors don't match the actual successors!", MBB);
674 if (MBB->empty()) {
675 report("MBB exits via conditional branch/branch but doesn't "
676 "contain any instructions!", MBB);
677 } else if (!MBB->back().isBarrier()) {
678 report("MBB exits via conditional branch/branch but doesn't end with a "
679 "barrier instruction!", MBB);
680 } else if (!MBB->back().isTerminator()) {
681 report("MBB exits via conditional branch/branch but the branch "
682 "isn't a terminator instruction!", MBB);
685 report("MBB exits via conditinal branch/branch but there's no "
686 "condition!", MBB);
689 report("AnalyzeBranch returned invalid data!", MBB);
694 for (const auto &LI : MBB->liveins()) {
696 report("MBB live-in list contains non-physical register", MBB);
718 lastIndex = Indexes->getMBBStartIdx(MBB);
1133 // if vreg was killed in this MBB. Otherwise keep track of vregs that
1213 MachineVerifier::visitMachineBasicBlockAfter(const MachineBasicBlock *MBB) {
1214 MBBInfoMap[MBB].regsLiveOut = regsLive;
1218 SlotIndex stop = Indexes->getMBBEndIdx(MBB);
1220 report("Block ends before last instruction index", MBB);
1229 // can pass through an MBB live, but may not be live every time. It is assumed
1235 for (const auto &MBB : *MF) {
1236 BBInfo &MInfo = MBBInfoMap[&MBB];
1239 for (MachineBasicBlock::const_succ_iterator SuI = MBB.succ_begin(),
1240 SuE = MBB.succ_end(); SuI != SuE; ++SuI) {
1250 const MachineBasicBlock *MBB = *todo.begin();
1251 todo.erase(MBB);
1252 BBInfo &MInfo = MBBInfoMap[MBB];
1253 for (MachineBasicBlock::const_succ_iterator SuI = MBB->succ_begin(),
1254 SuE = MBB->succ_end(); SuI != SuE; ++SuI) {
1255 if (*SuI == MBB)
1270 for (const auto &MBB : *MF) {
1271 BBInfo &MInfo = MBBInfoMap[&MBB];
1272 for (MachineBasicBlock::const_pred_iterator PrI = MBB.pred_begin(),
1273 PrE = MBB.pred_end(); PrI != PrE; ++PrI) {
1283 const MachineBasicBlock *MBB = *todo.begin();
1284 todo.erase(MBB);
1285 BBInfo &MInfo = MBBInfoMap[MBB];
1286 for (MachineBasicBlock::const_pred_iterator PrI = MBB->pred_begin(),
1287 PrE = MBB->pred_end(); PrI != PrE; ++PrI) {
1288 if (*PrI == MBB)
1297 // Check PHI instructions at the beginning of MBB. It is assumed that
1299 void MachineVerifier::checkPHIOps(const MachineBasicBlock *MBB) {
1301 for (const auto &BBI : *MBB) {
1309 if (!Pre->isSuccessor(MBB))
1319 for (MachineBasicBlock::const_pred_iterator PrI = MBB->pred_begin(),
1320 PrE = MBB->pred_end(); PrI != PrE; ++PrI) {
1333 for (const auto &MBB : *MF) {
1334 BBInfo &MInfo = MBBInfoMap[&MBB];
1340 checkPHIOps(&MBB);
1347 for (const auto &MBB : *MF) {
1348 BBInfo &MInfo = MBBInfoMap[&MBB];
1353 report("Virtual register killed in block, but needed live out.", &MBB);
1379 for (const auto &MBB : *MF) {
1380 BBInfo &MInfo = MBBInfoMap[&MBB];
1384 if (!VI.AliveBlocks.test(MBB.getNumber())) {
1385 report("LiveVariables: Block missing from AliveBlocks", &MBB);
1390 if (VI.AliveBlocks.test(MBB.getNumber())) {
1391 report("LiveVariables: Block should not be in AliveBlocks", &MBB);
1448 const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(VNI->def);
1449 if (!MBB) {
1457 if (VNI->def != LiveInts->getMBBStartIdx(MBB)) {
1458 report("PHIDef VNInfo is not defined at MBB start", MBB);
1468 report("No instruction at VNInfo def index", MBB);
1506 report("Early clobber def must be at an early-clobber slot", MBB);
1511 report("Non-PHI, non-early clobber def must be at a register slot", MBB);
1539 const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(S.start);
1540 if (!MBB) {
1546 SlotIndex MBBStartIdx = LiveInts->getMBBStartIdx(MBB);
1548 report("Live segment must begin at MBB entry or valno def", MBB);
1643 MachineFunction::const_iterator MFI = MBB->getIterator();
1647 if (MBB == EndMBB)
1789 const MachineBasicBlock *MBB = *DFI;
1803 // Update stack state by checking contents of MBB.
1804 for (const auto &I : *MBB) {
1836 SPState[MBB->getNumber()] = BBState;
1840 for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(),
1841 E = MBB->pred_end(); I != E; ++I) {
1845 report("The exit stack state of a predecessor is inconsistent.", MBB);
1849 << "), while BB#" << MBB->getNumber() << " has entry state ("
1856 for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
1857 E = MBB->succ_end(); I != E; ++I) {
1861 report("The entry stack state of a successor is inconsistent.", MBB);
1865 << "), while BB#" << MBB->getNumber() << " has exit state ("
1871 if (!MBB->empty() && MBB->back().isReturn()) {
1873 report("A return block ends with a FrameSetup.", MBB);
1875 report("A return block ends with a nonzero stack adjustment.", MBB);