mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Add default implementation of PredicateInstruction().
llvm-svn: 37123
This commit is contained in:
parent
6f761adecb
commit
30f3168b7b
@ -59,3 +59,23 @@ MachineInstr *TargetInstrInfo::commuteInstruction(MachineInstr *MI) const {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user