• Home
  • Raw
  • Download

Lines Matching refs:BBI

175       BBInfo &BBI;  member
185 : BBI(b), Kind(k), NumDups(d), NumDups2(d2), NeedSubsumption(s), in IfcvtToken()
230 bool reverseBranchCondition(BBInfo &BBI) const;
248 void AnalyzeBranches(BBInfo &BBI);
249 void ScanInstructions(BBInfo &BBI,
259 bool FeasibilityAnalysis(BBInfo &BBI, SmallVectorImpl<MachineOperand> &Pred,
265 bool IfConvertSimple(BBInfo &BBI, IfcvtKind Kind);
266 bool IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind);
267 bool IfConvertDiamondCommon(BBInfo &BBI, BBInfo &TrueBBI, BBInfo &FalseBBI,
271 bool IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind,
274 bool IfConvertForkedDiamond(BBInfo &BBI, IfcvtKind Kind,
277 void PredicateBlock(BBInfo &BBI,
403 bool blockAlwaysFallThrough(BBInfo &BBI) const { in blockAlwaysFallThrough()
404 return BBI.IsBrAnalyzable && BBI.TrueBB == nullptr; in blockAlwaysFallThrough()
425 return C1->BBI.BB->getNumber() < C2->BBI.BB->getNumber(); in IfcvtTokenCmp()
493 BBInfo &BBI = Token->BBI; in INITIALIZE_PASS_DEPENDENCY() local
500 if (BBI.IsDone) in INITIALIZE_PASS_DEPENDENCY()
501 BBI.IsEnqueued = false; in INITIALIZE_PASS_DEPENDENCY()
502 if (!BBI.IsEnqueued) in INITIALIZE_PASS_DEPENDENCY()
505 BBI.IsEnqueued = false; in INITIALIZE_PASS_DEPENDENCY()
516 << "): " << printMBBReference(*BBI.BB) << " (" in INITIALIZE_PASS_DEPENDENCY()
517 << ((Kind == ICSimpleFalse) ? BBI.FalseBB->getNumber() in INITIALIZE_PASS_DEPENDENCY()
518 : BBI.TrueBB->getNumber()) in INITIALIZE_PASS_DEPENDENCY()
520 RetVal = IfConvertSimple(BBI, Kind); in INITIALIZE_PASS_DEPENDENCY()
543 LLVM_DEBUG(dbgs() << "): " << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
544 << " (T:" << BBI.TrueBB->getNumber() in INITIALIZE_PASS_DEPENDENCY()
545 << ",F:" << BBI.FalseBB->getNumber() << ") "); in INITIALIZE_PASS_DEPENDENCY()
546 RetVal = IfConvertTriangle(BBI, Kind); in INITIALIZE_PASS_DEPENDENCY()
561 LLVM_DEBUG(dbgs() << "Ifcvt (Diamond): " << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
562 << " (T:" << BBI.TrueBB->getNumber() in INITIALIZE_PASS_DEPENDENCY()
563 << ",F:" << BBI.FalseBB->getNumber() << ") "); in INITIALIZE_PASS_DEPENDENCY()
564 RetVal = IfConvertDiamond(BBI, Kind, NumDups, NumDups2, in INITIALIZE_PASS_DEPENDENCY()
573 << printMBBReference(*BBI.BB) in INITIALIZE_PASS_DEPENDENCY()
574 << " (T:" << BBI.TrueBB->getNumber() in INITIALIZE_PASS_DEPENDENCY()
575 << ",F:" << BBI.FalseBB->getNumber() << ") "); in INITIALIZE_PASS_DEPENDENCY()
576 RetVal = IfConvertForkedDiamond(BBI, Kind, NumDups, NumDups2, in INITIALIZE_PASS_DEPENDENCY()
585 recomputeLivenessFlags(*BBI.BB); in INITIALIZE_PASS_DEPENDENCY()
624 bool IfConverter::reverseBranchCondition(BBInfo &BBI) const { in reverseBranchCondition()
626 if (!TII->reverseBranchCondition(BBI.BrCond)) { in reverseBranchCondition()
627 TII->removeBranch(*BBI.BB); in reverseBranchCondition()
628 TII->insertBranch(*BBI.BB, BBI.FalseBB, BBI.TrueBB, BBI.BrCond, dl); in reverseBranchCondition()
629 std::swap(BBI.TrueBB, BBI.FalseBB); in reverseBranchCondition()
1024 void IfConverter::AnalyzeBranches(BBInfo &BBI) { in AnalyzeBranches() argument
1025 if (BBI.IsDone) in AnalyzeBranches()
1028 BBI.TrueBB = BBI.FalseBB = nullptr; in AnalyzeBranches()
1029 BBI.BrCond.clear(); in AnalyzeBranches()
1030 BBI.IsBrAnalyzable = in AnalyzeBranches()
1031 !TII->analyzeBranch(*BBI.BB, BBI.TrueBB, BBI.FalseBB, BBI.BrCond); in AnalyzeBranches()
1032 if (!BBI.IsBrAnalyzable) { in AnalyzeBranches()
1033 BBI.TrueBB = nullptr; in AnalyzeBranches()
1034 BBI.FalseBB = nullptr; in AnalyzeBranches()
1035 BBI.BrCond.clear(); in AnalyzeBranches()
1038 SmallVector<MachineOperand, 4> RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); in AnalyzeBranches()
1039 BBI.IsBrReversible = (RevCond.size() == 0) || in AnalyzeBranches()
1041 BBI.HasFallThrough = BBI.IsBrAnalyzable && BBI.FalseBB == nullptr; in AnalyzeBranches()
1043 if (BBI.BrCond.size()) { in AnalyzeBranches()
1046 if (!BBI.FalseBB) in AnalyzeBranches()
1047 BBI.FalseBB = findFalseBlock(BBI.BB, BBI.TrueBB); in AnalyzeBranches()
1048 if (!BBI.FalseBB) { in AnalyzeBranches()
1050 BBI.IsUnpredicable = true; in AnalyzeBranches()
1060 void IfConverter::ScanInstructions(BBInfo &BBI, in ScanInstructions() argument
1064 if (BBI.IsDone || BBI.IsUnpredicable) in ScanInstructions()
1067 bool AlreadyPredicated = !BBI.Predicate.empty(); in ScanInstructions()
1069 BBI.NonPredSize = 0; in ScanInstructions()
1070 BBI.ExtraCost = 0; in ScanInstructions()
1071 BBI.ExtraCost2 = 0; in ScanInstructions()
1072 BBI.ClobbersPred = false; in ScanInstructions()
1108 BBI.CannotBeCopied = true; in ScanInstructions()
1111 bool isCondBr = BBI.IsBrAnalyzable && MI.isConditionalBranch(); in ScanInstructions()
1114 BBI.IsUnpredicable = true; in ScanInstructions()
1123 BBI.NonPredSize++; in ScanInstructions()
1127 BBI.ExtraCost += NumCycles-1; in ScanInstructions()
1128 BBI.ExtraCost2 += ExtraPredCost; in ScanInstructions()
1133 BBI.IsUnpredicable = true; in ScanInstructions()
1137 if (BBI.ClobbersPred && !isPredicated) { in ScanInstructions()
1142 BBI.IsUnpredicable = true; in ScanInstructions()
1150 BBI.ClobbersPred = true; in ScanInstructions()
1153 BBI.IsUnpredicable = true; in ScanInstructions()
1168 bool IfConverter::FeasibilityAnalysis(BBInfo &BBI, in FeasibilityAnalysis() argument
1176 if (BBI.IsDone || (BBI.IsUnpredicable && !hasCommonTail)) in FeasibilityAnalysis()
1182 if (BBI.Predicate.size() && !BBI.IsBrAnalyzable) in FeasibilityAnalysis()
1187 if (BBI.Predicate.size() && !TII->SubsumesPredicate(Pred, BBI.Predicate)) in FeasibilityAnalysis()
1190 if (!hasCommonTail && BBI.BrCond.size()) { in FeasibilityAnalysis()
1196 SmallVector<MachineOperand, 4> Cond(BBI.BrCond.begin(), BBI.BrCond.end()); in FeasibilityAnalysis()
1227 BBInfo &BBI = BBAnalysis[BB->getNumber()]; in AnalyzeBlock() local
1230 if (BBI.IsAnalyzed || BBI.IsBeingAnalyzed) { in AnalyzeBlock()
1235 BBI.BB = BB; in AnalyzeBlock()
1236 BBI.IsBeingAnalyzed = true; in AnalyzeBlock()
1238 AnalyzeBranches(BBI); in AnalyzeBlock()
1239 MachineBasicBlock::iterator Begin = BBI.BB->begin(); in AnalyzeBlock()
1240 MachineBasicBlock::iterator End = BBI.BB->end(); in AnalyzeBlock()
1241 ScanInstructions(BBI, Begin, End); in AnalyzeBlock()
1245 if (!BBI.IsBrAnalyzable || BBI.BrCond.empty() || BBI.IsDone) { in AnalyzeBlock()
1246 BBI.IsBeingAnalyzed = false; in AnalyzeBlock()
1247 BBI.IsAnalyzed = true; in AnalyzeBlock()
1253 if (BBI.TrueBB == BB || BBI.FalseBB == BB) { in AnalyzeBlock()
1254 BBI.IsBeingAnalyzed = false; in AnalyzeBlock()
1255 BBI.IsAnalyzed = true; in AnalyzeBlock()
1261 if (!BBI.FalseBB) { in AnalyzeBlock()
1262 BBI.IsBeingAnalyzed = false; in AnalyzeBlock()
1263 BBI.IsAnalyzed = true; in AnalyzeBlock()
1270 BBStack.push_back(*BBI.FalseBB); in AnalyzeBlock()
1271 BBStack.push_back(*BBI.TrueBB); in AnalyzeBlock()
1275 BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; in AnalyzeBlock()
1276 BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; in AnalyzeBlock()
1279 BBI.IsBeingAnalyzed = false; in AnalyzeBlock()
1280 BBI.IsAnalyzed = true; in AnalyzeBlock()
1286 RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); in AnalyzeBlock()
1302 bool TrueFeasible = FeasibilityAnalysis(TrueBBI, BBI.BrCond, in AnalyzeBlock()
1323 BBI, ICDiamond, TNeedSub | FNeedSub, Dups, Dups2, in AnalyzeBlock()
1341 BBI, ICForkedDiamond, TNeedSub | FNeedSub, Dups, Dups2, in AnalyzeBlock()
1351 FeasibilityAnalysis(TrueBBI, BBI.BrCond, true)) { in AnalyzeBlock()
1360 std::make_unique<IfcvtToken>(BBI, ICTriangle, TNeedSub, Dups)); in AnalyzeBlock()
1367 FeasibilityAnalysis(TrueBBI, BBI.BrCond, true, true)) { in AnalyzeBlock()
1369 std::make_unique<IfcvtToken>(BBI, ICTriangleRev, TNeedSub, Dups)); in AnalyzeBlock()
1376 FeasibilityAnalysis(TrueBBI, BBI.BrCond)) { in AnalyzeBlock()
1385 std::make_unique<IfcvtToken>(BBI, ICSimple, TNeedSub, Dups)); in AnalyzeBlock()
1397 Tokens.push_back(std::make_unique<IfcvtToken>(BBI, ICTriangleFalse, in AnalyzeBlock()
1409 std::make_unique<IfcvtToken>(BBI, ICTriangleFRev, FNeedSub, Dups)); in AnalyzeBlock()
1419 std::make_unique<IfcvtToken>(BBI, ICSimpleFalse, FNeedSub, Dups)); in AnalyzeBlock()
1424 BBI.IsEnqueued = Enqueued; in AnalyzeBlock()
1425 BBI.IsBeingAnalyzed = false; in AnalyzeBlock()
1426 BBI.IsAnalyzed = true; in AnalyzeBlock()
1534 bool IfConverter::IfConvertSimple(BBInfo &BBI, IfcvtKind Kind) { in IfConvertSimple() argument
1535 BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; in IfConvertSimple()
1536 BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; in IfConvertSimple()
1540 SmallVector<MachineOperand, 4> Cond(BBI.BrCond.begin(), BBI.BrCond.end()); in IfConvertSimple()
1549 BBI.IsAnalyzed = false; in IfConvertSimple()
1573 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertSimple()
1578 CopyAndPredicateBlock(BBI, *CvtBBI, Cond); in IfConvertSimple()
1581 BBI.BB->removeSuccessor(&CvtMBB, true); in IfConvertSimple()
1588 MergeBlocks(BBI, *CvtBBI); in IfConvertSimple()
1592 if (!canFallThroughTo(*BBI.BB, NextMBB)) { in IfConvertSimple()
1593 InsertUncondBranch(*BBI.BB, NextMBB, TII); in IfConvertSimple()
1594 BBI.HasFallThrough = false; in IfConvertSimple()
1610 BBI.IsDone = true; in IfConvertSimple()
1611 InvalidatePreds(*BBI.BB); in IfConvertSimple()
1619 bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) { in IfConvertTriangle() argument
1620 BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; in IfConvertTriangle()
1621 BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; in IfConvertTriangle()
1626 SmallVector<MachineOperand, 4> Cond(BBI.BrCond.begin(), BBI.BrCond.end()); in IfConvertTriangle()
1635 BBI.IsAnalyzed = false; in IfConvertTriangle()
1653 if (PBB == BBI.BB) in IfConvertTriangle()
1679 BBNext = MBPI->getEdgeProbability(BBI.BB, &NextMBB); in IfConvertTriangle()
1680 BBCvt = MBPI->getEdgeProbability(BBI.BB, &CvtMBB); in IfConvertTriangle()
1685 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertTriangle()
1690 CopyAndPredicateBlock(BBI, *CvtBBI, Cond, true); in IfConvertTriangle()
1697 MergeBlocks(BBI, *CvtBBI, false); in IfConvertTriangle()
1701 BBI.BB->removeSuccessor(&CvtMBB, true); in IfConvertTriangle()
1716 auto NewTrueBB = getNextBlock(*BBI.BB); in IfConvertTriangle()
1718 auto NewTrueBBIter = find(BBI.BB->successors(), NewTrueBB); in IfConvertTriangle()
1719 if (NewTrueBBIter != BBI.BB->succ_end()) in IfConvertTriangle()
1720 BBI.BB->setSuccProbability(NewTrueBBIter, NewNext); in IfConvertTriangle()
1723 TII->insertBranch(*BBI.BB, CvtBBI->FalseBB, nullptr, RevCond, dl); in IfConvertTriangle()
1724 BBI.BB->addSuccessor(CvtBBI->FalseBB, NewFalse); in IfConvertTriangle()
1731 bool isFallThrough = canFallThroughTo(*BBI.BB, NextMBB); in IfConvertTriangle()
1739 MergeBlocks(BBI, *NextBBI); in IfConvertTriangle()
1742 InsertUncondBranch(*BBI.BB, NextMBB, TII); in IfConvertTriangle()
1743 BBI.HasFallThrough = false; in IfConvertTriangle()
1752 BBI.IsDone = true; in IfConvertTriangle()
1753 InvalidatePreds(*BBI.BB); in IfConvertTriangle()
1774 BBInfo &BBI, BBInfo &TrueBBI, BBInfo &FalseBBI, in IfConvertDiamondCommon() argument
1782 BBI.IsAnalyzed = false; in IfConvertDiamondCommon()
1797 SmallVector<MachineOperand, 4> RevCond(BBI.BrCond.begin(), BBI.BrCond.end()); in IfConvertDiamondCommon()
1800 SmallVector<MachineOperand, 4> *Cond1 = &BBI.BrCond; in IfConvertDiamondCommon()
1818 BBI.NonPredSize -= TII->removeBranch(*BBI.BB); in IfConvertDiamondCommon()
1871 BBI.BB->splice(BBI.BB->end(), &MBB1, MBB1.begin(), DI1); in IfConvertDiamondCommon()
2002 MergeBlocks(BBI, *BBI1, MergeAddEdges); in IfConvertDiamondCommon()
2003 MergeBlocks(BBI, *BBI2, MergeAddEdges); in IfConvertDiamondCommon()
2010 BBInfo &BBI, IfcvtKind Kind, in IfConvertForkedDiamond() argument
2013 BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; in IfConvertForkedDiamond()
2014 BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; in IfConvertForkedDiamond()
2025 BBI, TrueBBI, FalseBBI, in IfConvertForkedDiamond()
2033 TII->insertBranch(*BBI.BB, TrueBBI.TrueBB, TrueBBI.FalseBB, in IfConvertForkedDiamond()
2037 BBI.IsDone = TrueBBI.IsDone = FalseBBI.IsDone = true; in IfConvertForkedDiamond()
2038 InvalidatePreds(*BBI.BB); in IfConvertForkedDiamond()
2045 bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind, in IfConvertDiamond() argument
2048 BBInfo &TrueBBI = BBAnalysis[BBI.TrueBB->getNumber()]; in IfConvertDiamond()
2049 BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()]; in IfConvertDiamond()
2060 BBI, TrueBBI, FalseBBI, in IfConvertDiamond()
2074 BBI.BB->removeSuccessor(TrueBBI.BB); in IfConvertDiamond()
2075 BBI.BB->removeSuccessor(FalseBBI.BB, true); in IfConvertDiamond()
2083 MachineBasicBlock::const_iterator TI = BBI.BB->getFirstTerminator(); in IfConvertDiamond()
2084 if (TI != BBI.BB->end() && TII->isPredicated(*TI)) in IfConvertDiamond()
2097 MergeBlocks(BBI, TailBBI); in IfConvertDiamond()
2100 BBI.BB->addSuccessor(TailBB, BranchProbability::getOne()); in IfConvertDiamond()
2101 InsertUncondBranch(*BBI.BB, *TailBB, TII); in IfConvertDiamond()
2102 BBI.HasFallThrough = false; in IfConvertDiamond()
2107 BBI.IsDone = TrueBBI.IsDone = FalseBBI.IsDone = true; in IfConvertDiamond()
2108 InvalidatePreds(*BBI.BB); in IfConvertDiamond()
2135 void IfConverter::PredicateBlock(BBInfo &BBI, in PredicateBlock() argument
2141 for (MachineInstr &I : make_range(BBI.BB->begin(), E)) { in PredicateBlock()
2166 BBI.Predicate.append(Cond.begin(), Cond.end()); in PredicateBlock()
2168 BBI.IsAnalyzed = false; in PredicateBlock()
2169 BBI.NonPredSize = 0; in PredicateBlock()