Lines Matching refs:MBB
67 unsigned postOffset(const MachineBasicBlock &MBB) const { in postOffset()
69 unsigned Align = MBB.getAlignment(); in postOffset()
74 unsigned ParentAlign = MBB.getParent()->getAlignment(); in postOffset()
104 uint64_t computeBlockSize(const MachineBasicBlock &MBB) const;
131 for (MachineBasicBlock &MBB : *MF) { in INITIALIZE_PASS()
132 unsigned Align = MBB.getAlignment(); in INITIALIZE_PASS()
133 unsigned Num = MBB.getNumber(); in INITIALIZE_PASS()
135 assert(!Num || BlockInfo[PrevNum].postOffset(MBB) <= BlockInfo[Num].Offset); in INITIALIZE_PASS()
136 assert(BlockInfo[Num].Size == computeBlockSize(MBB)); in INITIALIZE_PASS()
145 for (auto &MBB : *MF) { in dumpBBs()
146 const BasicBlockInfo &BBI = BlockInfo[MBB.getNumber()]; in dumpBBs()
147 dbgs() << format("%bb.%u\toffset=%08x\t", MBB.getNumber(), BBI.Offset) in dumpBBs()
163 for (MachineBasicBlock &MBB : *MF) in scanFunction()
164 BlockInfo[MBB.getNumber()].Size = computeBlockSize(MBB); in scanFunction()
171 uint64_t BranchRelaxation::computeBlockSize(const MachineBasicBlock &MBB) const { in computeBlockSize()
173 for (const MachineInstr &MI : MBB) in computeBlockSize()
182 const MachineBasicBlock *MBB = MI.getParent(); in getInstrOffset() local
187 unsigned Offset = BlockInfo[MBB->getNumber()].Offset; in getInstrOffset()
190 for (MachineBasicBlock::const_iterator I = MBB->begin(); &*I != &MI; ++I) { in getInstrOffset()
191 assert(I != MBB->end() && "Didn't find MI in its own basic block?"); in getInstrOffset()
200 for (auto &MBB : make_range(MachineFunction::iterator(Start), MF->end())) { in adjustBlockOffsets() local
201 unsigned Num = MBB.getNumber(); in adjustBlockOffsets()
206 BlockInfo[Num].Offset = BlockInfo[PrevNum].postOffset(MBB); in adjustBlockOffsets()
305 MachineBasicBlock *MBB = MI.getParent(); in fixupConditionalBranch() local
310 auto insertUncondBranch = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
312 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
314 TII->insertUnconditionalBranch(*MBB, DestBB, DL, &NewBrSize); in fixupConditionalBranch()
317 auto insertBranch = [&](MachineBasicBlock *MBB, MachineBasicBlock *TBB, in fixupConditionalBranch() argument
320 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
322 TII->insertBranch(*MBB, TBB, FBB, Cond, DL, &NewBrSize); in fixupConditionalBranch()
325 auto removeBranch = [&](MachineBasicBlock *MBB) { in fixupConditionalBranch() argument
326 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
328 TII->removeBranch(*MBB, &RemovedSize); in fixupConditionalBranch()
332 auto finalizeBlockChanges = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
335 adjustBlockOffsets(*MBB); in fixupConditionalBranch()
342 bool Fail = TII->analyzeBranch(*MBB, TBB, FBB, Cond); in fixupConditionalBranch()
366 << MBB->back()); in fixupConditionalBranch()
368 removeBranch(MBB); in fixupConditionalBranch()
369 insertBranch(MBB, FBB, TBB, Cond); in fixupConditionalBranch()
370 finalizeBlockChanges(MBB, nullptr); in fixupConditionalBranch()
376 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
381 MBB->replaceSuccessor(FBB, NewBB); in fixupConditionalBranch()
387 MachineBasicBlock &NextBB = *std::next(MachineFunction::iterator(MBB)); in fixupConditionalBranch()
393 removeBranch(MBB); in fixupConditionalBranch()
395 insertBranch(MBB, &NextBB, TBB, Cond); in fixupConditionalBranch()
397 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
403 << " Insert a new BB after " << MBB->back()); in fixupConditionalBranch()
406 FBB = &(*std::next(MachineFunction::iterator(MBB))); in fixupConditionalBranch()
419 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
430 MBB->replaceSuccessor(TBB, NewBB); in fixupConditionalBranch()
434 removeBranch(MBB); in fixupConditionalBranch()
435 insertBranch(MBB, NewBB, FBB, Cond); in fixupConditionalBranch()
437 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
442 MachineBasicBlock *MBB = MI.getParent(); in fixupUnconditionalBranch() local
452 BlockInfo[MBB->getNumber()].Size -= OldBrSize; in fixupUnconditionalBranch()
454 MachineBasicBlock *BranchBB = MBB; in fixupUnconditionalBranch()
458 if (!MBB->empty()) { in fixupUnconditionalBranch()
459 BranchBB = createNewBlockAfter(*MBB); in fixupUnconditionalBranch()
462 for (const MachineBasicBlock *Succ : MBB->successors()) { in fixupUnconditionalBranch()
469 MBB->replaceSuccessor(DestBB, BranchBB); in fixupUnconditionalBranch()
477 adjustBlockOffsets(*MBB); in fixupUnconditionalBranch()
487 MachineBasicBlock &MBB = *I; in relaxBranchInstructions() local
490 MachineBasicBlock::iterator Last = MBB.getLastNonDebugInstr(); in relaxBranchInstructions()
491 if (Last == MBB.end()) in relaxBranchInstructions()
513 for (MachineBasicBlock::iterator J = MBB.getFirstTerminator(); in relaxBranchInstructions()
514 J != MBB.end(); J = Next) { in relaxBranchInstructions()
521 if (Next != MBB.end() && Next->isConditionalBranch()) { in relaxBranchInstructions()
535 Next = MBB.getFirstTerminator(); in relaxBranchInstructions()