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

Chris Lattner sabre at nondot.org
Fri Oct 20 22:36:27 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCInstrInfo.cpp updated: 1.25 -> 1.26
---
Log message:

implement support for inserting a cond branch


---
Diffs of the changes:  (+8 -4)

 PPCInstrInfo.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.25 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.26
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.25	Tue Oct 17 13:06:55 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp	Sat Oct 21 00:36:13 2006
@@ -240,15 +240,19 @@
                                 const std::vector<MachineOperand> &Cond) const {
   // Shouldn't be a fall through.
   assert(TBB && "InsertBranch must not be told to insert a fallthrough");
+  assert((Cond.size() == 2 || Cond.size() == 0) && 
+         "PPC branch conditions have two components!");
   
-  // Unconditional branch?
+  // One-way branch.
   if (FBB == 0) {
-    BuildMI(&MBB, PPC::B, 1).addMBB(TBB);
+    if (Cond.empty())   // Unconditional branch
+      BuildMI(&MBB, PPC::B, 1).addMBB(TBB);
+    else                // Conditional branch
+      BuildMI(&MBB, PPC::COND_BRANCH, 3)
+        .addReg(Cond[0].getReg()).addImm(Cond[1].getImm()).addMBB(TBB);
     return;
   }
   
-  assert(Cond.size() == 2 && "PPC branch conditions have two components!");
-  
   // Conditional branch
   BuildMI(&MBB, PPC::COND_BRANCH, 3)
     .addReg(Cond[0].getReg()).addImm(Cond[1].getImm()).addMBB(TBB);






More information about the llvm-commits mailing list