implement the BlockHasNoFallThrough hook
authorChris Lattner <sabre@nondot.org>
Sat, 28 Oct 2006 17:35:02 +0000 (17:35 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Oct 2006 17:35:02 +0000 (17:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31264 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCInstrInfo.h

index 63188466bed4b72b43eab7b91d36b25506f65c72..9876e3cdad8e5e069e4a0ebeab3f2f2a79025761 100644 (file)
@@ -259,6 +259,17 @@ void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
   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 dc16aed4dc282e9b5cf8b0ed5aa207311c0d9e64..769474b503d3f40d13f40c1c91005a3685e1ca44 100644 (file)
@@ -110,6 +110,7 @@ public:
   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;