diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-06 17:38:38 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-06 17:38:38 +0000 |
commit | e3cc3f3c84abfdf8eb3bd19dfa806ceea49f15d6 (patch) | |
tree | cf632431a5862f4e5b082c6fb51c706037c27299 | |
parent | 6cf4963cdc33f06031ebf86e0606afa4b79ccde5 (diff) | |
download | external_llvm-e3cc3f3c84abfdf8eb3bd19dfa806ceea49f15d6.zip external_llvm-e3cc3f3c84abfdf8eb3bd19dfa806ceea49f15d6.tar.gz external_llvm-e3cc3f3c84abfdf8eb3bd19dfa806ceea49f15d6.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83392 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 | ||||
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp | 8 | ||||
-rw-r--r-- | lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp | 8 | ||||
-rw-r--r-- | lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp | 8 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp | 8 | ||||
-rw-r--r-- | lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp | 1 | ||||
-rw-r--r-- | test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/X86/pic.ll | 3 |
15 files changed, 16 insertions, 42 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 00f3980..f149f10 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -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'; } } diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index cb241dc..bdaae22 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index fd4a99a..d8e8b79 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp index 9807fd2..91fd5dd 100644 --- a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp +++ b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index c334e50..0f8d539 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp index b6d268d..ad40fd4 100644 --- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp @@ -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) diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 2159555..ccf9ee5 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -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(); diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp index 60ad2c7..3f415af 100644 --- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp @@ -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. diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 8ac9305..a0fba86 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index bf479a4..a3e5fba 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -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) { diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp index 89d365ce..a128992 100644 --- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp +++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp @@ -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) diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index f753594..2a0290d 100644 --- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -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. diff --git a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp index a4b1d11..e58edda 100644 --- a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp @@ -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(); diff --git a/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll b/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll index 4fd8072..88e8b4a 100644 --- a/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll +++ b/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll @@ -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 diff --git a/test/CodeGen/X86/pic.ll b/test/CodeGen/X86/pic.ll index e9218ed..3a547f9 100644 --- a/test/CodeGen/X86/pic.ll +++ b/test/CodeGen/X86/pic.ll @@ -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 |