use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitExpressionImmediate.
@Override
public IExpr visitExpressionImmediate(LitmusAArch64Parser.ExpressionImmediateContext ctx) {
IExpr expr = new IValue(new BigInteger(ctx.immediate().constant().getText()), ARCH_PRECISION);
if (ctx.shift() != null) {
IValue val = new IValue(new BigInteger(ctx.shift().immediate().constant().getText()), ARCH_PRECISION);
expr = new IExprBin(expr, ctx.shift().shiftOperator().op, val);
}
return expr;
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitCmp.
@Override
public Object visitCmp(LitmusAArch64Parser.CmpContext ctx) {
Register register = programBuilder.getOrCreateRegister(mainThread, ctx.rD, ARCH_PRECISION);
IExpr expr = ctx.expr32() != null ? (IExpr) ctx.expr32().accept(this) : (IExpr) ctx.expr64().accept(this);
return programBuilder.addChild(mainThread, EventFactory.newCompare(register, expr));
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method DAT3M_CAS.
private static void DAT3M_CAS(VisitorBoogie visitor, Call_cmdContext ctx) {
Register reg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, visitor.currentScope.getID() + ":" + ctx.call_params().Ident(0).getText(), ARCH_PRECISION);
List<BoogieParser.ExprContext> params = ctx.call_params().exprs().expr();
IExpr addr = (IExpr) params.get(0).accept(visitor);
IExpr expectedVal = (IExpr) params.get(1).accept(visitor);
IExpr desiredVal = (IExpr) params.get(2).accept(visitor);
String mo = null;
if (params.size() > 3) {
mo = intToMo(((IConst) params.get(3).accept(visitor)).getValueAsInt());
}
visitor.programBuilder.addChild(visitor.threadCount, Atomic.newDat3mCAS(reg, addr, expectedVal, desiredVal, mo)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method atomicCmpXchg.
private static void atomicCmpXchg(VisitorBoogie visitor, Call_cmdContext ctx) {
Register reg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, visitor.currentScope.getID() + ":" + ctx.call_params().Ident(0).getText(), ARCH_PRECISION);
List<BoogieParser.ExprContext> params = ctx.call_params().exprs().expr();
IExpr addr = (IExpr) params.get(0).accept(visitor);
// NOTE: We assume a register here
IExpr expectedAddr = (IExpr) params.get(1).accept(visitor);
IExpr desiredVal = (IExpr) params.get(2).accept(visitor);
String mo = null;
boolean strong = ctx.getText().contains("strong");
if (params.size() > 3) {
mo = intToMo(((IConst) params.get(3).accept(visitor)).getValueAsInt());
// NOTE: We forget about the 5th parameter (MO on fail) because it is never used
// (see issue #123 for an explanation)
}
visitor.programBuilder.addChild(visitor.threadCount, Atomic.newCompareExchange(reg, addr, expectedAddr, desiredVal, mo, strong)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method atomicInit.
private static void atomicInit(VisitorBoogie visitor, Call_cmdContext ctx) {
IExpr add = (IExpr) ctx.call_params().exprs().expr().get(0).accept(visitor);
ExprInterface value = (ExprInterface) ctx.call_params().exprs().expr().get(1).accept(visitor);
visitor.programBuilder.addChild(visitor.threadCount, newStore(add, value, null)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
Aggregations