Hoist common code out of if statement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152153 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2012-03-06 22:27:13 +00:00
parent c0fc450f07
commit c511c2827d

View File

@ -2085,20 +2085,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
OutStreamer.EmitLabel(Syms[i]); OutStreamer.EmitLabel(Syms[i]);
} }
// Print the main label for the block. // Print some verbose block comments.
if (MBB->pred_empty() || isBlockOnlyReachableByFallthrough(MBB)) {
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
if (const BasicBlock *BB = MBB->getBasicBlock())
if (BB->hasName())
OutStreamer.AddComment("%" + BB->getName());
EmitBasicBlockLoopComments(*MBB, LI, *this);
// NOTE: Want this comment at start of line, don't emit with AddComment.
OutStreamer.EmitRawText(Twine(MAI->getCommentString()) + " BB#" +
Twine(MBB->getNumber()) + ":");
}
} else {
if (isVerbose()) { if (isVerbose()) {
if (const BasicBlock *BB = MBB->getBasicBlock()) if (const BasicBlock *BB = MBB->getBasicBlock())
if (BB->hasName()) if (BB->hasName())
@ -2106,6 +2093,14 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
EmitBasicBlockLoopComments(*MBB, LI, *this); EmitBasicBlockLoopComments(*MBB, LI, *this);
} }
// Print the main label for the block.
if (MBB->pred_empty() || isBlockOnlyReachableByFallthrough(MBB)) {
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
// NOTE: Want this comment at start of line, don't emit with AddComment.
OutStreamer.EmitRawText(Twine(MAI->getCommentString()) + " BB#" +
Twine(MBB->getNumber()) + ":");
}
} else {
OutStreamer.EmitLabel(MBB->getSymbol()); OutStreamer.EmitLabel(MBB->getSymbol());
} }
} }