Search in sources :

Example 1 with Dependency

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));
            }
        }
    }
}
Also used : TupleSet(com.dat3m.dartagnan.wmm.utils.TupleSet) Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event) Dependency(com.dat3m.dartagnan.program.analysis.Dependency) Tuple(com.dat3m.dartagnan.wmm.utils.Tuple)

Example 2 with Dependency

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);
}
Also used : Context(com.dat3m.dartagnan.verification.Context) Program(com.dat3m.dartagnan.program.Program) Configuration(org.sosy_lab.common.configuration.Configuration) Register(com.dat3m.dartagnan.program.Register) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Dependency(com.dat3m.dartagnan.program.analysis.Dependency) Test(org.junit.Test)

Aggregations

Register (com.dat3m.dartagnan.program.Register)2 Dependency (com.dat3m.dartagnan.program.analysis.Dependency)2 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)1 Program (com.dat3m.dartagnan.program.Program)1 Event (com.dat3m.dartagnan.program.event.core.Event)1 Context (com.dat3m.dartagnan.verification.Context)1 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)1 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)1 Test (org.junit.Test)1 Configuration (org.sosy_lab.common.configuration.Configuration)1