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 | a0746bd50aa960e100eb6a94ecded3ac15242da6 (patch) | |
tree | f783b6b0a10a1a6018417d199e43e2c090f4f2e4 /llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp | |
parent | aea0620b893059a0a3d7b9d8ff6a3ff0ae9eb022 (diff) | |
download | bcm5719-llvm-a0746bd50aa960e100eb6a94ecded3ac15242da6.tar.gz bcm5719-llvm-a0746bd50aa960e100eb6a94ecded3ac15242da6.zip |
Allow target to place 2-address pass inserted copies in better spots. Thumb2 will use this to try to avoid breaking up IT blocks.
llvm-svn: 105745
Diffstat (limited to 'llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp b/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp index fb33f887340..691444cdc02 100644 --- a/llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp +++ b/llvm/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; } |