use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method atomicLoad.
private static void atomicLoad(VisitorBoogie visitor, Call_cmdContext ctx) {
Register reg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, visitor.currentScope.getID() + ":" + ctx.call_params().Ident(0).getText(), ARCH_PRECISION);
IExpr add = (IExpr) ctx.call_params().exprs().expr().get(0).accept(visitor);
String mo = null;
if (ctx.call_params().exprs().expr().size() > 1) {
mo = intToMo(((IConst) ctx.call_params().exprs().expr().get(1).accept(visitor)).getValueAsInt());
}
visitor.programBuilder.addChild(visitor.threadCount, Atomic.newLoad(reg, add, mo)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class PthreadsProcedures method mutexUnlock.
private static void mutexUnlock(VisitorBoogie visitor, Call_cmdContext ctx) {
ExprsContext lock = ctx.call_params().exprs();
Register register = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, null, ARCH_PRECISION);
IExpr lockAddress = (IExpr) lock.accept(visitor);
if (lockAddress != null) {
visitor.programBuilder.addChild(visitor.threadCount, EventFactory.Pthread.newUnlock(lock.getText(), lockAddress, register));
}
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitArithmetic.
@Override
public Object visitArithmetic(LitmusAArch64Parser.ArithmeticContext ctx) {
Register rD = programBuilder.getOrCreateRegister(mainThread, ctx.rD, ARCH_PRECISION);
Register r1 = programBuilder.getOrErrorRegister(mainThread, ctx.rV);
IExpr expr = ctx.expr32() != null ? (IExpr) ctx.expr32().accept(this) : (IExpr) ctx.expr64().accept(this);
return programBuilder.addChild(mainThread, EventFactory.newLocal(rD, new IExprBin(r1, ctx.arithmeticInstruction().op, expr)));
}
use of com.dat3m.dartagnan.expression.IExpr in project Dat3M by hernanponcedeleon.
the class VisitorLitmusAArch64 method visitExpressionRegister64.
@Override
public IExpr visitExpressionRegister64(LitmusAArch64Parser.ExpressionRegister64Context ctx) {
IExpr expr = programBuilder.getOrCreateRegister(mainThread, ctx.register64().id, 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 visitMov.
@Override
public Object visitMov(LitmusAArch64Parser.MovContext 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.newLocal(register, expr));
}
Aggregations