Changes in directory llvm/lib/Target/PowerPC:
PPCInstrInfo.cpp updated: 1.37 -> 1.38 PPCInstrInfo.h updated: 1.21 -> 1.22 --- Log message: RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted. --- Diffs of the changes: (+16 -13) PPCInstrInfo.cpp | 21 ++++++++++++--------- PPCInstrInfo.h | 8 ++++---- 2 files changed, 16 insertions(+), 13 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.37 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.38 --- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.37 Wed Apr 25 02:12:14 2007 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Thu May 17 19:05:48 2007 @@ -224,30 +224,32 @@ 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 @@ 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 { Index: llvm/lib/Target/PowerPC/PPCInstrInfo.h diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.21 llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.22 --- llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.21 Fri Jan 26 08:34:51 2007 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.h Thu May 17 19:05:48 2007 @@ -99,10 +99,10 @@ virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, std::vector<MachineOperand> &Cond) const; - virtual void RemoveBranch(MachineBasicBlock &MBB) const; - virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, - MachineBasicBlock *FBB, - const std::vector<MachineOperand> &Cond) const; + virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; + virtual unsigned 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; }; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits