summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-09-13 17:12:37 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-09-13 17:12:37 +0000
commitfcdd9b120d1be866bfa4ad3736789b3c7a8aac92 (patch)
tree1f6d2c90914e3a4954109c0d569e15a7c8b84a29 /llvm/lib
parent78b9f8fc67fce74976ec1107ccd30789451aec8d (diff)
downloadbcm5719-llvm-fcdd9b120d1be866bfa4ad3736789b3c7a8aac92.tar.gz
bcm5719-llvm-fcdd9b120d1be866bfa4ad3736789b3c7a8aac92.zip
mips16: When copying operands in a conditional branch instruction, allow for
immediate operands to be copied. Patch by Reed Kotler. llvm-svn: 163811
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsInstrInfo.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.cpp b/llvm/lib/Target/Mips/MipsInstrInfo.cpp
index 8ade891ab5e..ca80d43f36f 100644
--- a/llvm/lib/Target/Mips/MipsInstrInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsInstrInfo.cpp
@@ -95,6 +95,7 @@ bool MipsInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
SmallVectorImpl<MachineOperand> &Cond,
bool AllowModify) const
{
+
MachineBasicBlock::reverse_iterator I = MBB.rbegin(), REnd = MBB.rend();
// Skip all the debug instructions.
@@ -177,9 +178,14 @@ void MipsInstrInfo::BuildCondBr(MachineBasicBlock &MBB,
const MCInstrDesc &MCID = get(Opc);
MachineInstrBuilder MIB = BuildMI(&MBB, DL, MCID);
- for (unsigned i = 1; i < Cond.size(); ++i)
- MIB.addReg(Cond[i].getReg());
-
+ for (unsigned i = 1; i < Cond.size(); ++i) {
+ if (Cond[i].isReg())
+ MIB.addReg(Cond[i].getReg());
+ else if (Cond[i].isImm())
+ MIB.addImm(Cond[i].getImm());
+ else
+ assert(true && "Cannot copy operand");
+ }
MIB.addMBB(TBB);
}
OpenPOWER on IntegriCloud