Lines Matching refs:MBB

100       // Is this MBB reachable from the MF entry point?
107 // Regs killed in MBB. They may be defined again, and will then be in both
111 // Regs defined in MBB and live out. Note that vregs passing through may
115 // Vregs that pass through MBB untouched. This set is disjoint from
119 // Vregs that must pass through MBB because they are needed by a successor
181 // Extra register info per MBB.
199 void visitMachineBasicBlockBefore(const MachineBasicBlock *MBB);
205 void visitMachineBasicBlockAfter(const MachineBasicBlock *MBB);
209 void report(const char *msg, const MachineBasicBlock *MBB);
214 void report(const char *msg, const MachineBasicBlock *MBB,
218 void report(const char *msg, const MachineBasicBlock *MBB,
224 void markReachable(const MachineBasicBlock *MBB);
226 void checkPHIOps(const MachineBasicBlock *MBB);
390 void MachineVerifier::report(const char *msg, const MachineBasicBlock *MBB) {
391 assert(MBB);
392 report(msg, MBB->getParent());
393 *OS << "- basic block: BB#" << MBB->getNumber()
394 << ' ' << MBB->getName()
395 << " (" << (const void*)MBB << ')';
397 *OS << " [" << Indexes->getMBBStartIdx(MBB)
398 << ';' << Indexes->getMBBEndIdx(MBB) << ')';
426 void MachineVerifier::report(const char *msg, const MachineBasicBlock *MBB,
428 report(msg, MBB);
432 void MachineVerifier::report(const char *msg, const MachineBasicBlock *MBB,
434 report(msg, MBB);
444 void MachineVerifier::markReachable(const MachineBasicBlock *MBB) {
445 BBInfo &MInfo = MBBInfoMap[MBB];
448 for (MachineBasicBlock::const_succ_iterator SuI = MBB->succ_begin(),
449 SuE = MBB->succ_end(); SuI != SuE; ++SuI)
472 for (const auto &MBB : *MF) {
473 FunctionBlocks.insert(&MBB);
474 BBInfo &MInfo = MBBInfoMap[&MBB];
476 MInfo.Preds.insert(MBB.pred_begin(), MBB.pred_end());
477 if (MInfo.Preds.size() != MBB.pred_size())
478 report("MBB has duplicate entries in its predecessor list.", &MBB);
480 MInfo.Succs.insert(MBB.succ_begin(), MBB.succ_end());
481 if (MInfo.Succs.size() != MBB.succ_size())
482 report("MBB has duplicate entries in its successor list.", &MBB);
502 MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
508 for (MachineBasicBlock::livein_iterator LI = MBB->livein_begin(),
509 LE = MBB->livein_end();
512 if (isAllocatable(reg) && !MBB->isLandingPad() &&
513 MBB != MBB->getParent()->begin()) {
514 report("MBB has allocable live-in, but isn't entry or landing-pad.", MBB);
521 for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
522 E = MBB->succ_end(); I != E; ++I) {
526 report("MBB has successor that isn't part of the function.", MBB);
527 if (!MBBInfoMap[*I].Preds.count(MBB)) {
528 report("Inconsistent CFG", MBB);
529 *OS << "MBB is not in the predecessor list of the successor BB#"
535 for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(),
536 E = MBB->pred_end(); I != E; ++I) {
538 report("MBB has predecessor that isn't part of the function.", MBB);
539 if (!MBBInfoMap[*I].Succs.count(MBB)) {
540 report("Inconsistent CFG", MBB);
541 *OS << "MBB is not in the successor list of the predecessor BB#"
547 const BasicBlock *BB = MBB->getBasicBlock();
552 report("MBB has more than one landing pad successor", MBB);
557 if (!TII->AnalyzeBranch(*const_cast<MachineBasicBlock *>(MBB),
563 MachineFunction::const_iterator MBBI = MBB;
569 } else if (MBB->succ_size() == LandingPadSuccs.size()) {
573 } else if (MBB->succ_size() != 1+LandingPadSuccs.size()) {
574 report("MBB exits via unconditional fall-through but doesn't have "
575 "exactly one CFG successor!", MBB);
576 } else if (!MBB->isSuccessor(MBBI)) {
577 report("MBB exits via unconditional fall-through but its successor "
578 "differs from its CFG successor!", MBB);
580 if (!MBB->empty() && MBB->back().isBarrier() &&
581 !TII->isPredicated(&MBB->back())) {
582 report("MBB exits via unconditional fall-through but ends with a "
583 "barrier instruction!", MBB);
586 report("MBB exits via unconditional fall-through but has a condition!",
587 MBB);
591 if (MBB->succ_size() != 1+LandingPadSuccs.size()) {
592 report("MBB exits via unconditional branch but doesn't have "
593 "exactly one CFG successor!", MBB);
594 } else if (!MBB->isSuccessor(TBB)) {
595 report("MBB exits via unconditional branch but the CFG "
596 "successor doesn't match the actual successor!", MBB);
598 if (MBB->empty()) {
599 report("MBB exits via unconditional branch but doesn't contain "
600 "any instructions!", MBB);
601 } else if (!MBB->back().isBarrier()) {
602 report("MBB exits via unconditional branch but doesn't end with a "
603 "barrier instruction!", MBB);
604 } else if (!MBB->back().isTerminator()) {
605 report("MBB exits via unconditional branch but the branch isn't a "
606 "terminator instruction!", MBB);
610 MachineFunction::const_iterator MBBI = MBB;
613 report("MBB conditionally falls through out of function!", MBB);
614 } else if (MBB->succ_size() == 1) {
617 report("MBB exits via conditional branch/fall-through but only has "
618 "one CFG successor!", MBB);
619 else if (TBB != *MBB->succ_begin())
620 report("MBB exits via conditional branch/fall-through but the CFG "
621 "successor don't match the actual successor!", MBB);
622 } else if (MBB->succ_size() != 2) {
623 report("MBB exits via conditional branch/fall-through but doesn't have "
624 "exactly two CFG successors!", MBB);
625 } else if (!matchPair(MBB->succ_begin(), TBB, MBBI)) {
626 report("MBB exits via conditional branch/fall-through but the CFG "
627 "successors don't match the actual successors!", MBB);
629 if (MBB->empty()) {
630 report("MBB exits via conditional branch/fall-through but doesn't "
631 "contain any instructions!", MBB);
632 } else if (MBB->back().isBarrier()) {
633 report("MBB exits via conditional branch/fall-through but ends with a "
634 "barrier instruction!", MBB);
635 } else if (!MBB->back().isTerminator()) {
636 report("MBB exits via conditional branch/fall-through but the branch "
637 "isn't a terminator instruction!", MBB);
642 if (MBB->succ_size() == 1) {
645 report("MBB exits via conditional branch/branch through but only has "
646 "one CFG successor!", MBB);
647 else if (TBB != *MBB->succ_begin())
648 report("MBB exits via conditional branch/branch through but the CFG "
649 "successor don't match the actual successor!", MBB);
650 } else if (MBB->succ_size() != 2) {
651 report("MBB exits via conditional branch/branch but doesn't have "
652 "exactly two CFG successors!", MBB);
653 } else if (!matchPair(MBB->succ_begin(), TBB, FBB)) {
654 report("MBB exits via conditional branch/branch but the CFG "
655 "successors don't match the actual successors!", MBB);
657 if (MBB->empty()) {
658 report("MBB exits via conditional branch/branch but doesn't "
659 "contain any instructions!", MBB);
660 } else if (!MBB->back().isBarrier()) {
661 report("MBB exits via conditional branch/branch but doesn't end with a "
662 "barrier instruction!", MBB);
663 } else if (!MBB->back().isTerminator()) {
664 report("MBB exits via conditional branch/branch but the branch "
665 "isn't a terminator instruction!", MBB);
668 report("MBB exits via conditinal branch/branch but there's no "
669 "condition!", MBB);
672 report("AnalyzeBranch returned invalid data!", MBB);
677 for (MachineBasicBlock::livein_iterator I = MBB->livein_begin(),
678 E = MBB->livein_end(); I != E; ++I) {
680 report("MBB live-in list contains non-physical register", MBB);
691 BitVector PR = MFI->getPristineRegs(MBB);
702 lastIndex = Indexes->getMBBStartIdx(MBB);
1058 // if vreg was killed in this MBB. Otherwise keep track of vregs that
1138 MachineVerifier::visitMachineBasicBlockAfter(const MachineBasicBlock *MBB) {
1139 MBBInfoMap[MBB].regsLiveOut = regsLive;
1143 SlotIndex stop = Indexes->getMBBEndIdx(MBB);
1145 report("Block ends before last instruction index", MBB);
1154 // can pass through an MBB live, but may not be live every time. It is assumed
1160 for (const auto &MBB : *MF) {
1161 BBInfo &MInfo = MBBInfoMap[&MBB];
1164 for (MachineBasicBlock::const_succ_iterator SuI = MBB.succ_begin(),
1165 SuE = MBB.succ_end(); SuI != SuE; ++SuI) {
1175 const MachineBasicBlock *MBB = *todo.begin();
1176 todo.erase(MBB);
1177 BBInfo &MInfo = MBBInfoMap[MBB];
1178 for (MachineBasicBlock::const_succ_iterator SuI = MBB->succ_begin(),
1179 SuE = MBB->succ_end(); SuI != SuE; ++SuI) {
1180 if (*SuI == MBB)
1195 for (const auto &MBB : *MF) {
1196 BBInfo &MInfo = MBBInfoMap[&MBB];
1197 for (MachineBasicBlock::const_pred_iterator PrI = MBB.pred_begin(),
1198 PrE = MBB.pred_end(); PrI != PrE; ++PrI) {
1208 const MachineBasicBlock *MBB = *todo.begin();
1209 todo.erase(MBB);
1210 BBInfo &MInfo = MBBInfoMap[MBB];
1211 for (MachineBasicBlock::const_pred_iterator PrI = MBB->pred_begin(),
1212 PrE = MBB->pred_end(); PrI != PrE; ++PrI) {
1213 if (*PrI == MBB)
1222 // Check PHI instructions at the beginning of MBB. It is assumed that
1224 void MachineVerifier::checkPHIOps(const MachineBasicBlock *MBB) {
1226 for (const auto &BBI : *MBB) {
1234 if (!Pre->isSuccessor(MBB))
1244 for (MachineBasicBlock::const_pred_iterator PrI = MBB->pred_begin(),
1245 PrE = MBB->pred_end(); PrI != PrE; ++PrI) {
1258 for (const auto &MBB : *MF) {
1259 BBInfo &MInfo = MBBInfoMap[&MBB];
1265 checkPHIOps(&MBB);
1272 for (const auto &MBB : *MF) {
1273 BBInfo &MInfo = MBBInfoMap[&MBB];
1278 report("Virtual register killed in block, but needed live out.", &MBB);
1304 for (const auto &MBB : *MF) {
1305 BBInfo &MInfo = MBBInfoMap[&MBB];
1309 if (!VI.AliveBlocks.test(MBB.getNumber())) {
1310 report("LiveVariables: Block missing from AliveBlocks", &MBB);
1315 if (VI.AliveBlocks.test(MBB.getNumber())) {
1316 report("LiveVariables: Block should not be in AliveBlocks", &MBB);
1372 const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(VNI->def);
1373 if (!MBB) {
1381 if (VNI->def != LiveInts->getMBBStartIdx(MBB)) {
1382 report("PHIDef value is not defined at MBB start", MBB, LR);
1384 << ", not at the beginning of BB#" << MBB->getNumber() << '\n';
1392 report("No instruction at def index", MBB, LR);
1425 report("Early clobber def must be at an early-clobber slot", MBB, LR);
1430 MBB, LR);
1453 const MachineBasicBlock *MBB = LiveInts->getMBBFromIndex(S.start);
1454 if (!MBB) {
1459 SlotIndex MBBStartIdx = LiveInts->getMBBStartIdx(MBB);
1461 report("Live segment must begin at MBB entry or valno def", MBB, LR);
1537 MachineFunction::const_iterator MFI = MBB;
1541 if (MBB == EndMBB)
1656 const MachineBasicBlock *MBB = *DFI;
1670 // Update stack state by checking contents of MBB.
1671 for (const auto &I : *MBB) {
1703 SPState[MBB->getNumber()] = BBState;
1707 for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(),
1708 E = MBB->pred_end(); I != E; ++I) {
1712 report("The exit stack state of a predecessor is inconsistent.", MBB);
1716 << "), while BB#" << MBB->getNumber() << " has entry state ("
1723 for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
1724 E = MBB->succ_end(); I != E; ++I) {
1728 report("The entry stack state of a successor is inconsistent.", MBB);
1732 << "), while BB#" << MBB->getNumber() << " has exit state ("
1738 if (!MBB->empty() && MBB->back().isReturn()) {
1740 report("A return block ends with a FrameSetup.", MBB);
1742 report("A return block ends with a nonzero stack adjustment.", MBB);