Changes in directory llvm/lib/Target:
TargetInstrInfo.cpp updated: 1.27 -> 1.28 --- Log message: PredicateInstruction returns true if the operation was successful. --- Diffs of the changes: (+19 -14) TargetInstrInfo.cpp | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) Index: llvm/lib/Target/TargetInstrInfo.cpp diff -u llvm/lib/Target/TargetInstrInfo.cpp:1.27 llvm/lib/Target/TargetInstrInfo.cpp:1.28 --- llvm/lib/Target/TargetInstrInfo.cpp:1.27 Wed May 16 16:20:37 2007 +++ llvm/lib/Target/TargetInstrInfo.cpp Wed May 16 16:52:35 2007 @@ -60,22 +60,27 @@ return MI; } -void TargetInstrInfo::PredicateInstruction(MachineInstr *MI, +bool TargetInstrInfo::PredicateInstruction(MachineInstr *MI, std::vector<MachineOperand> &Cond) const { + bool MadeChange = false; 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; + if (TID->Flags & M_PREDICABLE) { + 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()); + MadeChange = true; + } else if (MO.isImm()) { + MO.setImm(Cond[j].getImmedValue()); + MadeChange = true; + } else if (MO.isMBB()) { + MO.setMachineBasicBlock(Cond[j].getMachineBasicBlock()); + MadeChange = true; + } + ++j; + } } } + return MadeChange; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits