use of com.dat3m.dartagnan.wmm.utils.TupleSet 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.wmm.utils.TupleSet 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.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelUnion method encodeApprox.
@Override
protected BooleanFormula encodeApprox(SolverContext ctx) {
BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
BooleanFormula enc = bmgr.makeTrue();
TupleSet min = getMinTupleSet();
for (Tuple tuple : encodeTupleSet) {
if (min.contains(tuple)) {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), getExecPair(tuple, ctx)));
continue;
}
BooleanFormula opt1 = r1.getSMTVar(tuple, ctx);
BooleanFormula opt2 = r2.getSMTVar(tuple, ctx);
if (Relation.PostFixApprox) {
enc = bmgr.and(enc, bmgr.implication(bmgr.or(opt1, opt2), this.getSMTVar(tuple, ctx)));
} else {
enc = bmgr.and(enc, bmgr.equivalence(this.getSMTVar(tuple, ctx), bmgr.or(opt1, opt2)));
}
}
return enc;
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelDomainIdentity method addEncodeTupleSet.
@Override
public void addEncodeTupleSet(TupleSet tuples) {
TupleSet activeSet = new TupleSet(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
encodeTupleSet.addAll(activeSet);
activeSet.removeAll(getMinTupleSet());
// TODO: Optimize using minSets (but no CAT uses this anyway)
if (!activeSet.isEmpty()) {
TupleSet r1Set = new TupleSet();
for (Tuple tuple : activeSet) {
r1Set.addAll(r1.getMaxTupleSet().getByFirst(tuple.getFirst()));
}
r1.addEncodeTupleSet(r1Set);
}
}
use of com.dat3m.dartagnan.wmm.utils.TupleSet in project Dat3M by hernanponcedeleon.
the class RelInverse method addEncodeTupleSet.
@Override
public void addEncodeTupleSet(TupleSet tuples) {
TupleSet activeSet = new TupleSet(Sets.intersection(Sets.difference(tuples, encodeTupleSet), maxTupleSet));
encodeTupleSet.addAll(activeSet);
activeSet.removeAll(getMinTupleSet());
if (!activeSet.isEmpty()) {
r1.addEncodeTupleSet(activeSet.inverse());
}
}
Aggregations