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

Chris Lattner sabre at nondot.org
Fri Oct 20 23:03:25 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCInstrInfo.cpp updated: 1.27 -> 1.28
---
Log message:

Implement support for branch reversal, fix a bug in branch analysis.
This provides stuff like:

        cmpw cr0, r15, r29
        mr r14, r15
-       bge cr0, LBB3_111       ;bb656
-       b LBB3_90       ;bb501
+       blt cr0, LBB3_90        ;bb501
 LBB3_111:      ;bb656
        lwz r18, 68(r1)

which is particularly good for dispatch group formation.



---
Diffs of the changes:  (+5 -2)

 PPCInstrInfo.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.27 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.28
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.27	Sat Oct 21 00:42:09 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp	Sat Oct 21 01:03:11 2006
@@ -186,7 +186,7 @@
       TBB = LastInst->getOperand(2).getMachineBasicBlock();
       Cond.push_back(LastInst->getOperand(0));
       Cond.push_back(LastInst->getOperand(1));
-      return true;
+      return false;
     }
     // Otherwise, don't know what this is.
     return true;
@@ -261,5 +261,8 @@
 
 bool PPCInstrInfo::
 ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
-  return true;
+  assert(Cond.size() == 2 && "Invalid PPC branch opcode!");
+  // Leave the CR# the same, but invert the condition.
+  Cond[1].setImm(invertPPCBranchOpcode(Cond[1].getImm()));
+  return false;
 }






More information about the llvm-commits mailing list