use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelCartesian method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
List<Event> l1 = task.getProgram().getCache().getEvents(filter1);
List<Event> l2 = task.getProgram().getCache().getEvents(filter2);
ExecutionAnalysis exec = analysisContext.get(ExecutionAnalysis.class);
for (Event e1 : l1) {
for (Event e2 : l2) {
if (!exec.areMutuallyExclusive(e1, e2)) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelCtrlDirect method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
// NOTE: If's (under Linux) have different notion of ctrl dependency than conditional jumps!
for (Thread thread : task.getProgram().getThreads()) {
for (Event e1 : thread.getCache().getEvents(FilterBasic.get(Tag.CMP))) {
for (Event e2 : ((IfAsJump) e1).getBranchesEvents()) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
// Relates jumps (except those implementing Ifs and their internal jump to end) with all later events
List<Event> condJumps = thread.getCache().getEvents(FilterMinus.get(FilterBasic.get(Tag.JUMP), FilterUnion.get(FilterBasic.get(Tag.CMP), FilterBasic.get(Tag.IFI))));
if (!condJumps.isEmpty()) {
for (Event e2 : thread.getCache().getEvents(FilterBasic.get(Tag.ANY))) {
for (Event e1 : condJumps) {
if (e1.getCId() < e2.getCId()) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelRangeIdentity method encodeApprox.
@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
BooleanFormula enc = bmgr.makeTrue();
// TODO: Optimize using minSets (but no CAT uses this anyway)
for (Tuple tuple1 : encodeTupleSet) {
Event e = tuple1.getFirst();
BooleanFormula opt = bmgr.makeFalse();
for (Tuple tuple2 : r1.getMaxTupleSet().getBySecond(e)) {
opt = bmgr.or(r1.getSMTVar(tuple2.getFirst(), e, ctx));
}
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(e, e, ctx), opt));
}
return enc;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelTrans method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
transitiveReachabilityMap = r1.getMaxTupleSet().transMap();
maxTupleSet = new TupleSet();
for (Event e1 : transitiveReachabilityMap.keySet()) {
for (Event e2 : transitiveReachabilityMap.get(e1)) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.
the class RelTrans method encodeApprox.
@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
BooleanFormula enc = bmgr.makeTrue();
TupleSet minSet = getMinTupleSet();
TupleSet r1Max = r1.getMaxTupleSet();
for (Tuple tuple : fullEncodeTupleSet) {
if (minSet.contains(tuple)) {
if (Relation.PostFixApprox) {
enc = bmgr.and(enc, bmgr.implication(getExecPair(tuple, ctx), this.getSMTVar(tuple, ctx)));
} else {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), getExecPair(tuple, ctx)));
}
continue;
}
BooleanFormula orClause = bmgr.makeFalse();
Event e1 = tuple.getFirst();
Event e2 = tuple.getSecond();
if (r1Max.contains(tuple)) {
orClause = bmgr.or(orClause, r1.getSMTVar(tuple, ctx));
}
for (Tuple t : r1Max.getByFirst(e1)) {
Event e3 = t.getSecond();
if (e3.getCId() != e1.getCId() && e3.getCId() != e2.getCId() && transitiveReachabilityMap.get(e3).contains(e2)) {
BooleanFormula tVar = minSet.contains(t) ? this.getSMTVar(t, ctx) : r1.getSMTVar(t, ctx);
orClause = bmgr.or(orClause, bmgr.and(tVar, this.getSMTVar(e3, e2, ctx)));
}
}
if (Relation.PostFixApprox) {
enc = bmgr.and(enc, bmgr.implication(orClause, this.getSMTVar(tuple, ctx)));
} else {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), orClause));
}
}
return enc;
}
Aggregations