diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-06-09 19:26:01 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-06-09 19:26:01 +0000 |
commit | 68fc2daf8fa446be04d2ed2b3cbb1b00c382458f (patch) | |
tree | 3e12cca4516e458f6afad39bf57dd77f0e54a7d5 /lib/Target/ARM/Thumb2ITBlockPass.cpp | |
parent | d64ba3ee62cc854218d9b76b9420493d82313d06 (diff) |
Allow target to place 2-address pass inserted copies in better spots. Thumb2 will use this to try to avoid breaking up IT blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Thumb2ITBlockPass.cpp')
-rw-r--r-- | lib/Target/ARM/Thumb2ITBlockPass.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Target/ARM/Thumb2ITBlockPass.cpp b/lib/Target/ARM/Thumb2ITBlockPass.cpp index fb33f88734..691444cdc0 100644 --- a/lib/Target/ARM/Thumb2ITBlockPass.cpp +++ b/lib/Target/ARM/Thumb2ITBlockPass.cpp @@ -61,15 +61,7 @@ static ARMCC::CondCodes getPredicate(const MachineInstr *MI, unsigned &PredReg){ unsigned Opc = MI->getOpcode(); if (Opc == ARM::tBcc || Opc == ARM::t2Bcc) return ARMCC::AL; - - int PIdx = MI->findFirstPredOperandIdx(); - if (PIdx == -1) { - PredReg = 0; - return ARMCC::AL; - } - - PredReg = MI->getOperand(PIdx+1).getReg(); - return (ARMCC::CondCodes)MI->getOperand(PIdx).getImm(); + return llvm::getInstrPredicate(MI, PredReg); } bool @@ -242,15 +234,15 @@ bool Thumb2ITBlockPass::InsertITBlock(MachineInstr *First, MachineInstr *Last) { // Insert a new block for consecutive predicated instructions. MachineFunction *MF = MBB->getParent(); MachineBasicBlock *NewMBB = MF->CreateMachineBasicBlock(MBB->getBasicBlock()); - MachineFunction::iterator Pos = MBB; - MF->insert(++Pos, NewMBB); + MachineFunction::iterator InsertPos = MBB; + MF->insert(++InsertPos, NewMBB); // Move all the successors of this block to the specified block. NewMBB->transferSuccessors(MBB); // Add an edge from CurMBB to NewMBB for the fall-through. MBB->addSuccessor(NewMBB); - NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); + NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); return true; } |