diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-21 06:03:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-21 06:03:11 +0000 |
commit | 23f22de26fd1698aef82421c9ed362c9b8c4ff43 (patch) | |
tree | 56b2a562e942e695e71e7fc67ae164fe827cd51d /llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | |
parent | 28f17f45beb2285ccc32a74771e5debf94e360ec (diff) | |
download | bcm5719-llvm-23f22de26fd1698aef82421c9ed362c9b8c4ff43.tar.gz bcm5719-llvm-23f22de26fd1698aef82421c9ed362c9b8c4ff43.zip |
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.
llvm-svn: 31101
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index 76cb7ed5694..63188466bed 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -186,7 +186,7 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, 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 @@ void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 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; } |