Lines Matching refs:MBB
66 unsigned postOffset(const MachineBasicBlock &MBB) const { in postOffset()
68 const Align Alignment = MBB.getAlignment(); in postOffset()
69 const Align ParentAlign = MBB.getParent()->getAlignment(); in postOffset()
99 uint64_t computeBlockSize(const MachineBasicBlock &MBB) const;
126 for (MachineBasicBlock &MBB : *MF) { in INITIALIZE_PASS()
127 const unsigned Num = MBB.getNumber(); in INITIALIZE_PASS()
128 assert(!Num || BlockInfo[PrevNum].postOffset(MBB) <= BlockInfo[Num].Offset); in INITIALIZE_PASS()
129 assert(BlockInfo[Num].Size == computeBlockSize(MBB)); in INITIALIZE_PASS()
138 for (auto &MBB : *MF) { in dumpBBs()
139 const BasicBlockInfo &BBI = BlockInfo[MBB.getNumber()]; in dumpBBs()
140 dbgs() << format("%%bb.%u\toffset=%08x\t", MBB.getNumber(), BBI.Offset) in dumpBBs()
156 for (MachineBasicBlock &MBB : *MF) in scanFunction()
157 BlockInfo[MBB.getNumber()].Size = computeBlockSize(MBB); in scanFunction()
164 uint64_t BranchRelaxation::computeBlockSize(const MachineBasicBlock &MBB) const { in computeBlockSize()
166 for (const MachineInstr &MI : MBB) in computeBlockSize()
175 const MachineBasicBlock *MBB = MI.getParent(); in getInstrOffset() local
180 unsigned Offset = BlockInfo[MBB->getNumber()].Offset; in getInstrOffset()
183 for (MachineBasicBlock::const_iterator I = MBB->begin(); &*I != &MI; ++I) { in getInstrOffset()
184 assert(I != MBB->end() && "Didn't find MI in its own basic block?"); in getInstrOffset()
193 for (auto &MBB : in adjustBlockOffsets() local
195 unsigned Num = MBB.getNumber(); in adjustBlockOffsets()
198 BlockInfo[Num].Offset = BlockInfo[PrevNum].postOffset(MBB); in adjustBlockOffsets()
296 MachineBasicBlock *MBB = MI.getParent(); in fixupConditionalBranch() local
301 auto insertUncondBranch = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
303 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
305 TII->insertUnconditionalBranch(*MBB, DestBB, DL, &NewBrSize); in fixupConditionalBranch()
308 auto insertBranch = [&](MachineBasicBlock *MBB, MachineBasicBlock *TBB, in fixupConditionalBranch() argument
311 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
313 TII->insertBranch(*MBB, TBB, FBB, Cond, DL, &NewBrSize); in fixupConditionalBranch()
316 auto removeBranch = [&](MachineBasicBlock *MBB) { in fixupConditionalBranch() argument
317 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
319 TII->removeBranch(*MBB, &RemovedSize); in fixupConditionalBranch()
323 auto finalizeBlockChanges = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
326 adjustBlockOffsets(*MBB); in fixupConditionalBranch()
333 bool Fail = TII->analyzeBranch(*MBB, TBB, FBB, Cond); in fixupConditionalBranch()
357 << MBB->back()); in fixupConditionalBranch()
359 removeBranch(MBB); in fixupConditionalBranch()
360 insertBranch(MBB, FBB, TBB, Cond); in fixupConditionalBranch()
361 finalizeBlockChanges(MBB, nullptr); in fixupConditionalBranch()
367 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
372 MBB->replaceSuccessor(FBB, NewBB); in fixupConditionalBranch()
378 MachineBasicBlock &NextBB = *std::next(MachineFunction::iterator(MBB)); in fixupConditionalBranch()
384 removeBranch(MBB); in fixupConditionalBranch()
386 insertBranch(MBB, &NextBB, TBB, Cond); in fixupConditionalBranch()
388 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
394 << " Insert a new BB after " << MBB->back()); in fixupConditionalBranch()
397 FBB = &(*std::next(MachineFunction::iterator(MBB))); in fixupConditionalBranch()
410 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
421 MBB->replaceSuccessor(TBB, NewBB); in fixupConditionalBranch()
425 removeBranch(MBB); in fixupConditionalBranch()
426 insertBranch(MBB, NewBB, FBB, Cond); in fixupConditionalBranch()
428 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
433 MachineBasicBlock *MBB = MI.getParent(); in fixupUnconditionalBranch() local
443 BlockInfo[MBB->getNumber()].Size -= OldBrSize; in fixupUnconditionalBranch()
445 MachineBasicBlock *BranchBB = MBB; in fixupUnconditionalBranch()
449 if (!MBB->empty()) { in fixupUnconditionalBranch()
450 BranchBB = createNewBlockAfter(*MBB); in fixupUnconditionalBranch()
453 for (const MachineBasicBlock *Succ : MBB->successors()) { in fixupUnconditionalBranch()
460 MBB->replaceSuccessor(DestBB, BranchBB); in fixupUnconditionalBranch()
475 adjustBlockOffsets(*MBB); in fixupUnconditionalBranch()
515 for (MachineBasicBlock &MBB : *MF) { in relaxBranchInstructions()
517 MachineBasicBlock::iterator Last = MBB.getLastNonDebugInstr(); in relaxBranchInstructions()
518 if (Last == MBB.end()) in relaxBranchInstructions()
540 for (MachineBasicBlock::iterator J = MBB.getFirstTerminator(); in relaxBranchInstructions()
541 J != MBB.end(); J = Next) { in relaxBranchInstructions()
555 if (Next != MBB.end() && Next->isConditionalBranch()) { in relaxBranchInstructions()
569 Next = MBB.getFirstTerminator(); in relaxBranchInstructions()