use of com.dat3m.dartagnan.expression.Atom in project Dat3M by hernanponcedeleon.
the class VisitorBase method visitLock.
@Override
public List<Event> visitLock(Lock e) {
Register resultRegister = e.getResultRegister();
String mo = e.getMo();
List<Event> events = eventSequence(newLoad(resultRegister, e.getAddress(), mo), newJump(new Atom(resultRegister, NEQ, IValue.ZERO), (Label) e.getThread().getExit()), newStore(e.getAddress(), IValue.ONE, mo));
for (Event child : events) {
child.addFilters(C11.LOCK, RMW);
}
return events;
}
use of com.dat3m.dartagnan.expression.Atom 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.expression.Atom 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));
}
use of com.dat3m.dartagnan.expression.Atom in project Dat3M by hernanponcedeleon.
the class RemoveDeadCondJumps method mutuallyExclusiveIfs.
private boolean mutuallyExclusiveIfs(CondJump jump, Event e) {
if (!(e instanceof CondJump)) {
return false;
}
CondJump jump2 = (CondJump) e;
if (jump.getGuard() instanceof BExprUn && ((BExprUn) jump.getGuard()).getInner().equals(jump2.getGuard()) || jump2.getGuard() instanceof BExprUn && ((BExprUn) jump2.getGuard()).getInner().equals(jump.getGuard())) {
return true;
}
if (jump.getGuard() instanceof Atom && jump2.getGuard() instanceof Atom) {
Atom a1 = (Atom) jump.getGuard();
Atom a2 = (Atom) jump2.getGuard();
return a1.getOp().inverted() == a2.getOp() && a1.getLHS().equals(a2.getLHS()) && a1.getRHS().equals(a2.getRHS());
}
return false;
}
use of com.dat3m.dartagnan.expression.Atom in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitBranchRegister.
@Override
public Object visitBranchRegister(LitmusAArch64Parser.BranchRegisterContext ctx) {
Register register = programBuilder.getOrErrorRegister(mainThread, ctx.rV);
Atom expr = new Atom(register, ctx.branchRegInstruction().op, IValue.ZERO);
Label label = programBuilder.getOrCreateLabel(ctx.label().getText());
return programBuilder.addChild(mainThread, EventFactory.newJump(expr, label));
}
Aggregations