use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusX86 method visitLoadValueToRegister.
@Override
public Object visitLoadValueToRegister(LitmusX86Parser.LoadValueToRegisterContext ctx) {
Register register = programBuilder.getOrCreateRegister(mainThread, ctx.register().getText(), ARCH_PRECISION);
IValue constant = new IValue(new BigInteger(ctx.constant().getText()), ARCH_PRECISION);
return programBuilder.addChild(mainThread, EventFactory.newLocal(register, constant));
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusX86 method visitExchangeRegisterLocation.
@Override
public Object visitExchangeRegisterLocation(LitmusX86Parser.ExchangeRegisterLocationContext ctx) {
Register register = programBuilder.getOrErrorRegister(mainThread, ctx.register().getText());
MemoryObject object = programBuilder.getOrNewObject(ctx.location().getText());
return programBuilder.addChild(mainThread, EventFactory.X86.newExchange(object, register));
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method atomicFetchOp.
private static void atomicFetchOp(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);
IExpr value = (IExpr) ctx.call_params().exprs().expr().get(1).accept(visitor);
String mo = null;
IOpBin op;
if (ctx.getText().contains("_add")) {
op = IOpBin.PLUS;
} else if (ctx.getText().contains("_sub")) {
op = IOpBin.MINUS;
} else if (ctx.getText().contains("_and")) {
op = IOpBin.AND;
} else if (ctx.getText().contains("_or")) {
op = IOpBin.OR;
} else if (ctx.getText().contains("_xor")) {
op = IOpBin.XOR;
} else {
throw new RuntimeException("AtomicFetchOp operation cannot be handled");
}
if (ctx.call_params().exprs().expr().size() > 2) {
mo = intToMo(((IConst) ctx.call_params().exprs().expr().get(2).accept(visitor)).getValueAsInt());
}
visitor.programBuilder.addChild(visitor.threadCount, Atomic.newFetchOp(reg, add, value, op, mo)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class AtomicProcedures method atomicXchg.
private static void atomicXchg(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);
IExpr value = (IExpr) ctx.call_params().exprs().expr().get(1).accept(visitor);
String mo = null;
if (ctx.call_params().exprs().expr().size() > 2) {
mo = intToMo(((IConst) ctx.call_params().exprs().expr().get(2).accept(visitor)).getValueAsInt());
}
visitor.programBuilder.addChild(visitor.threadCount, Atomic.newExchange(reg, add, value, mo)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
use of com.dat3m.dartagnan.program.Register 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);
}
Aggregations