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