Lines Matching refs:MBB
67 unsigned postOffset(const MachineBasicBlock &MBB) const { in postOffset()
69 const Align Alignment = MBB.getAlignment(); in postOffset()
70 const Align ParentAlign = MBB.getParent()->getAlignment(); in postOffset()
100 uint64_t computeBlockSize(const MachineBasicBlock &MBB) const;
127 for (MachineBasicBlock &MBB : *MF) { in INITIALIZE_PASS()
128 const unsigned Num = MBB.getNumber(); in INITIALIZE_PASS()
129 assert(!Num || BlockInfo[PrevNum].postOffset(MBB) <= BlockInfo[Num].Offset); in INITIALIZE_PASS()
130 assert(BlockInfo[Num].Size == computeBlockSize(MBB)); in INITIALIZE_PASS()
139 for (auto &MBB : *MF) { in dumpBBs()
140 const BasicBlockInfo &BBI = BlockInfo[MBB.getNumber()]; in dumpBBs()
141 dbgs() << format("%%bb.%u\toffset=%08x\t", MBB.getNumber(), BBI.Offset) in dumpBBs()
157 for (MachineBasicBlock &MBB : *MF) in scanFunction()
158 BlockInfo[MBB.getNumber()].Size = computeBlockSize(MBB); in scanFunction()
165 uint64_t BranchRelaxation::computeBlockSize(const MachineBasicBlock &MBB) const { in computeBlockSize()
167 for (const MachineInstr &MI : MBB) in computeBlockSize()
176 const MachineBasicBlock *MBB = MI.getParent(); in getInstrOffset() local
181 unsigned Offset = BlockInfo[MBB->getNumber()].Offset; in getInstrOffset()
184 for (MachineBasicBlock::const_iterator I = MBB->begin(); &*I != &MI; ++I) { in getInstrOffset()
185 assert(I != MBB->end() && "Didn't find MI in its own basic block?"); in getInstrOffset()
194 for (auto &MBB : in adjustBlockOffsets() local
196 unsigned Num = MBB.getNumber(); in adjustBlockOffsets()
199 BlockInfo[Num].Offset = BlockInfo[PrevNum].postOffset(MBB); in adjustBlockOffsets()
297 MachineBasicBlock *MBB = MI.getParent(); in fixupConditionalBranch() local
302 auto insertUncondBranch = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
304 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
306 TII->insertUnconditionalBranch(*MBB, DestBB, DL, &NewBrSize); in fixupConditionalBranch()
309 auto insertBranch = [&](MachineBasicBlock *MBB, MachineBasicBlock *TBB, in fixupConditionalBranch() argument
312 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
314 TII->insertBranch(*MBB, TBB, FBB, Cond, DL, &NewBrSize); in fixupConditionalBranch()
317 auto removeBranch = [&](MachineBasicBlock *MBB) { in fixupConditionalBranch() argument
318 unsigned &BBSize = BlockInfo[MBB->getNumber()].Size; in fixupConditionalBranch()
320 TII->removeBranch(*MBB, &RemovedSize); in fixupConditionalBranch()
324 auto finalizeBlockChanges = [&](MachineBasicBlock *MBB, in fixupConditionalBranch()
327 adjustBlockOffsets(*MBB); in fixupConditionalBranch()
334 bool Fail = TII->analyzeBranch(*MBB, TBB, FBB, Cond); in fixupConditionalBranch()
358 << MBB->back()); in fixupConditionalBranch()
360 removeBranch(MBB); in fixupConditionalBranch()
361 insertBranch(MBB, FBB, TBB, Cond); in fixupConditionalBranch()
362 finalizeBlockChanges(MBB, nullptr); in fixupConditionalBranch()
368 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
373 MBB->replaceSuccessor(FBB, NewBB); in fixupConditionalBranch()
379 MachineBasicBlock &NextBB = *std::next(MachineFunction::iterator(MBB)); in fixupConditionalBranch()
385 removeBranch(MBB); in fixupConditionalBranch()
387 insertBranch(MBB, &NextBB, TBB, Cond); in fixupConditionalBranch()
389 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
395 << " Insert a new BB after " << MBB->back()); in fixupConditionalBranch()
398 FBB = &(*std::next(MachineFunction::iterator(MBB))); in fixupConditionalBranch()
411 NewBB = createNewBlockAfter(*MBB); in fixupConditionalBranch()
422 MBB->replaceSuccessor(TBB, NewBB); in fixupConditionalBranch()
426 removeBranch(MBB); in fixupConditionalBranch()
427 insertBranch(MBB, NewBB, FBB, Cond); in fixupConditionalBranch()
429 finalizeBlockChanges(MBB, NewBB); in fixupConditionalBranch()
434 MachineBasicBlock *MBB = MI.getParent(); in fixupUnconditionalBranch() local
444 BlockInfo[MBB->getNumber()].Size -= OldBrSize; in fixupUnconditionalBranch()
446 MachineBasicBlock *BranchBB = MBB; in fixupUnconditionalBranch()
450 if (!MBB->empty()) { in fixupUnconditionalBranch()
451 BranchBB = createNewBlockAfter(*MBB); in fixupUnconditionalBranch()
454 for (const MachineBasicBlock *Succ : MBB->successors()) { in fixupUnconditionalBranch()
461 MBB->replaceSuccessor(DestBB, BranchBB); in fixupUnconditionalBranch()
469 adjustBlockOffsets(*MBB); in fixupUnconditionalBranch()
479 MachineBasicBlock &MBB = *I; in relaxBranchInstructions() local
482 MachineBasicBlock::iterator Last = MBB.getLastNonDebugInstr(); in relaxBranchInstructions()
483 if (Last == MBB.end()) in relaxBranchInstructions()
505 for (MachineBasicBlock::iterator J = MBB.getFirstTerminator(); in relaxBranchInstructions()
506 J != MBB.end(); J = Next) { in relaxBranchInstructions()
520 if (Next != MBB.end() && Next->isConditionalBranch()) { in relaxBranchInstructions()
534 Next = MBB.getFirstTerminator(); in relaxBranchInstructions()