diff options
| author | Dan Gohman <gohman@apple.com> | 2009-03-31 18:39:13 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-03-31 18:39:13 +0000 | 
| commit | 6b42dfddf48a42c0258aa704e51f78328e43cd80 (patch) | |
| tree | 628550b5a61f4ce265bbb809c6ddced1edd03ee4 /llvm | |
| parent | aa59489b18f2520264e6427cda4caf440d6b00b3 (diff) | |
| download | bcm5719-llvm-6b42dfddf48a42c0258aa704e51f78328e43cd80.tar.gz bcm5719-llvm-6b42dfddf48a42c0258aa704e51f78328e43cd80.zip  | |
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.
llvm-svn: 68129
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineBasicBlock.h | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 5 | 
3 files changed, 19 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h index 1ba7e798f83..134d22663b0 100644 --- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -253,6 +253,11 @@ public:    /// 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); } diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 51f0f9d0001..5ac54ea8a44 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -123,6 +123,16 @@ MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() {    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());  } diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 3bdcf88365f..3b6b0efec5a 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -238,7 +238,10 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {    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';      }  | 

