Lines Matching refs:TailBB
86 void ProcessPHI(MachineInstr *MI, MachineBasicBlock *TailBB,
93 MachineBasicBlock *TailBB,
103 bool IsSimple, MachineBasicBlock &TailBB);
104 bool isSimpleBB(MachineBasicBlock *TailBB);
106 bool duplicateSimpleBB(MachineBasicBlock *TailBB,
110 bool TailDuplicate(MachineBasicBlock *TailBB,
214 // TailBB's immediate successors are now successors of those predecessors
215 // which duplicated TailBB. Add the predecessors as sources to the PHI
382 /// ProcessPHI - Process PHI node in TailBB by turning it into a copy in PredBB.
386 MachineInstr *MI, MachineBasicBlock *TailBB, MachineBasicBlock *PredBB,
401 if (isDefLiveOut(DefReg, TailBB, MRI) || RegsUsedByPhi.count(DefReg))
414 /// DuplicateInstruction - Duplicate a TailBB instruction to PredBB and update
417 MachineBasicBlock *TailBB,
435 if (isDefLiveOut(Reg, TailBB, MRI) || UsedByPhi.count(Reg))
538 MachineBasicBlock &TailBB) {
540 if (TailBB.canFallThrough())
544 if (TailBB.isSuccessor(&TailBB))
565 if (!TailBB.empty())
566 HasIndirectbr = TailBB.back().isIndirectBranch();
574 for (MachineBasicBlock::iterator I = TailBB.begin(); I != TailBB.end(); ++I) {
607 return canCompletelyDuplicateBB(TailBB);
612 TailDuplicatePass::isSimpleBB(MachineBasicBlock *TailBB) {
613 if (TailBB->succ_size() != 1)
615 if (TailBB->pred_empty())
617 MachineBasicBlock::iterator I = TailBB->begin();
618 MachineBasicBlock::iterator E = TailBB->end();
662 TailDuplicatePass::duplicateSimpleBB(MachineBasicBlock *TailBB,
666 SmallPtrSet<MachineBasicBlock*, 8> Succs(TailBB->succ_begin(),
667 TailBB->succ_end());
668 SmallVector<MachineBasicBlock*, 8> Preds(TailBB->pred_begin(),
669 TailBB->pred_end());
688 << "From simple Succ: " << *TailBB);
690 MachineBasicBlock *NewTarget = *TailBB->succ_begin();
704 if (PredFBB == TailBB)
706 if (PredTBB == TailBB)
726 PredBB->removeSuccessor(TailBB);
737 /// TailDuplicate - If it is profitable, duplicate TailBB's contents in each
740 TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB,
745 DEBUG(dbgs() << "\n*** Tail-duplicating BB#" << TailBB->getNumber() << '\n');
748 getRegsUsedByPHIs(*TailBB, &UsedByPhi);
751 return duplicateSimpleBB(TailBB, TDBBs, UsedByPhi, Copies);
757 SmallSetVector<MachineBasicBlock*, 8> Preds(TailBB->pred_begin(),
758 TailBB->pred_end());
763 assert(TailBB != PredBB &&
776 if (PredBB->isLayoutSuccessor(TailBB) && PredBB->canFallThrough())
780 << "From Succ: " << *TailBB);
787 if (RS && !TailBB->livein_empty()) {
794 for (MachineBasicBlock::livein_iterator I = TailBB->livein_begin(),
795 E = TailBB->livein_end(); I != E; ++I) {
804 // Clone the contents of TailBB into PredBB.
809 MachineBasicBlock::instr_iterator I = TailBB->instr_begin();
810 while (I != TailBB->instr_end()) {
816 ProcessPHI(MI, TailBB, PredBB, LocalVRMap, CopyInfos, UsedByPhi, true);
820 DuplicateInstruction(MI, TailBB, PredBB, MF, LocalVRMap, UsedByPhi);
833 NumInstrDups += TailBB->size() - 1; // subtract one for removed branch
839 for (MachineBasicBlock::succ_iterator I = TailBB->succ_begin(),
840 E = TailBB->succ_end(); I != E; ++I)
847 // If TailBB was duplicated into all its predecessors except for the prior
850 MachineBasicBlock *PrevBB = prior(MachineFunction::iterator(TailBB));
857 PriorCond.empty() && !PriorTBB && TailBB->pred_size() == 1 &&
858 !TailBB->hasAddressTaken()) {
860 << "From MBB: " << *TailBB);
864 MachineBasicBlock::iterator I = TailBB->begin();
866 while (I != TailBB->end() && I->isPHI()) {
870 ProcessPHI(MI, TailBB, PrevBB, LocalVRMap, CopyInfos, UsedByPhi, true);
876 while (I != TailBB->end()) {
881 DuplicateInstruction(MI, TailBB, PrevBB, MF, LocalVRMap, UsedByPhi);
893 PrevBB->splice(PrevBB->end(), TailBB, TailBB->begin(), TailBB->end());
897 TailBB);
937 MachineBasicBlock::iterator I = TailBB->begin();
939 while (I != TailBB->end() && I->isPHI()) {
943 ProcessPHI(MI, TailBB, PredBB, LocalVRMap, CopyInfos, UsedByPhi, false);