[llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrInfo.h

Chris Lattner sabre at nondot.org
Sat Oct 28 10:30:13 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86InstrInfo.cpp updated: 1.69 -> 1.70
X86InstrInfo.h updated: 1.58 -> 1.59
---
Log message:

add another target hook for branch folding.


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

 X86InstrInfo.cpp |   12 ++++++++++++
 X86InstrInfo.h   |    1 +
 2 files changed, 13 insertions(+)


Index: llvm/lib/Target/X86/X86InstrInfo.cpp
diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.69 llvm/lib/Target/X86/X86InstrInfo.cpp:1.70
--- llvm/lib/Target/X86/X86InstrInfo.cpp:1.69	Sat Oct 21 00:52:40 2006
+++ llvm/lib/Target/X86/X86InstrInfo.cpp	Sat Oct 28 12:29:57 2006
@@ -420,6 +420,18 @@
   BuildMI(&MBB, X86::JMP, 1).addMBB(FBB);
 }
 
+bool X86InstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const {
+  if (MBB.empty()) return false;
+  
+  switch (MBB.back().getOpcode()) {
+  case X86::JMP:     // Uncond branch.
+  case X86::JMP32r:  // Indirect branch.
+  case X86::JMP32m:  // Indirect branch through mem.
+    return true;
+  default: return false;
+  }
+}
+
 bool X86InstrInfo::
 ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
   assert(Cond.size() == 1 && "Invalid X86 branch condition!");


Index: llvm/lib/Target/X86/X86InstrInfo.h
diff -u llvm/lib/Target/X86/X86InstrInfo.h:1.58 llvm/lib/Target/X86/X86InstrInfo.h:1.59
--- llvm/lib/Target/X86/X86InstrInfo.h:1.58	Sat Oct 21 00:52:40 2006
+++ llvm/lib/Target/X86/X86InstrInfo.h	Sat Oct 28 12:29:57 2006
@@ -267,6 +267,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;
 
   const TargetRegisterClass *getPointerRegClass() const;






More information about the llvm-commits mailing list