Пример #1
0
bool PatmosInstrInfo::NegatePredicate(MachineInstr *MI) const
{
  if (!MI->isPredicable(MachineInstr::AnyInBundle)) return false;

  if (MI->isBundle()) {
    MachineBasicBlock::instr_iterator II = MI;
    while (II->isBundledWithSucc()) {
      ++II;
      NegatePredicate(&*II);
    }
    return true;
  }

  int i = MI->findFirstPredOperandIdx();
  assert(i != -1);
  MachineOperand &PO2 = MI->getOperand(i+1);
  assert(PO2.isImm() && "Unexpected Patmos predicate operand");

  bool flag = (PO2.getImm() != 0) ^ 1;
  PO2.setImm(flag);

  return true;
}