use of com.dat3m.dartagnan.program.event.core.IfAsJump in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method visitIfExpression.
@Override
public Object visitIfExpression(LitmusCParser.IfExpressionContext ctx) {
ExprInterface expr = (ExprInterface) ctx.re().accept(this);
ifId++;
Label elseL = programBuilder.getOrCreateLabel("else_" + ifId);
Label endL = programBuilder.getOrCreateLabel("end_" + ifId);
IfAsJump ifEvent = EventFactory.newIfJumpUnless(expr, elseL, endL);
programBuilder.addChild(currentThread, ifEvent);
for (LitmusCParser.ExpressionContext expressionContext : ctx.expression()) expressionContext.accept(this);
CondJump jumpToEnd = EventFactory.newGoto(endL);
jumpToEnd.addFilters(Tag.IFI);
programBuilder.addChild(currentThread, jumpToEnd);
programBuilder.addChild(currentThread, elseL);
if (ctx.elseExpression() != null) {
ctx.elseExpression().accept(this);
}
programBuilder.addChild(currentThread, endL);
return null;
}
use of com.dat3m.dartagnan.program.event.core.IfAsJump in project Dat3M by hernanponcedeleon.
the class RelCtrlDirect method getMaxTupleSet.
@Override
public TupleSet getMaxTupleSet() {
if (maxTupleSet == null) {
maxTupleSet = new TupleSet();
// NOTE: If's (under Linux) have different notion of ctrl dependency than conditional jumps!
for (Thread thread : task.getProgram().getThreads()) {
for (Event e1 : thread.getCache().getEvents(FilterBasic.get(Tag.CMP))) {
for (Event e2 : ((IfAsJump) e1).getBranchesEvents()) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
// Relates jumps (except those implementing Ifs and their internal jump to end) with all later events
List<Event> condJumps = thread.getCache().getEvents(FilterMinus.get(FilterBasic.get(Tag.JUMP), FilterUnion.get(FilterBasic.get(Tag.CMP), FilterBasic.get(Tag.IFI))));
if (!condJumps.isEmpty()) {
for (Event e2 : thread.getCache().getEvents(FilterBasic.get(Tag.ANY))) {
for (Event e1 : condJumps) {
if (e1.getCId() < e2.getCId()) {
maxTupleSet.add(new Tuple(e1, e2));
}
}
}
}
}
removeMutuallyExclusiveTuples(maxTupleSet);
}
return maxTupleSet;
}
Aggregations