[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp PPCInstrInfo.h

Chris Lattner sabre at nondot.org
Sat Oct 28 10:35:16 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCInstrInfo.cpp updated: 1.28 -> 1.29
PPCInstrInfo.h updated: 1.18 -> 1.19
---
Log message:

implement the BlockHasNoFallThrough hook


---
Diffs of the changes:  (+12 -0)

 PPCInstrInfo.cpp |   11 +++++++++++
 PPCInstrInfo.h   |    1 +
 2 files changed, 12 insertions(+)


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.28 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.29
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.28	Sat Oct 21 01:03:11 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp	Sat Oct 28 12:35:02 2006
@@ -259,6 +259,17 @@
   BuildMI(&MBB, PPC::B, 1).addMBB(FBB);
 }
 
+bool PPCInstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const {
+  if (MBB.empty()) return false;
+  
+  switch (MBB.back().getOpcode()) {
+  case PPC::B:     // Uncond branch.
+  case PPC::BCTR:  // Indirect branch.
+    return true;
+  default: return false;
+  }
+}
+
 bool PPCInstrInfo::
 ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
   assert(Cond.size() == 2 && "Invalid PPC branch opcode!");


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.h
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.18 llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.19
--- llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.18	Tue Oct 17 17:39:33 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.h	Sat Oct 28 12:35:02 2006
@@ -110,6 +110,7 @@
   virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
                             MachineBasicBlock *FBB,
                             const std::vector<MachineOperand> &Cond) const;
+  virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const;
   virtual bool ReverseBranchCondition(std::vector<MachineOperand> &Cond) const;
   
   






More information about the llvm-commits mailing list