[llvm-commits] [llvm] r163811 - /llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp
Akira Hatanaka
ahatanaka at mips.com
Thu Sep 13 10:12:37 PDT 2012
Author: ahatanak
Date: Thu Sep 13 12:12:37 2012
New Revision: 163811
URL: http://llvm.org/viewvc/llvm-project?rev=163811&view=rev
Log:
mips16: When copying operands in a conditional branch instruction, allow for
immediate operands to be copied.
Patch by Reed Kotler.
Modified:
llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=163811&r1=163810&r2=163811&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Thu Sep 13 12:12:37 2012
@@ -95,6 +95,7 @@
SmallVectorImpl<MachineOperand> &Cond,
bool AllowModify) const
{
+
MachineBasicBlock::reverse_iterator I = MBB.rbegin(), REnd = MBB.rend();
// Skip all the debug instructions.
@@ -177,9 +178,14 @@
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);
}
More information about the llvm-commits
mailing list