summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-05-18 00:05:48 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-05-18 00:05:48 +0000
commit99be49dd9b3685399f85fc9e46ad010dc8c84887 (patch)
tree5613ee5bff98de4d286b8ca33bccd438e79816ce /llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
parentc0dc382fb79da0dac1a2405204e08f4da0e16504 (diff)
downloadbcm5719-llvm-99be49dd9b3685399f85fc9e46ad010dc8c84887.tar.gz
bcm5719-llvm-99be49dd9b3685399f85fc9e46ad010dc8c84887.zip
RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.
llvm-svn: 37192
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCInstrInfo.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 89b5c9c8901..e861b2e9ab9 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -224,30 +224,32 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
return true;
}
-void PPCInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
+unsigned PPCInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
MachineBasicBlock::iterator I = MBB.end();
- if (I == MBB.begin()) return;
+ if (I == MBB.begin()) return 0;
--I;
if (I->getOpcode() != PPC::B && I->getOpcode() != PPC::BCC)
- return;
+ return 0;
// Remove the branch.
I->eraseFromParent();
I = MBB.end();
- if (I == MBB.begin()) return;
+ if (I == MBB.begin()) return 1;
--I;
if (I->getOpcode() != PPC::BCC)
- return;
+ return 1;
// Remove the branch.
I->eraseFromParent();
+ return 2;
}
-void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
- MachineBasicBlock *FBB,
- const std::vector<MachineOperand> &Cond) const {
+unsigned
+PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
+ MachineBasicBlock *FBB,
+ 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) &&
@@ -260,13 +262,14 @@ void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
else // Conditional branch
BuildMI(&MBB, get(PPC::BCC))
.addImm(Cond[0].getImm()).addReg(Cond[1].getReg()).addMBB(TBB);
- return;
+ return 1;
}
// Two-way Conditional Branch.
BuildMI(&MBB, get(PPC::BCC))
.addImm(Cond[0].getImm()).addReg(Cond[1].getReg()).addMBB(TBB);
BuildMI(&MBB, get(PPC::B)).addMBB(FBB);
+ return 2;
}
bool PPCInstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const {
OpenPOWER on IntegriCloud