forked from OSchip/llvm-project
Instead of printing unnecessary basic block labels as labels in
verbose-asm mode, print comments instead. This eliminates a non-comment difference between verbose-asm mode and non-verbose-asm mode. Also, factor out the relevant code out of all the targets and into target-independent code. llvm-svn: 83392
This commit is contained in:
parent
92e3a06623
commit
10d3dc569b
|
@ -1623,8 +1623,15 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
|||
if (unsigned Align = MBB->getAlignment())
|
||||
EmitAlignment(Log2_32(Align));
|
||||
|
||||
GetMBBSymbol(MBB->getNumber())->print(O, MAI);
|
||||
O << ':';
|
||||
if (MBB->pred_empty() || MBB->isOnlyReachableByFallthrough()) {
|
||||
if (VerboseAsm)
|
||||
O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
|
||||
} else {
|
||||
GetMBBSymbol(MBB->getNumber())->print(O, MAI);
|
||||
O << ':';
|
||||
if (!VerboseAsm)
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
if (VerboseAsm) {
|
||||
if (const BasicBlock *BB = MBB->getBasicBlock())
|
||||
|
@ -1635,6 +1642,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
|||
}
|
||||
|
||||
EmitComments(*MBB);
|
||||
O << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,6 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
|
|
@ -171,7 +171,6 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
I != E; ++I) {
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
|
|
@ -135,13 +135,7 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
I != E; ++I) {
|
||||
// Print a label for the basic block.
|
||||
if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
|
||||
// This is an entry block or a block that's only reachable via a
|
||||
// fallthrough edge. In non-VerboseAsm mode, don't print the label.
|
||||
} else {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
EmitBasicBlockStart(I);
|
||||
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
|
|
@ -460,7 +460,6 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
|
|
@ -124,13 +124,7 @@ bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
I != E; ++I) {
|
||||
// Print a label for the basic block.
|
||||
if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
|
||||
// This is an entry block or a block that's only reachable via a
|
||||
// fallthrough edge. In non-VerboseAsm mode, don't print the label.
|
||||
} else {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
EmitBasicBlockStart(I);
|
||||
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II)
|
||||
|
|
|
@ -273,7 +273,6 @@ bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
|
|
|
@ -98,7 +98,6 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
// Print a basic block.
|
||||
|
|
|
@ -660,7 +660,6 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
@ -844,7 +843,6 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
|
||||
II != IE; ++II) {
|
||||
|
|
|
@ -119,7 +119,6 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
|
|
|
@ -129,13 +129,7 @@ bool SystemZAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
I != E; ++I) {
|
||||
// Print a label for the basic block.
|
||||
if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
|
||||
// This is an entry block or a block that's only reachable via a
|
||||
// fallthrough edge. In non-VerboseAsm mode, don't print the label.
|
||||
} else {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
EmitBasicBlockStart(I);
|
||||
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II)
|
||||
|
|
|
@ -165,13 +165,7 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
I != E; ++I) {
|
||||
// Print a label for the basic block.
|
||||
if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
|
||||
// This is an entry block or a block that's only reachable via a
|
||||
// fallthrough edge. In non-VerboseAsm mode, don't print the label.
|
||||
} else {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
EmitBasicBlockStart(I);
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
|
||||
II != IE; ++II) {
|
||||
// Print the assembly for the instruction.
|
||||
|
|
|
@ -274,7 +274,6 @@ bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF)
|
|||
// Print a label for the basic block.
|
||||
if (I != MF.begin()) {
|
||||
EmitBasicBlockStart(I);
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
|
|
|
@ -7,7 +7,7 @@ define i32 @test(i32 %argc, i8** %argv) nounwind {
|
|||
entry:
|
||||
; CHECK: cmpl $2
|
||||
; CHECK-NEXT: je
|
||||
; CHECK-NEXT: LBB1_1
|
||||
; CHECK-NEXT: %entry
|
||||
|
||||
switch i32 %argc, label %UnifiedReturnBlock [
|
||||
i32 1, label %bb
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=LINUX
|
||||
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic -asm-verbose=false | FileCheck %s -check-prefix=LINUX
|
||||
|
||||
@ptr = external global i32*
|
||||
@dst = external global i32
|
||||
|
@ -12,7 +12,6 @@ entry:
|
|||
ret void
|
||||
|
||||
; LINUX: test1:
|
||||
; LINUX: .LBB1_0:
|
||||
; LINUX: call .L1$pb
|
||||
; LINUX-NEXT: .L1$pb:
|
||||
; LINUX-NEXT: popl
|
||||
|
|
Loading…
Reference in New Issue