use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.
the class ExceptionsTest method compileBeforeUnrollException.
@Test(expected = IllegalArgumentException.class)
public void compileBeforeUnrollException() throws Exception {
ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
pb.initThread(0);
// Program must be unrolled first
Compilation.newInstance().run(pb.build());
}
use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.
the class ExceptionsTest method RegisterAlreadyExist.
@Test(expected = MalformedProgramException.class)
public void RegisterAlreadyExist() throws Exception {
ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
pb.initThread(0);
Thread t = pb.build().getThreads().get(0);
t.newRegister("r1", -1);
// Adding same register a second time
t.newRegister("r1", -1);
}
use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.
the class ExceptionsTest method unrollBeforeDCEException.
@Test(expected = IllegalArgumentException.class)
public void unrollBeforeDCEException() throws Exception {
ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
pb.initThread(0);
Program p = pb.build();
LoopUnrolling.newInstance().run(p);
// DCE cannot be called after unrolling
DeadCodeElimination.newInstance().run(p);
}
use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder 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());
}
use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder 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());
}
Aggregations