use of com.dat3m.dartagnan.program.analysis.Dependency in project Dat3M by hernanponcedeleon.
the class BasicRegRelation method mkTupleSets.
private void mkTupleSets() {
maxTupleSet = new TupleSet();
minTupleSet = new TupleSet();
Dependency dep = analysisContext.requires(Dependency.class);
for (Event regReader : getEvents()) {
for (Register register : getRegisters(regReader)) {
Dependency.State r = dep.of(regReader, register);
for (Event regWriter : r.may) {
maxTupleSet.add(new Tuple(regWriter, regReader));
}
for (Event regWriter : r.must) {
minTupleSet.add(new Tuple(regWriter, regReader));
}
}
}
}
use of com.dat3m.dartagnan.program.analysis.Dependency in project Dat3M by hernanponcedeleon.
the class AnalysisTest method dependencyMustOverride.
@Test
public void dependencyMustOverride() throws InvalidConfigurationException {
ProgramBuilder b = new ProgramBuilder(SourceLanguage.LITMUS);
b.initThread(0);
Register r0 = b.getOrCreateRegister(0, "r0", ARCH_PRECISION);
Register r1 = b.getOrCreateRegister(0, "r1", ARCH_PRECISION);
Register r2 = b.getOrCreateRegister(0, "r2", ARCH_PRECISION);
Label alt = b.getOrCreateLabel("alt");
b.addChild(0, newJump(new BNonDet(ARCH_PRECISION), alt));
Local e0 = newLocal(r0, value(1));
b.addChild(0, e0);
Local e1 = newLocal(r1, r0);
b.addChild(0, e1);
Label join = b.getOrCreateLabel("join");
b.addChild(0, newGoto(join));
b.addChild(0, alt);
Local e2 = newLocal(r1, value(2));
b.addChild(0, e2);
b.addChild(0, join);
Local e3 = newLocal(r2, r0);
b.addChild(0, e3);
Local e4 = newLocal(r2, r1);
b.addChild(0, e4);
Local e5 = newLocal(r0, r2);
b.addChild(0, e5);
Program program = b.build();
LoopUnrolling.newInstance().run(program);
Compilation.newInstance().run(program);
Configuration config = Configuration.defaultConfiguration();
Context context = Context.create();
context.register(BranchEquivalence.class, BranchEquivalence.fromConfig(program, config));
context.register(ExecutionAnalysis.class, ExecutionAnalysis.fromConfig(program, context, config));
Dependency dep = Dependency.fromConfig(program, context, config);
assertTrue(dep.of(e1, r0).initialized);
assertList(dep.of(e1, r0).may, e0);
assertList(dep.of(e1, r0).must, e0);
assertFalse(dep.of(e3, r0).initialized);
assertList(dep.of(e3, r0).may, e0);
assertList(dep.of(e3, r0).must, e0);
assertTrue(dep.of(e4, r1).initialized);
assertList(dep.of(e4, r1).may, e1, e2);
assertList(dep.of(e4, r1).must, e1, e2);
assertTrue(dep.of(e5, r2).initialized);
assertList(dep.of(e5, r2).may, e4);
assertList(dep.of(e5, r2).must, e4);
}
Aggregations