use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method visitReOpBoolNot.
@Override
public ExprInterface visitReOpBoolNot(LitmusCParser.ReOpBoolNotContext ctx) {
Register register = getReturnRegister(false);
ExprInterface v = (ExprInterface) ctx.re().accept(this);
BExprUn result = new BExprUn(BOpUn.NOT, v);
return assignToReturnRegister(register, result);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method visitVarName.
// ----------------------------------------------------------------------------------------------------------------
// Utils
@Override
public IExpr visitVarName(LitmusCParser.VarNameContext ctx) {
if (scope > -1) {
Register register = programBuilder.getRegister(scope, ctx.getText());
if (register != null) {
return register;
}
MemoryObject object = programBuilder.getObject(ctx.getText());
if (object != null) {
register = programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
programBuilder.addChild(currentThread, EventFactory.newLoad(register, object, "NA"));
return register;
}
return programBuilder.getOrCreateRegister(scope, ctx.getText(), ARCH_PRECISION);
}
MemoryObject object = programBuilder.getOrNewObject(ctx.getText());
Register register = programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
programBuilder.addChild(currentThread, EventFactory.newLoad(register, object, "NA"));
return register;
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method visitReAtomicOpReturn.
// ----------------------------------------------------------------------------------------------------------------
// Return expressions (memory reads, must have register for return value)
// Returns new value (the value after computation)
@Override
public IExpr visitReAtomicOpReturn(LitmusCParser.ReAtomicOpReturnContext ctx) {
Register register = getReturnRegister(true);
IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
Event event = EventFactory.Linux.newRMWOpReturn(getAddress(ctx.address), register, value, ctx.op, ctx.mo);
programBuilder.addChild(currentThread, event);
return register;
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method getReturnRegister.
private Register getReturnRegister(boolean createOnNull) {
Register register = returnRegister;
if (register == null && createOnNull) {
return programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
}
returnRegister = null;
return register;
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLitmusC method visitReAtomicFetchOp.
// Returns old value (the value before computation)
@Override
public IExpr visitReAtomicFetchOp(LitmusCParser.ReAtomicFetchOpContext ctx) {
Register register = getReturnRegister(true);
IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
Event event = EventFactory.Linux.newRMWFetchOp(getAddress(ctx.address), register, value, ctx.op, ctx.mo);
programBuilder.addChild(currentThread, event);
return register;
}
Aggregations