use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorLKMM method visitRMWAddUnless.
@Override
public List<Event> visitRMWAddUnless(RMWAddUnless e) {
Register resultRegister = e.getResultRegister();
Register dummy = e.getThread().newRegister(resultRegister.getPrecision());
RMWReadCondUnless load = Linux.newRMWReadCondUnless(dummy, e.getCmp(), e.getAddress(), Tag.Linux.MO_ONCE);
return eventSequence(Linux.newConditionalMemoryBarrier(load), load, Linux.newRMWStoreCond(load, e.getAddress(), new IExprBin(dummy, IOpBin.PLUS, (IExpr) e.getMemValue()), Tag.Linux.MO_ONCE), newLocal(resultRegister, new Atom(dummy, NEQ, e.getCmp())), Linux.newConditionalMemoryBarrier(load));
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorPower 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 = e.getThread().newRegister(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 = newRMWLoadExclusive(regValue, address, null);
Store store = newRMWStoreExclusive(address, value, null, true);
Fence optionalMemoryBarrier = mo.equals(Tag.C11.MO_SC) ? Power.newSyncBarrier() : mo.equals(C11.MO_RELEASE) || mo.equals(C11.MO_ACQUIRE_RELEASE) ? Power.newLwSyncBarrier() : null;
Fence optionalISyncBarrier = mo.equals(C11.MO_SC) || mo.equals(C11.MO_ACQUIRE) || mo.equals(C11.MO_ACQUIRE_RELEASE) ? Power.newISyncBarrier() : null;
// --- Add success events ---
return eventSequence(// Indentation shows the branching structure
optionalMemoryBarrier, load, casCmpResult, branchOnCasCmpResult, store, optionalISyncBarrier, casEnd);
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorTso method visitJoin.
@Override
public List<Event> visitJoin(Join e) {
Register resultRegister = e.getResultRegister();
Load load = newLoad(resultRegister, e.getAddress(), e.getMo());
load.addFilters(C11.PTHREAD);
return eventSequence(load, newJumpUnless(new Atom(resultRegister, EQ, IValue.ZERO), (Label) e.getThread().getExit()));
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorTso method visitDat3mCAS.
@Override
public List<Event> visitDat3mCAS(Dat3mCAS e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
String mo = e.getMo();
Register regValue = e.getThread().newRegister(resultRegister.getPrecision());
Local casCmpResult = newLocal(resultRegister, new Atom(regValue, EQ, e.getExpectedValue()));
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, e.getMemValue(), 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 VisitorLitmusC method visitReLoad.
@Override
public IExpr visitReLoad(LitmusCParser.ReLoadContext ctx) {
Register register = getReturnRegister(true);
Event event = EventFactory.newLoad(register, getAddress(ctx.address), ctx.mo);
programBuilder.addChild(currentThread, event);
return register;
}
Aggregations