Search in sources :

Example 6 with ProgramBuilder

use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.

the class AliasAnalysisTest method program3.

private void program3(Alias method, Result... expect) throws InvalidConfigurationException {
    ProgramBuilder b = new ProgramBuilder();
    MemoryObject x = b.newObject("x", 3);
    x.setInitialValue(0, x);
    b.initThread(0);
    Register r0 = b.getOrCreateRegister(0, "r0", -1);
    Load e0 = newLoad(r0, x);
    b.addChild(0, e0);
    Store e1 = newStore(x, plus(r0, 1));
    b.addChild(0, e1);
    Store e2 = newStore(plus(x, 2));
    b.addChild(0, e2);
    Store e3 = newStore(r0);
    b.addChild(0, e3);
    AliasAnalysis a = analyze(b, method);
    assertAlias(expect[0], a, e0, e1);
    assertAlias(expect[1], a, e0, e2);
    assertAlias(expect[2], a, e1, e2);
    assertAlias(expect[3], a, e0, e3);
    assertAlias(expect[4], a, e1, e3);
    // precisely no
    assertAlias(expect[5], a, e2, e3);
}
Also used : Register(com.dat3m.dartagnan.program.Register) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) AliasAnalysis(com.dat3m.dartagnan.program.analysis.AliasAnalysis)

Example 7 with ProgramBuilder

use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.

the class ParserBoogie method parse.

@Override
public Program parse(CharStream charStream) {
    BoogieLexer lexer = new BoogieLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    BoogieParser parser = new BoogieParser(tokenStream);
    parser.addErrorListener(new ParserErrorListener());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.BOOGIE);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorBoogie visitor = new VisitorBoogie(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    return program;
}
Also used : BoogieLexer(com.dat3m.dartagnan.parsers.BoogieLexer) Program(com.dat3m.dartagnan.program.Program) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) BoogieParser(com.dat3m.dartagnan.parsers.BoogieParser) VisitorBoogie(com.dat3m.dartagnan.parsers.program.visitors.boogie.VisitorBoogie) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener)

Example 8 with ProgramBuilder

use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.

the class ParserLitmusC method parse.

@Override
public Program parse(CharStream charStream) {
    LitmusCLexer lexer = new LitmusCLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    LitmusCParser parser = new LitmusCParser(tokenStream);
    parser.setErrorHandler(new BailErrorStrategy());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorLitmusC visitor = new VisitorLitmusC(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    program.setArch(Arch.LKMM);
    return program;
}
Also used : LitmusCLexer(com.dat3m.dartagnan.parsers.LitmusCLexer) Program(com.dat3m.dartagnan.program.Program) LitmusCParser(com.dat3m.dartagnan.parsers.LitmusCParser) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) VisitorLitmusC(com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusC)

Example 9 with ProgramBuilder

use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.

the class ParserLitmusLISA method parse.

@Override
public Program parse(CharStream charStream) {
    LitmusLISALexer lexer = new LitmusLISALexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    LitmusLISAParser parser = new LitmusLISAParser(tokenStream);
    parser.addErrorListener(new DiagnosticErrorListener(true));
    parser.addErrorListener(new ParserErrorListener());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorLitmusLISA visitor = new VisitorLitmusLISA(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    return program;
}
Also used : Program(com.dat3m.dartagnan.program.Program) LitmusLISAParser(com.dat3m.dartagnan.parsers.LitmusLISAParser) VisitorLitmusLISA(com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusLISA) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) LitmusLISALexer(com.dat3m.dartagnan.parsers.LitmusLISALexer) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener)

Example 10 with ProgramBuilder

use of com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder in project Dat3M by hernanponcedeleon.

the class ParserLitmusPPC method parse.

@Override
public Program parse(CharStream charStream) {
    LitmusPPCLexer lexer = new LitmusPPCLexer(charStream);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    LitmusPPCParser parser = new LitmusPPCParser(tokenStream);
    parser.addErrorListener(new DiagnosticErrorListener(true));
    parser.addErrorListener(new ParserErrorListener());
    ProgramBuilder pb = new ProgramBuilder(SourceLanguage.LITMUS);
    ParserRuleContext parserEntryPoint = parser.main();
    VisitorLitmusPPC visitor = new VisitorLitmusPPC(pb);
    Program program = (Program) parserEntryPoint.accept(visitor);
    program.setArch(Arch.POWER);
    return program;
}
Also used : VisitorLitmusPPC(com.dat3m.dartagnan.parsers.program.visitors.VisitorLitmusPPC) Program(com.dat3m.dartagnan.program.Program) ProgramBuilder(com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder) LitmusPPCLexer(com.dat3m.dartagnan.parsers.LitmusPPCLexer) LitmusPPCParser(com.dat3m.dartagnan.parsers.LitmusPPCParser) ParserErrorListener(com.dat3m.dartagnan.exception.ParserErrorListener)

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