use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.
the class VisitorLitmusLISA method visitJump.
@Override
public Object visitJump(LitmusLISAParser.JumpContext ctx) {
Label label = programBuilder.getOrCreateLabel(ctx.labelName().getText());
Register reg = (Register) ctx.register().accept(this);
Atom cond = new Atom(reg, COpBin.EQ, IValue.ONE);
programBuilder.addChild(mainThread, EventFactory.newJump(cond, label));
return null;
}
use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.
the class VisitorLitmusLISA method visitLabel.
@Override
public Object visitLabel(LitmusLISAParser.LabelContext ctx) {
String name = ctx.getText();
Label label = programBuilder.getOrCreateLabel(name.substring(0, name.length() - 1));
programBuilder.addChild(mainThread, label);
return null;
}
use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.
the class VisitorBoogie method visitLabel.
@Override
public Object visitLabel(LabelContext ctx) {
// Since we "inline" procedures, label names might clash
// thus we use currentScope.getID() + ":"
String labelName = currentScope.getID() + ":" + ctx.children.get(0).getText();
Label label = programBuilder.getOrCreateLabel(labelName);
programBuilder.addChild(threadCount, label);
currentLabel = label;
return null;
}
use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.
the class VisitorBoogie method visitGoto_cmd.
@Override
public Object visitGoto_cmd(Goto_cmdContext ctx) {
String labelName = currentScope.getID() + ":" + ctx.idents().children.get(0).getText();
boolean loop = programBuilder.hasLabel(labelName);
Label l1 = programBuilder.getOrCreateLabel(labelName);
programBuilder.addChild(threadCount, EventFactory.newGoto(l1));
// SMACK will take care of another escape if the loop is completely unrolled.
if (loop) {
Label label = programBuilder.getOrCreateLabel("END_OF_" + currentScope.getID());
programBuilder.addChild(threadCount, EventFactory.newGoto(label));
}
if (ctx.idents().children.size() > 1) {
for (int index = 2; index < ctx.idents().children.size(); index = index + 2) {
labelName = currentScope.getID() + ":" + ctx.idents().children.get(index - 2).getText();
l1 = programBuilder.getOrCreateLabel(labelName);
// We know there are 2 labels and a comma in the middle
labelName = currentScope.getID() + ":" + ctx.idents().children.get(index).getText();
Label l2 = programBuilder.getOrCreateLabel(labelName);
pairLabels.put(l1, l2);
}
}
return null;
}
use of com.dat3m.dartagnan.program.event.core.Label in project Dat3M by hernanponcedeleon.
the class VisitorBoogie method visitAssume_cmd.
@Override
public Object visitAssume_cmd(Assume_cmdContext ctx) {
if (ctx.getText().contains("sourceloc")) {
String line = ctx.getText();
sourceCodeFile = line.substring(line.lastIndexOf('/') + 1, line.indexOf(',') - 1);
currentLine = Integer.parseInt(line.substring(line.indexOf(',') + 1, line.lastIndexOf(',')));
}
// We can get rid of all the "assume true" statements
if (!ctx.proposition().expr().getText().equals("true")) {
Label pairingLabel;
if (!pairLabels.containsKey(currentLabel)) {
// If the current label doesn't have a pairing label, we jump to the end of the program
pairingLabel = programBuilder.getOrCreateLabel("END_OF_T" + threadCount);
} else {
pairingLabel = pairLabels.get(currentLabel);
}
BExpr c = (BExpr) ctx.proposition().expr().accept(this);
if (c != null) {
programBuilder.addChild(threadCount, EventFactory.newJumpUnless(c, pairingLabel));
}
}
return null;
}
Aggregations