diff options
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/ARMInstrInfo.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMInstrInfo.h | 8 |
2 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.cpp b/llvm/lib/Target/ARM/ARMInstrInfo.cpp index 891ae558f3d..5f5806d27d2 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.cpp +++ b/llvm/lib/Target/ARM/ARMInstrInfo.cpp @@ -349,33 +349,34 @@ bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, } -void ARMInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { +unsigned ARMInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { MachineFunction &MF = *MBB.getParent(); ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>(); int BOpc = AFI->isThumbFunction() ? ARM::tB : ARM::B; int BccOpc = AFI->isThumbFunction() ? ARM::tBcc : ARM::Bcc; MachineBasicBlock::iterator I = MBB.end(); - if (I == MBB.begin()) return; + if (I == MBB.begin()) return 0; --I; if (I->getOpcode() != BOpc && I->getOpcode() != BccOpc) - 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() != BccOpc) - return; + return 1; // Remove the branch. I->eraseFromParent(); + return 2; } -void ARMInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, +unsigned ARMInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, const std::vector<MachineOperand> &Cond) const { MachineFunction &MF = *MBB.getParent(); @@ -393,12 +394,13 @@ void ARMInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, BuildMI(&MBB, get(BOpc)).addMBB(TBB); else BuildMI(&MBB, get(BccOpc)).addMBB(TBB).addImm(Cond[0].getImm()); - return; + return 1; } // Two-way conditional branch. BuildMI(&MBB, get(BccOpc)).addMBB(TBB).addImm(Cond[0].getImm()); BuildMI(&MBB, get(BOpc)).addMBB(FBB); + return 2; } bool ARMInstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const { diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.h b/llvm/lib/Target/ARM/ARMInstrInfo.h index 33645b2d334..84663e75f72 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.h +++ b/llvm/lib/Target/ARM/ARMInstrInfo.h @@ -96,10 +96,10 @@ public: 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; |