diff options
author | Jozef Kolek <jozef.kolek@imgtec.com> | 2014-11-21 22:04:35 +0000 |
---|---|---|
committer | Jozef Kolek <jozef.kolek@imgtec.com> | 2014-11-21 22:04:35 +0000 |
commit | 3b8ddb665bb332f0dd484db44ec93da927caa7df (patch) | |
tree | cd7f6929c8cee6304bf9740e9eb3b243cf63bd49 /llvm/lib/Target/Mips/MipsLongBranch.cpp | |
parent | fb0011cf1acae89c56447d13daf40fa43216d892 (diff) | |
download | bcm5719-llvm-3b8ddb665bb332f0dd484db44ec93da927caa7df.tar.gz bcm5719-llvm-3b8ddb665bb332f0dd484db44ec93da927caa7df.zip |
[mips][microMIPS] This patch implements functionality in MIPS delay slot
filler such as if delay slot filler have to put NOP instruction into the
delay slot of microMIPS BEQ or BNE instruction which uses the register $0,
then instead of emitting NOP this instruction is replaced by the corresponding
microMIPS compact branch instruction, i.e. BEQZC or BNEZC.
Differential Revision: http://reviews.llvm.org/D3566
llvm-svn: 222580
Diffstat (limited to 'llvm/lib/Target/Mips/MipsLongBranch.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MipsLongBranch.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Target/Mips/MipsLongBranch.cpp b/llvm/lib/Target/Mips/MipsLongBranch.cpp index e44d6eea843..cf267c94f5e 100644 --- a/llvm/lib/Target/Mips/MipsLongBranch.cpp +++ b/llvm/lib/Target/Mips/MipsLongBranch.cpp @@ -237,11 +237,13 @@ void MipsLongBranch::replaceBranch(MachineBasicBlock &MBB, Iter Br, MIB.addMBB(MBBOpnd); - // Bundle the instruction in the delay slot to the newly created branch - // and erase the original branch. - assert(Br->isBundledWithSucc()); - MachineBasicBlock::instr_iterator II(Br); - MIBundleBuilder(&*MIB).append((++II)->removeFromBundle()); + if (Br->hasDelaySlot()) { + // Bundle the instruction in the delay slot to the newly created branch + // and erase the original branch. + assert(Br->isBundledWithSucc()); + MachineBasicBlock::instr_iterator II(Br); + MIBundleBuilder(&*MIB).append((++II)->removeFromBundle()); + } Br->eraseFromParent(); } |