本文整理汇总了C++中MachineBasicBlock::updateTerminator方法的典型用法代码示例。如果您正苦于以下问题:C++ MachineBasicBlock::updateTerminator方法的具体用法?C++ MachineBasicBlock::updateTerminator怎么用?C++ MachineBasicBlock::updateTerminator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MachineBasicBlock
的用法示例。
在下文中一共展示了MachineBasicBlock::updateTerminator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DebugLoc
/// Split the basic block containing MI into two blocks, which are joined by
/// an unconditional branch. Update data structures and renumber blocks to
/// account for this change and returns the newly created block.
MachineBasicBlock *BranchRelaxation::splitBlockBeforeInstr(MachineInstr &MI,
MachineBasicBlock *DestBB) {
MachineBasicBlock *OrigBB = MI.getParent();
// Create a new MBB for the code after the OrigBB.
MachineBasicBlock *NewBB =
MF->CreateMachineBasicBlock(OrigBB->getBasicBlock());
MF->insert(++OrigBB->getIterator(), NewBB);
// Splice the instructions starting with MI over to NewBB.
NewBB->splice(NewBB->end(), OrigBB, MI.getIterator(), OrigBB->end());
// Add an unconditional branch from OrigBB to NewBB.
// Note the new unconditional branch is not being recorded.
// There doesn't seem to be meaningful DebugInfo available; this doesn't
// correspond to anything in the source.
TII->insertUnconditionalBranch(*OrigBB, NewBB, DebugLoc());
// Insert an entry into BlockInfo to align it properly with the block numbers.
BlockInfo.insert(BlockInfo.begin() + NewBB->getNumber(), BasicBlockInfo());
NewBB->transferSuccessors(OrigBB);
OrigBB->addSuccessor(NewBB);
OrigBB->addSuccessor(DestBB);
// Cleanup potential unconditional branch to successor block.
// Note that updateTerminator may change the size of the blocks.
NewBB->updateTerminator();
OrigBB->updateTerminator();
// Figure out how large the OrigBB is. As the first half of the original
// block, it cannot contain a tablejump. The size includes
// the new jump we added. (It should be possible to do this without
// recounting everything, but it's very confusing, and this is rarely
// executed.)
BlockInfo[OrigBB->getNumber()].Size = computeBlockSize(*OrigBB);
// Figure out how large the NewMBB is. As the second half of the original
// block, it may contain a tablejump.
BlockInfo[NewBB->getNumber()].Size = computeBlockSize(*NewBB);
// All BBOffsets following these blocks must be modified.
adjustBlockOffsets(*OrigBB);
// Need to fix live-in lists if we track liveness.
if (TRI->trackLivenessAfterRegAlloc(*MF))
computeLiveIns(LiveRegs, *TRI, *NewBB);
++NumSplit;
return NewBB;
}
示例2: updateTerminators
void LoopSplitter::updateTerminators(MachineBasicBlock &mbb) {
mbb.updateTerminator();
for (MachineBasicBlock::iterator miItr = mbb.begin(), miEnd = mbb.end();
miItr != miEnd; ++miItr) {
if (lis->isNotInMIMap(miItr)) {
lis->InsertMachineInstrInMaps(miItr);
}
}
}
示例3: getDestBlock
bool AArch64BranchRelaxation::relaxBranchInstructions() {
bool Changed = false;
// Relaxing branches involves creating new basic blocks, so re-eval
// end() for termination.
for (MachineFunction::iterator I = MF->begin(); I != MF->end(); ++I) {
MachineBasicBlock &MBB = *I;
MachineBasicBlock::iterator J = MBB.getFirstTerminator();
if (J == MBB.end())
continue;
MachineBasicBlock::iterator Next;
for (MachineBasicBlock::iterator J = MBB.getFirstTerminator();
J != MBB.end(); J = Next) {
Next = std::next(J);
MachineInstr &MI = *J;
if (MI.isConditionalBranch()) {
MachineBasicBlock *DestBB = getDestBlock(MI);
if (!isBlockInRange(MI, *DestBB)) {
if (Next != MBB.end() && Next->isConditionalBranch()) {
// If there are multiple conditional branches, this isn't an
// analyzable block. Split later terminators into a new block so
// each one will be analyzable.
MachineBasicBlock *NewBB = splitBlockBeforeInstr(*Next);
NewBB->transferSuccessors(&MBB);
MBB.addSuccessor(NewBB);
MBB.addSuccessor(DestBB);
// Cleanup potential unconditional branch to successor block.
NewBB->updateTerminator();
MBB.updateTerminator();
} else {
fixupConditionalBranch(MI);
++NumConditionalRelaxed;
}
Changed = true;
// This may have modified all of the terminators, so start over.
Next = MBB.getFirstTerminator();
}
}
}
}
return Changed;
}