use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorNone method visitRMWFetchOp.
@Override
public List<Event> visitRMWFetchOp(RMWFetchOp e) {
Register resultRegister = e.getResultRegister();
String mo = e.getMo();
IExpr address = e.getAddress();
ExprInterface value = e.getMemValue();
Register dummy = resultRegister;
if (resultRegister == value) {
dummy = new Register(null, resultRegister.getThreadId(), resultRegister.getPrecision());
}
Fence optionalMbBefore = mo.equals(Tag.Linux.MO_MB) ? Linux.newMemoryBarrier() : null;
Load load = newRMWLoad(dummy, address, Tag.Linux.loadMO(mo));
Local optionalUpdateReg = dummy != resultRegister ? newLocal(resultRegister, dummy) : null;
Fence optionalMbAfter = mo.equals(Tag.Linux.MO_MB) ? Linux.newMemoryBarrier() : null;
return eventSequence(optionalMbBefore, load, newRMWStore(load, address, new IExprBin(dummy, e.getOp(), (IExpr) value), Tag.Linux.storeMO(mo)), optionalUpdateReg, optionalMbAfter);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorNone method visitDat3mCAS.
@Override
public List<Event> visitDat3mCAS(Dat3mCAS e) {
Register resultRegister = e.getResultRegister();
ExprInterface value = e.getMemValue();
IExpr address = e.getAddress();
String mo = e.getMo();
ExprInterface expectedValue = e.getExpectedValue();
Register regValue = new Register(null, resultRegister.getThreadId(), resultRegister.getPrecision());
Local casCmpResult = newLocal(resultRegister, new Atom(regValue, EQ, expectedValue));
Label casEnd = newLabel("CAS_end");
CondJump branchOnCasCmpResult = newJump(new Atom(resultRegister, NEQ, IValue.ONE), casEnd);
Load load = newRMWLoad(regValue, address, mo);
Store store = newRMWStore(load, address, value, mo);
return eventSequence(// Indentation shows the branching structure
load, casCmpResult, branchOnCasCmpResult, store, casEnd);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorNone method visitRMWOpReturn.
@Override
public List<Event> visitRMWOpReturn(RMWOpReturn e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
String mo = e.getMo();
Register dummy = new Register(null, resultRegister.getThreadId(), resultRegister.getPrecision());
Fence optionalMbBefore = mo.equals(Tag.Linux.MO_MB) ? Linux.newMemoryBarrier() : null;
Load load = newRMWLoad(dummy, address, Tag.Linux.loadMO(mo));
Fence optionalMbAfter = mo.equals(Tag.Linux.MO_MB) ? Linux.newMemoryBarrier() : null;
return eventSequence(optionalMbBefore, load, newLocal(resultRegister, new IExprBin(dummy, e.getOp(), (IExpr) e.getMemValue())), newRMWStore(load, address, resultRegister, Tag.Linux.storeMO(mo)), optionalMbAfter);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorNone method visitAtomicCmpXchg.
@Override
public List<Event> visitAtomicCmpXchg(AtomicCmpXchg e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
String mo = e.getMo();
IExpr expectedAddr = e.getExpectedAddr();
int threadId = resultRegister.getThreadId();
int precision = resultRegister.getPrecision();
Register regExpected = new Register(null, threadId, precision);
Register regValue = new Register(null, threadId, precision);
Load loadExpected = newLoad(regExpected, expectedAddr, null);
Store storeExpected = newStore(expectedAddr, regValue, null);
Label casFail = newLabel("CAS_fail");
Label casEnd = newLabel("CAS_end");
Local casCmpResult = newLocal(resultRegister, new Atom(regValue, EQ, regExpected));
CondJump branchOnCasCmpResult = newJump(new Atom(resultRegister, NEQ, IValue.ONE), casFail);
CondJump gotoCasEnd = newGoto(casEnd);
Load loadValue = newRMWLoad(regValue, address, mo);
Store storeValue = newRMWStore(loadValue, address, e.getMemValue(), mo);
return eventSequence(// Indentation shows the branching structure
loadExpected, loadValue, casCmpResult, branchOnCasCmpResult, storeValue, gotoCasEnd, casFail, storeExpected, casEnd);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorNone method visitRMWOpAndTest.
@Override
public List<Event> visitRMWOpAndTest(RMWOpAndTest e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
int precision = resultRegister.getPrecision();
Register dummy = new Register(null, resultRegister.getThreadId(), precision);
Load load = newRMWLoad(dummy, address, Tag.Linux.MO_RELAXED);
// TODO: Are the memory barriers really unconditional?
return eventSequence(Linux.newMemoryBarrier(), load, newLocal(dummy, new IExprBin(dummy, e.getOp(), (IExpr) e.getMemValue())), newRMWStore(load, address, dummy, Tag.Linux.MO_RELAXED), newLocal(resultRegister, new Atom(dummy, EQ, new IValue(BigInteger.ZERO, precision))), Linux.newMemoryBarrier());
}
Aggregations