Search in sources :

Example 1 with LoopUnrolling

use of com.dat3m.dartagnan.program.processing.LoopUnrolling in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method RMWStoreExclusive.

@Test(expected = ProgramProcessingException.class)
public void RMWStoreExclusive() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    pb.addChild(0, newRMWStoreExclusive(pb.getOrNewObject("X"), IValue.ONE, null, true));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Label(com.dat3m.dartagnan.program.event.core.Label) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Example 2 with LoopUnrolling

use of com.dat3m.dartagnan.program.processing.LoopUnrolling in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method RMWStore.

// These events cannot be unrolled. They are generated during compilation.
@Test(expected = ProgramProcessingException.class)
public void RMWStore() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    MemoryObject object = pb.getOrNewObject("X");
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    Load load = EventFactory.newRMWLoad(pb.getOrCreateRegister(0, "r1", 32), object, null);
    pb.addChild(0, EventFactory.newRMWStore(load, object, IValue.ONE, null));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : Load(com.dat3m.dartagnan.program.event.core.Load) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) Label(com.dat3m.dartagnan.program.event.core.Label) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Example 3 with LoopUnrolling

use of com.dat3m.dartagnan.program.processing.LoopUnrolling in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method FenceCond.

@Test(expected = ProgramProcessingException.class)
public void FenceCond() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    MemoryObject object = pb.getOrNewObject("X");
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    RMWReadCond load = Linux.newRMWReadCondCmp(pb.getOrCreateRegister(0, "r1", 32), BConst.TRUE, object, null);
    pb.addChild(0, Linux.newConditionalBarrier(load, null));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : RMWReadCond(com.dat3m.dartagnan.program.event.lang.linux.cond.RMWReadCond) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) Label(com.dat3m.dartagnan.program.event.core.Label) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Example 4 with LoopUnrolling

use of com.dat3m.dartagnan.program.processing.LoopUnrolling in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method RMWStoreCon.

@Test(expected = ProgramProcessingException.class)
public void RMWStoreCon() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    MemoryObject object = pb.getOrNewObject("X");
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    RMWReadCond load = Linux.newRMWReadCondCmp(pb.getOrCreateRegister(0, "r1", 32), BConst.TRUE, object, null);
    pb.addChild(0, Linux.newRMWStoreCond(load, object, IValue.ONE, null));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : RMWReadCond(com.dat3m.dartagnan.program.event.lang.linux.cond.RMWReadCond) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) Label(com.dat3m.dartagnan.program.event.core.Label) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Example 5 with LoopUnrolling

use of com.dat3m.dartagnan.program.processing.LoopUnrolling in project Dat3M by hernanponcedeleon.

the class UnrollExceptionsTest method ExecutionStatus.

@Test(expected = ProgramProcessingException.class)
public void ExecutionStatus() throws Exception {
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    pb.initThread(0);
    Label start = pb.getOrCreateLabel("loopStart");
    pb.addChild(0, start);
    MemoryObject object = pb.getOrNewObject("X");
    RMWStoreExclusive store = newRMWStoreExclusive(object, IValue.ONE, null);
    pb.addChild(0, EventFactory.newExecutionStatus(pb.getOrCreateRegister(0, "r1", 32), store));
    pb.addChild(0, EventFactory.newGoto(start));
    LoopUnrolling processor = LoopUnrolling.newInstance();
    processor.setUnrollingBound(2);
    processor.run(pb.build());
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Label(com.dat3m.dartagnan.program.event.core.Label) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) RMWStoreExclusive(com.dat3m.dartagnan.program.event.core.rmw.RMWStoreExclusive) EventFactory.newRMWStoreExclusive(com.dat3m.dartagnan.program.event.EventFactory.newRMWStoreExclusive) LoopUnrolling(com.dat3m.dartagnan.program.processing.LoopUnrolling) Test(org.junit.Test)

Aggregations

ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)5 Label (com.dat3m.dartagnan.program.event.core.Label)5 LoopUnrolling (com.dat3m.dartagnan.program.processing.LoopUnrolling)5 Test (org.junit.Test)5 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)4 RMWReadCond (com.dat3m.dartagnan.program.event.lang.linux.cond.RMWReadCond)2 EventFactory.newRMWStoreExclusive (com.dat3m.dartagnan.program.event.EventFactory.newRMWStoreExclusive)1 Load (com.dat3m.dartagnan.program.event.core.Load)1 RMWStoreExclusive (com.dat3m.dartagnan.program.event.core.rmw.RMWStoreExclusive)1