use of dartagnan.program.MemEvent in project Dat3M by hernanponcedeleon.
the class Encodings method encodeReachedState.
public static BoolExpr encodeReachedState(Program p, Model model, Context ctx) {
Set<Location> locs = p.getEvents().stream().filter(e -> e instanceof MemEvent).map(e -> e.getLoc()).collect(Collectors.toSet());
BoolExpr reachedState = ctx.mkTrue();
for (Location loc : locs) {
reachedState = ctx.mkAnd(reachedState, ctx.mkEq(lastValueLoc(loc, ctx), model.getConstInterp(lastValueLoc(loc, ctx))));
}
Set<Event> executedEvents = p.getEvents().stream().filter(e -> model.getConstInterp(e.executes(ctx)).isTrue()).collect(Collectors.toSet());
Set<Register> regs = executedEvents.stream().filter(e -> e instanceof Local | e instanceof Load).map(e -> e.getReg()).collect(Collectors.toSet());
for (Register reg : regs) {
reachedState = ctx.mkAnd(reachedState, ctx.mkEq(lastValueReg(reg, ctx), model.getConstInterp(lastValueReg(reg, ctx))));
}
return reachedState;
}
Aggregations