Lines Matching refs:BB
122 bool BranchProbabilityInfo::calcUnreachableHeuristics(BasicBlock *BB) { in calcUnreachableHeuristics() argument
123 TerminatorInst *TI = BB->getTerminator(); in calcUnreachableHeuristics()
126 PostDominatedByUnreachable.insert(BB); in calcUnreachableHeuristics()
133 for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { in calcUnreachableHeuristics()
143 PostDominatedByUnreachable.insert(BB); in calcUnreachableHeuristics()
154 PostDominatedByUnreachable.insert(BB); in calcUnreachableHeuristics()
165 setEdgeWeight(BB, *I, UnreachableWeight); in calcUnreachableHeuristics()
175 setEdgeWeight(BB, *I, ReachableWeight); in calcUnreachableHeuristics()
182 bool BranchProbabilityInfo::calcMetadataWeights(BasicBlock *BB) { in calcMetadataWeights() argument
183 TerminatorInst *TI = BB->getTerminator(); in calcMetadataWeights()
228 setEdgeWeight(BB, i, W); in calcMetadataWeights()
244 bool BranchProbabilityInfo::calcColdCallHeuristics(BasicBlock *BB) { in calcColdCallHeuristics() argument
245 TerminatorInst *TI = BB->getTerminator(); in calcColdCallHeuristics()
252 for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) in calcColdCallHeuristics()
261 PostDominatedByColdCall.insert(BB); in calcColdCallHeuristics()
265 assert(!PostDominatedByColdCall.count(BB)); in calcColdCallHeuristics()
266 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) in calcColdCallHeuristics()
269 PostDominatedByColdCall.insert(BB); in calcColdCallHeuristics()
283 setEdgeWeight(BB, *I, ColdWeight); in calcColdCallHeuristics()
292 setEdgeWeight(BB, *I, NormalWeight); in calcColdCallHeuristics()
299 bool BranchProbabilityInfo::calcPointerHeuristics(BasicBlock *BB) { in calcPointerHeuristics() argument
300 BranchInst * BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcPointerHeuristics()
325 setEdgeWeight(BB, TakenIdx, PH_TAKEN_WEIGHT); in calcPointerHeuristics()
326 setEdgeWeight(BB, NonTakenIdx, PH_NONTAKEN_WEIGHT); in calcPointerHeuristics()
332 bool BranchProbabilityInfo::calcLoopBranchHeuristics(BasicBlock *BB, in calcLoopBranchHeuristics() argument
334 Loop *L = LI.getLoopFor(BB); in calcLoopBranchHeuristics()
342 for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { in calcLoopBranchHeuristics()
361 setEdgeWeight(BB, *EI, backWeight); in calcLoopBranchHeuristics()
372 setEdgeWeight(BB, *EI, inWeight); in calcLoopBranchHeuristics()
383 setEdgeWeight(BB, *EI, exitWeight); in calcLoopBranchHeuristics()
390 bool BranchProbabilityInfo::calcZeroHeuristics(BasicBlock *BB) { in calcZeroHeuristics() argument
391 BranchInst * BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcZeroHeuristics()
466 setEdgeWeight(BB, TakenIdx, ZH_TAKEN_WEIGHT); in calcZeroHeuristics()
467 setEdgeWeight(BB, NonTakenIdx, ZH_NONTAKEN_WEIGHT); in calcZeroHeuristics()
472 bool BranchProbabilityInfo::calcFloatingPointHeuristics(BasicBlock *BB) { in calcFloatingPointHeuristics() argument
473 BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); in calcFloatingPointHeuristics()
502 setEdgeWeight(BB, TakenIdx, FPH_TAKEN_WEIGHT); in calcFloatingPointHeuristics()
503 setEdgeWeight(BB, NonTakenIdx, FPH_NONTAKEN_WEIGHT); in calcFloatingPointHeuristics()
508 bool BranchProbabilityInfo::calcInvokeHeuristics(BasicBlock *BB) { in calcInvokeHeuristics() argument
509 InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()); in calcInvokeHeuristics()
513 setEdgeWeight(BB, 0/*Index for Normal*/, IH_TAKEN_WEIGHT); in calcInvokeHeuristics()
514 setEdgeWeight(BB, 1/*Index for Unwind*/, IH_NONTAKEN_WEIGHT); in calcInvokeHeuristics()
535 uint32_t BranchProbabilityInfo::getSumForBlock(const BasicBlock *BB) const { in getSumForBlock()
538 for (succ_const_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { in getSumForBlock()
539 uint32_t Weight = getEdgeWeight(BB, I.getSuccessorIndex()); in getSumForBlock()
556 BasicBlock *BranchProbabilityInfo::getHotSucc(BasicBlock *BB) const { in getHotSucc()
561 for (succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) { in getHotSucc()
563 uint32_t Weight = getEdgeWeight(BB, Succ); in getHotSucc()
688 for (auto BB : post_order(&F.getEntryBlock())) { in calculate() local
689 DEBUG(dbgs() << "Computing probabilities for " << BB->getName() << "\n"); in calculate()
690 if (calcUnreachableHeuristics(BB)) in calculate()
692 if (calcMetadataWeights(BB)) in calculate()
694 if (calcColdCallHeuristics(BB)) in calculate()
696 if (calcLoopBranchHeuristics(BB, LI)) in calculate()
698 if (calcPointerHeuristics(BB)) in calculate()
700 if (calcZeroHeuristics(BB)) in calculate()
702 if (calcFloatingPointHeuristics(BB)) in calculate()
704 calcInvokeHeuristics(BB); in calculate()