[llvm-commits] [llvm] r68135 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Bill Wendling
isanbard at gmail.com
Tue Mar 31 13:05:03 PDT 2009
Author: void
Date: Tue Mar 31 15:05:03 2009
New Revision: 68135
URL: http://llvm.org/viewvc/llvm-project?rev=68135&view=rev
Log:
--- Merging (from foreign repository) r68129 into '.':
U include/llvm/CodeGen/MachineBasicBlock.h
U lib/CodeGen/MachineBasicBlock.cpp
U lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Reapply 68073, with fixes. EH Landing-pad basic blocks are not
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.
Modified:
llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h
llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp
llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 15:05:03 2009
@@ -253,6 +253,11 @@
/// it returns end()
iterator getFirstTerminator();
+ /// isOnlyReachableViaFallthough - Return true if this basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ bool isOnlyReachableByFallthrough() const;
+
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp Tue Mar 31 15:05:03 2009
@@ -123,6 +123,16 @@
return I;
}
+bool
+MachineBasicBlock::isOnlyReachableByFallthrough() const {
+ return !isLandingPad() &&
+ !pred_empty() &&
+ next(pred_begin()) == pred_end() &&
+ (*pred_begin())->isLayoutSuccessor(this) &&
+ ((*pred_begin())->empty() ||
+ !(*pred_begin())->back().getDesc().isBarrier());
+}
+
void MachineBasicBlock::dump() const {
print(*cerr.stream());
}
Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 15:05:03 2009
@@ -238,7 +238,10 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!I->pred_empty()) {
+ 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 {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
More information about the llvm-commits
mailing list