use of com.dat3m.dartagnan.program.event.core.Cmp in project Dat3M by hernanponcedeleon.
the class VisitorLitmusPPC method visitBranchCond.
@Override
public Object visitBranchCond(LitmusPPCParser.BranchCondContext ctx) {
Label label = programBuilder.getOrCreateLabel(ctx.Label().getText());
Event lastEvent = programBuilder.getLastEvent(mainThread);
if (!(lastEvent instanceof Cmp)) {
throw new ParsingException("Invalid syntax near " + ctx.getText());
}
Cmp cmp = (Cmp) lastEvent;
Atom expr = new Atom(cmp.getLeft(), ctx.cond().op, cmp.getRight());
return programBuilder.addChild(mainThread, EventFactory.newJump(expr, label));
}
use of com.dat3m.dartagnan.program.event.core.Cmp in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitBranch.
@Override
public Object visitBranch(LitmusAArch64Parser.BranchContext ctx) {
Label label = programBuilder.getOrCreateLabel(ctx.label().getText());
if (ctx.branchCondition() == null) {
return programBuilder.addChild(mainThread, EventFactory.newGoto(label));
}
Event lastEvent = programBuilder.getLastEvent(mainThread);
if (!(lastEvent instanceof Cmp)) {
throw new ParsingException("Invalid syntax near " + ctx.getText());
}
Cmp cmp = (Cmp) lastEvent;
Atom expr = new Atom(cmp.getLeft(), ctx.branchCondition().op, cmp.getRight());
return programBuilder.addChild(mainThread, EventFactory.newJump(expr, label));
}
Aggregations