summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-21 05:36:13 +0000
committerChris Lattner <sabre@nondot.org>2006-10-21 05:36:13 +0000
commit94e04442eb7faf291dedc294308ed3eb6b6ac4c5 (patch)
treeaec716f6f79c605b0f569b252838480a1881d1cb /llvm/lib
parent6fca75ec0525e29e6fd06eee1dbaf3de244ba44f (diff)
downloadbcm5719-llvm-94e04442eb7faf291dedc294308ed3eb6b6ac4c5.tar.gz
bcm5719-llvm-94e04442eb7faf291dedc294308ed3eb6b6ac4c5.zip
implement support for inserting a cond branch
llvm-svn: 31096
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/PowerPC/PPCInstrInfo.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 9bf0746a2a2..941229dc386 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -240,15 +240,19 @@ void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
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);
OpenPOWER on IntegriCloud