[llvm-commits] CVS: llvm/lib/Target/TargetInstrInfo.cpp
Evan Cheng
evan.cheng at apple.com
Wed May 16 14:20:56 PDT 2007
Changes in directory llvm/lib/Target:
TargetInstrInfo.cpp updated: 1.26 -> 1.27
---
Log message:
Add default implementation of PredicateInstruction().
---
Diffs of the changes: (+20 -0)
TargetInstrInfo.cpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
Index: llvm/lib/Target/TargetInstrInfo.cpp
diff -u llvm/lib/Target/TargetInstrInfo.cpp:1.26 llvm/lib/Target/TargetInstrInfo.cpp:1.27
--- llvm/lib/Target/TargetInstrInfo.cpp:1.26 Fri Dec 8 12:45:14 2006
+++ llvm/lib/Target/TargetInstrInfo.cpp Wed May 16 16:20:37 2007
@@ -59,3 +59,23 @@
MI->getOperand(1).unsetIsKill();
return MI;
}
+
+void TargetInstrInfo::PredicateInstruction(MachineInstr *MI,
+ std::vector<MachineOperand> &Cond) const {
+ const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
+ assert((TID->Flags & M_PREDICABLE) &&
+ "Predicating an unpredicable instruction!");
+
+ for (unsigned j = 0, i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) {
+ MachineOperand &MO = MI->getOperand(i);
+ if (MO.isReg())
+ MO.setReg(Cond[j].getReg());
+ else if (MO.isImm())
+ MO.setImm(Cond[j].getImmedValue());
+ else if (MO.isMBB())
+ MO.setMachineBasicBlock(Cond[j].getMachineBasicBlock());
+ ++j;
+ }
+ }
+}
More information about the llvm-commits
mailing list