• Home
  • Raw
  • Download

Lines Matching refs:BB

122       MachineBasicBlock *BB;  member
131 ExtraCost(0), ExtraCost2(0), BB(nullptr), TrueBB(nullptr), in BBInfo()
205 void InvalidatePreds(MachineBasicBlock *BB);
220 bool MeetIfcvtSizeLimit(MachineBasicBlock &BB, in MeetIfcvtSizeLimit() argument
223 return Cycle > 0 && TII->isProfitableToIfCvt(BB, Cycle, Extra, in MeetIfcvtSizeLimit()
259 return C1->BBI.BB->getNumber() < C2->BBI.BB->getNumber(); in IfcvtTokenCmp()
349 << "): BB#" << BBI.BB->getNumber() << " (" in INITIALIZE_PASS_DEPENDENCY()
376 DEBUG(dbgs() << "): BB#" << BBI.BB->getNumber() << " (T:" in INITIALIZE_PASS_DEPENDENCY()
394 DEBUG(dbgs() << "Ifcvt (Diamond): BB#" << BBI.BB->getNumber() << " (T:" in INITIALIZE_PASS_DEPENDENCY()
439 static MachineBasicBlock *findFalseBlock(MachineBasicBlock *BB, in findFalseBlock() argument
441 for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(), in findFalseBlock()
442 E = BB->succ_end(); SI != E; ++SI) { in findFalseBlock()
455 TII->RemoveBranch(*BBI.BB); in ReverseBranchCondition()
456 TII->InsertBranch(*BBI.BB, BBI.FalseBB, BBI.TrueBB, BBI.BrCond, dl); in ReverseBranchCondition()
465 static inline MachineBasicBlock *getNextBlock(MachineBasicBlock *BB) { in getNextBlock() argument
466 MachineFunction::iterator I = BB->getIterator(); in getNextBlock()
467 MachineFunction::iterator E = BB->getParent()->end(); in getNextBlock()
486 if (TrueBBI.BB->pred_size() > 1) { in ValidSimple()
488 !TII->isProfitableToDupForIfCvt(*TrueBBI.BB, TrueBBI.NonPredSize, in ValidSimple()
510 if (TrueBBI.BB->pred_size() > 1) { in ValidTriangle()
527 if (!TII->isProfitableToDupForIfCvt(*TrueBBI.BB, Size, Prediction)) in ValidTriangle()
534 MachineFunction::iterator I = TrueBBI.BB->getIterator(); in ValidTriangle()
535 if (++I == TrueBBI.BB->getParent()->end()) in ValidTriangle()
539 return TExit && TExit == FalseBBI.BB; in ValidTriangle()
555 TT = getNextBlock(TrueBBI.BB); in ValidDiamond()
557 FT = getNextBlock(FalseBBI.BB); in ValidDiamond()
562 if (TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1) in ValidDiamond()
571 MachineBasicBlock::iterator TIB = TrueBBI.BB->begin(); in ValidDiamond()
572 MachineBasicBlock::iterator FIB = FalseBBI.BB->begin(); in ValidDiamond()
573 MachineBasicBlock::iterator TIE = TrueBBI.BB->end(); in ValidDiamond()
574 MachineBasicBlock::iterator FIE = FalseBBI.BB->end(); in ValidDiamond()
653 !TII->AnalyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); in ScanInstructions()
660 BBI.FalseBB = findFalseBlock(BBI.BB, BBI.TrueBB); in ScanInstructions()
673 for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end(); in ScanInstructions()
770 BBState(MachineBasicBlock *BB) : MBB(BB), SuccsAnalyzed(false) {} in AnalyzeBlock()
782 MachineBasicBlock *BB = State.MBB; in AnalyzeBlock() local
783 BBInfo &BBI = BBAnalysis[BB->getNumber()]; in AnalyzeBlock()
791 BBI.BB = BB; in AnalyzeBlock()
806 if (BBI.TrueBB == BB || BBI.FalseBB == BB) { in AnalyzeBlock()
848 BranchProbability Prediction = MBPI->getEdgeProbability(BB, TrueBBI.BB); in AnalyzeBlock()
851 MeetIfcvtSizeLimit(*TrueBBI.BB, (TrueBBI.NonPredSize - (Dups + Dups2) + in AnalyzeBlock()
853 *FalseBBI.BB, (FalseBBI.NonPredSize - (Dups + Dups2) + in AnalyzeBlock()
872 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
887 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
895 MeetIfcvtSizeLimit(*TrueBBI.BB, TrueBBI.NonPredSize + TrueBBI.ExtraCost, in AnalyzeBlock()
913 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
923 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
932 MeetIfcvtSizeLimit(*FalseBBI.BB, in AnalyzeBlock()
952 for (auto &BB : MF) in AnalyzeBlocks() local
953 AnalyzeBlock(&BB, Tokens); in AnalyzeBlocks()
962 static bool canFallThroughTo(MachineBasicBlock *BB, MachineBasicBlock *ToBB) { in canFallThroughTo() argument
963 MachineFunction::iterator PI = BB->getIterator(); in canFallThroughTo()
966 MachineFunction::iterator E = BB->getParent()->end(); in canFallThroughTo()
980 void IfConverter::InvalidatePreds(MachineBasicBlock *BB) { in InvalidatePreds() argument
981 for (const auto &Predecessor : BB->predecessors()) { in InvalidatePreds()
983 if (PBBI.IsDone || PBBI.BB == BB) in InvalidatePreds()
992 static void InsertUncondBranch(MachineBasicBlock *BB, MachineBasicBlock *ToBB, in InsertUncondBranch() argument
996 TII->InsertBranch(*BB, ToBB, nullptr, NoCond, dl); in InsertUncondBranch()
1004 if (!TII->AnalyzeBranch(*BBI.BB, TBB, FBB, Cond)) in RemoveExtraEdges()
1005 BBI.BB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty()); in RemoveExtraEdges()
1082 (CvtBBI->CannotBeCopied && CvtBBI->BB->pred_size() > 1)) { in IfConvertSimple()
1089 if (CvtBBI->BB->hasAddressTaken()) in IfConvertSimple()
1100 Redefs.addLiveIns(CvtBBI->BB); in IfConvertSimple()
1101 Redefs.addLiveIns(NextBBI->BB); in IfConvertSimple()
1106 DontKill.addLiveIns(NextBBI->BB); in IfConvertSimple()
1108 if (CvtBBI->BB->pred_size() > 1) { in IfConvertSimple()
1109 BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); in IfConvertSimple()
1116 BBI.BB->removeSuccessor(CvtBBI->BB, true); in IfConvertSimple()
1118 RemoveKills(CvtBBI->BB->begin(), CvtBBI->BB->end(), DontKill, *TRI); in IfConvertSimple()
1119 PredicateBlock(*CvtBBI, CvtBBI->BB->end(), Cond); in IfConvertSimple()
1122 BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); in IfConvertSimple()
1127 if (!canFallThroughTo(BBI.BB, NextBBI->BB)) { in IfConvertSimple()
1128 InsertUncondBranch(BBI.BB, NextBBI->BB, TII); in IfConvertSimple()
1148 InvalidatePreds(BBI.BB); in IfConvertSimple()
1169 (CvtBBI->CannotBeCopied && CvtBBI->BB->pred_size() > 1)) { in IfConvertTriangle()
1176 if (CvtBBI->BB->hasAddressTaken()) in IfConvertTriangle()
1188 for (MachineBasicBlock::pred_iterator PI = CvtBBI->BB->pred_begin(), in IfConvertTriangle()
1189 E = CvtBBI->BB->pred_end(); PI != E; ++PI) { in IfConvertTriangle()
1191 if (PBB == BBI.BB) in IfConvertTriangle()
1205 Redefs.addLiveIns(CvtBBI->BB); in IfConvertTriangle()
1206 Redefs.addLiveIns(NextBBI->BB); in IfConvertTriangle()
1215 CvtNext = MBPI->getEdgeProbability(CvtBBI->BB, NextBBI->BB); in IfConvertTriangle()
1216 CvtFalse = MBPI->getEdgeProbability(CvtBBI->BB, CvtBBI->FalseBB); in IfConvertTriangle()
1217 BBNext = MBPI->getEdgeProbability(BBI.BB, NextBBI->BB); in IfConvertTriangle()
1218 BBCvt = MBPI->getEdgeProbability(BBI.BB, CvtBBI->BB); in IfConvertTriangle()
1221 if (CvtBBI->BB->pred_size() > 1) { in IfConvertTriangle()
1222 BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); in IfConvertTriangle()
1229 BBI.BB->removeSuccessor(CvtBBI->BB, true); in IfConvertTriangle()
1232 CvtBBI->NonPredSize -= TII->RemoveBranch(*CvtBBI->BB); in IfConvertTriangle()
1233 PredicateBlock(*CvtBBI, CvtBBI->BB->end(), Cond); in IfConvertTriangle()
1236 BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); in IfConvertTriangle()
1253 auto NewTrueBB = getNextBlock(BBI.BB); in IfConvertTriangle()
1256 std::find(BBI.BB->succ_begin(), BBI.BB->succ_end(), NewTrueBB); in IfConvertTriangle()
1257 if (NewTrueBBIter != BBI.BB->succ_end()) in IfConvertTriangle()
1258 BBI.BB->setSuccProbability(NewTrueBBIter, NewNext); in IfConvertTriangle()
1261 TII->InsertBranch(*BBI.BB, CvtBBI->FalseBB, nullptr, RevCond, dl); in IfConvertTriangle()
1262 BBI.BB->addSuccessor(CvtBBI->FalseBB, NewFalse); in IfConvertTriangle()
1269 bool isFallThrough = canFallThroughTo(BBI.BB, NextBBI->BB); in IfConvertTriangle()
1275 NextBBI->BB->pred_size() == 1 && !NextBBI->HasFallThrough && in IfConvertTriangle()
1276 !NextBBI->BB->hasAddressTaken()) { in IfConvertTriangle()
1280 InsertUncondBranch(BBI.BB, NextBBI->BB, TII); in IfConvertTriangle()
1293 InvalidatePreds(BBI.BB); in IfConvertTriangle()
1317 TrueBBI.BB->pred_size() > 1 || in IfConvertDiamond()
1318 FalseBBI.BB->pred_size() > 1) { in IfConvertDiamond()
1326 if (TrueBBI.BB->hasAddressTaken() || FalseBBI.BB->hasAddressTaken()) in IfConvertDiamond()
1355 BBI.NonPredSize -= TII->RemoveBranch(*BBI.BB); in IfConvertDiamond()
1360 Redefs.addLiveIns(BBI1->BB); in IfConvertDiamond()
1364 MachineBasicBlock::iterator DI1 = BBI1->BB->getFirstNonDebugInstr(); in IfConvertDiamond()
1365 MachineBasicBlock::iterator DI2 = BBI2->BB->getFirstNonDebugInstr(); in IfConvertDiamond()
1385 for (MachineBasicBlock::reverse_iterator I = BBI2->BB->rbegin(), in IfConvertDiamond()
1390 for (MachineBasicBlock::const_iterator I = BBI1->BB->begin(), E = DI1; I != E; in IfConvertDiamond()
1395 BBI.BB->splice(BBI.BB->end(), BBI1->BB, BBI1->BB->begin(), DI1); in IfConvertDiamond()
1396 BBI2->BB->erase(BBI2->BB->begin(), DI2); in IfConvertDiamond()
1399 BBI1->NonPredSize -= TII->RemoveBranch(*BBI1->BB); in IfConvertDiamond()
1400 DI1 = BBI1->BB->end(); in IfConvertDiamond()
1404 assert (DI1 != BBI1->BB->begin()); in IfConvertDiamond()
1410 BBI1->BB->erase(DI1, BBI1->BB->end()); in IfConvertDiamond()
1414 RemoveKills(BBI1->BB->begin(), BBI1->BB->end(), DontKill, *TRI); in IfConvertDiamond()
1417 BBI2->NonPredSize -= TII->RemoveBranch(*BBI2->BB); in IfConvertDiamond()
1418 DI2 = BBI2->BB->end(); in IfConvertDiamond()
1422 assert (DI2 != BBI2->BB->begin()); in IfConvertDiamond()
1439 if (TII->isProfitableToUnpredicate(*BBI1->BB, *BBI2->BB)) { in IfConvertDiamond()
1440 for (MachineBasicBlock::iterator FI = BBI2->BB->begin(); FI != DI2; ++FI) { in IfConvertDiamond()
1474 PredicateBlock(*BBI1, BBI1->BB->end(), *Cond1, &RedefsByFalse); in IfConvertDiamond()
1490 !TailBBI.BB->hasAddressTaken(); in IfConvertDiamond()
1498 if (*PI != BBI1->BB && *PI != BBI2->BB) in IfConvertDiamond()
1505 BBI.BB->addSuccessor(TailBB, BranchProbability::getOne()); in IfConvertDiamond()
1506 InsertUncondBranch(BBI.BB, TailBB, TII); in IfConvertDiamond()
1514 BBI.BB->removeSuccessor(BBI1->BB); in IfConvertDiamond()
1515 BBI.BB->removeSuccessor(BBI2->BB, true); in IfConvertDiamond()
1520 InvalidatePreds(BBI.BB); in IfConvertDiamond()
1554 for (MachineBasicBlock::iterator I = BBI.BB->begin(); I != E; ++I) { in PredicateBlock()
1594 MachineFunction &MF = *ToBBI.BB->getParent(); in CopyAndPredicateBlock()
1596 for (MachineBasicBlock::iterator I = FromBBI.BB->begin(), in CopyAndPredicateBlock()
1597 E = FromBBI.BB->end(); I != E; ++I) { in CopyAndPredicateBlock()
1603 ToBBI.BB->insert(ToBBI.BB->end(), MI); in CopyAndPredicateBlock()
1630 std::vector<MachineBasicBlock *> Succs(FromBBI.BB->succ_begin(), in CopyAndPredicateBlock()
1631 FromBBI.BB->succ_end()); in CopyAndPredicateBlock()
1632 MachineBasicBlock *NBB = getNextBlock(FromBBI.BB); in CopyAndPredicateBlock()
1640 ToBBI.BB->addSuccessor(Succ); in CopyAndPredicateBlock()
1659 assert(!FromBBI.BB->hasAddressTaken() && in MergeBlocks()
1662 ToBBI.BB->splice(ToBBI.BB->end(), in MergeBlocks()
1663 FromBBI.BB, FromBBI.BB->begin(), FromBBI.BB->end()); in MergeBlocks()
1669 ToBBI.BB->normalizeSuccProbs(); in MergeBlocks()
1671 SmallVector<MachineBasicBlock *, 4> FromSuccs(FromBBI.BB->succ_begin(), in MergeBlocks()
1672 FromBBI.BB->succ_end()); in MergeBlocks()
1673 MachineBasicBlock *NBB = getNextBlock(FromBBI.BB); in MergeBlocks()
1678 if (AddEdges && ToBBI.BB->isSuccessor(FromBBI.BB)) { in MergeBlocks()
1679 To2FromProb = MBPI->getEdgeProbability(ToBBI.BB, FromBBI.BB); in MergeBlocks()
1683 ToBBI.BB->setSuccProbability( in MergeBlocks()
1684 std::find(ToBBI.BB->succ_begin(), ToBBI.BB->succ_end(), FromBBI.BB), in MergeBlocks()
1700 NewProb = MBPI->getEdgeProbability(FromBBI.BB, Succ); in MergeBlocks()
1711 FromBBI.BB->removeSuccessor(Succ); in MergeBlocks()
1736 if (ToBBI.BB->isSuccessor(Succ)) in MergeBlocks()
1737 ToBBI.BB->setSuccProbability( in MergeBlocks()
1738 std::find(ToBBI.BB->succ_begin(), ToBBI.BB->succ_end(), Succ), in MergeBlocks()
1739 MBPI->getEdgeProbability(ToBBI.BB, Succ) + NewProb); in MergeBlocks()
1741 ToBBI.BB->addSuccessor(Succ, NewProb); in MergeBlocks()
1746 if (NBB && !FromBBI.BB->isSuccessor(NBB)) in MergeBlocks()
1747 FromBBI.BB->addSuccessor(NBB); in MergeBlocks()
1751 ToBBI.BB->normalizeSuccProbs(); in MergeBlocks()