public static Optional<ConditionSolver> convertToSolver(AssumeInstruction assumeInstruction) {
public class Visitor extends AbstractInstructionVisitor {
public ConditionSolver solver = null;
@Override
public void assumeEq(IROperand iROperand, IROperand iROperand2, boolean bl) {
this.solver = new ConditionSolver(iROperand, iROperand2, bl ? BVCondType.NotEquals : BVCondType.Equals);
}
@Override
public void assumeGreater(IROperand iROperand, IROperand iROperand2, boolean bl, boolean bl2) {
this.solver = new ConditionSolver(iROperand, iROperand2, bl ? BVCondType.NotGreater : BVCondType.Greater);
}
@Override
public void assumeInvoke(CalledProcedureId calledProcedureId, BaseSymbol baseSymbol, boolean bl) {
}
@Override
public void assumeTrue(IROperand iROperand, boolean bl) {
AbstractConstant abstractConstant = iROperand.getSymbol().getType().isBoolean() ? BoolConstant.FALSE : NullConstant.NULL;
this.solver = new ConditionSolver(iROperand, (IROperand)abstractConstant, bl ? BVCondType.Equals : BVCondType.NotEquals);
}
}
Visitor visitor = new Visitor();
assumeInstruction.accept(visitor);
return Optional.ofNullable(visitor.solver);
}