bool mergeCandidates(CoalescingCandidateInfo &SourceRegion,
CoalescingCandidateInfo &TargetRegion);
- bool canMoveToBeginning(const MachineInstr &MI,
+ bool canMoveToBeginning(const MachineInstr &MI,
const MachineBasicBlock &MBB) const;
- bool canMoveToEnd(const MachineInstr &MI,
+ bool canMoveToEnd(const MachineInstr &MI,
const MachineBasicBlock &MBB) const;
bool canMerge(CoalescingCandidateInfo &SourceRegion,
CoalescingCandidateInfo &TargetRegion) const;
assert(Cand.BranchBlock->canFallThrough() &&
"Expecting the block to fall through!");
- // We have already ensured there are exactly two successors to
- // BranchBlock and that BranchTargetBlock is a successor to BranchBlock.
+ // We have already ensured there are exactly two successors to
+ // BranchBlock and that BranchTargetBlock is a successor to BranchBlock.
// Ensure the single fall though block is empty.
- MachineBasicBlock *Succ =
+ MachineBasicBlock *Succ =
(*Cand.BranchBlock->succ_begin() == Cand.BranchTargetBlock)
? *Cand.BranchBlock->succ_rbegin()
: *Cand.BranchBlock->succ_begin();
}
if (!Succ->isSuccessor(Cand.BranchTargetBlock)) {
- DEBUG(dbgs()
+ DEBUG(dbgs()
<< "Successor of fall through block is not branch taken block\n");
return false;
}
}
///
-/// Moves ALL PHI instructions in SourceMBB to beginning of TargetMBB
-/// and update them to refer to the new block. PHI node ordering
+/// Moves ALL PHI instructions in SourceMBB to beginning of TargetMBB
+/// and update them to refer to the new block. PHI node ordering
/// cannot be assumed so it does not matter where the PHI instructions
/// are moved to in TargetMBB.
///
///
/// This function checks if MI can be moved to the beginning of the TargetMBB
-/// following PHI instructions. A MI instruction can be moved to beginning of
+/// following PHI instructions. A MI instruction can be moved to beginning of
/// the TargetMBB if there are no uses of it within the TargetMBB PHI nodes.
///
/// \param[in] MI the machine instruction to move.
/// \param[in] TargetMBB the machine basic block to move to
-/// \return true if it is safe to move MI to beginning of TargetMBB,
+/// \return true if it is safe to move MI to beginning of TargetMBB,
/// false otherwise.
///
-bool BranchCoalescing::canMoveToBeginning(const MachineInstr &MI,
+bool BranchCoalescing::canMoveToBeginning(const MachineInstr &MI,
const MachineBasicBlock &TargetMBB
) const {
- DEBUG(dbgs() << "Checking if " << MI << " can move to beginning of "
+ DEBUG(dbgs() << "Checking if " << MI << " can move to beginning of "
<< TargetMBB.getNumber() << "\n");
for (auto &Def : MI.defs()) { // Looking at Def
///
/// This function checks if MI can be moved to the end of the TargetMBB,
/// immediately before the first terminator. A MI instruction can be moved
-/// to then end of the TargetMBB if no PHI node defines what MI uses within
+/// to then end of the TargetMBB if no PHI node defines what MI uses within
/// it's own MBB.
///
/// \param[in] MI the machine instruction to move.
/// \param[in] TargetMBB the machine basic block to move to
-/// \return true if it is safe to move MI to end of TargetMBB,
+/// \return true if it is safe to move MI to end of TargetMBB,
/// false otherwise.
///
-bool BranchCoalescing::canMoveToEnd(const MachineInstr &MI,
+bool BranchCoalescing::canMoveToEnd(const MachineInstr &MI,
const MachineBasicBlock &TargetMBB
) const {
- DEBUG(dbgs() << "Checking if " << MI << " can move to end of "
+ DEBUG(dbgs() << "Checking if " << MI << " can move to end of "
<< TargetMBB.getNumber() << "\n");
for (auto &Use : MI.uses()) {
MachineInstr *DefInst = MRI->getVRegDef(Use.getReg());
if (DefInst->isPHI() && DefInst->getParent() == MI.getParent()) {
DEBUG(dbgs() << " *** Cannot move this instruction ***\n");
- return false;
- } else {
- DEBUG(dbgs() << " *** def is in another block -- safe to move!\n");
+ return false;
+ } else {
+ DEBUG(dbgs() << " *** def is in another block -- safe to move!\n");
}
}
}
/// Merging involves moving the instructions in the
/// TargetRegion.BranchTargetBlock (also SourceRegion.BranchBlock).
///
-/// This function first try to move instructions from the
-/// TargetRegion.BranchTargetBlock down, to the beginning of the
+/// This function first try to move instructions from the
+/// TargetRegion.BranchTargetBlock down, to the beginning of the
/// SourceRegion.BranchTargetBlock. This is not possible if any register defined
/// in TargetRegion.BranchTargetBlock is used in a PHI node in the
/// SourceRegion.BranchTargetBlock. In this case, check whether the statement
/// be merged.
///
/// Note that there is no analysis for moving instructions past the fall-through
-/// blocks because they are confirmed to be empty. An assert is thrown if they
+/// blocks because they are confirmed to be empty. An assert is thrown if they
/// are not.
///
/// \param[in] SourceRegion The candidate to move statements from
assert(TargetRegion.FallThroughBlock->empty() &&
"FallThroughBlocks should be empty!");
- // Transfer successor information and move PHIs down to the
+ // Transfer successor information and move PHIs down to the
// branch-taken block.
TargetRegion.FallThroughBlock->transferSuccessorsAndUpdatePHIs(
SourceRegion.FallThroughBlock);