Search in sources :

Example 16 with ProgramBuilder

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());
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Test(org.junit.Test)

Example 17 with ProgramBuilder

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);
}
Also used : ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Thread(com.dat3m.dartagnan.program.Thread) Test(org.junit.Test)

Example 18 with ProgramBuilder

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);
}
Also used : Program(com.dat3m.dartagnan.program.Program) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) Test(org.junit.Test)

Example 19 with ProgramBuilder

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());
}
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 20 with ProgramBuilder

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());
}
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)

Aggregations

ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)32 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)16 Test (org.junit.Test)14 Register (com.dat3m.dartagnan.program.Register)13 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)12 Program (com.dat3m.dartagnan.program.Program)10 Label (com.dat3m.dartagnan.program.event.core.Label)6 ParserErrorListener (com.dat3m.dartagnan.exception.ParserErrorListener)5 LoopUnrolling (com.dat3m.dartagnan.program.processing.LoopUnrolling)5 CondJump (com.dat3m.dartagnan.program.event.core.CondJump)2 RMWReadCond (com.dat3m.dartagnan.program.event.lang.linux.cond.RMWReadCond)2 Configuration (org.sosy_lab.common.configuration.Configuration)2 BoogieLexer (com.dat3m.dartagnan.parsers.BoogieLexer)1 BoogieParser (com.dat3m.dartagnan.parsers.BoogieParser)1 LitmusAArch64Lexer (com.dat3m.dartagnan.parsers.LitmusAArch64Lexer)1 LitmusAArch64Parser (com.dat3m.dartagnan.parsers.LitmusAArch64Parser)1 LitmusCLexer (com.dat3m.dartagnan.parsers.LitmusCLexer)1 LitmusCParser (com.dat3m.dartagnan.parsers.LitmusCParser)1 LitmusLISALexer (com.dat3m.dartagnan.parsers.LitmusLISALexer)1 LitmusLISAParser (com.dat3m.dartagnan.parsers.LitmusLISAParser)1