use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorArm8 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, AArch64.DMB.newISHBarrier(), 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 VisitorBase method visitRMW.
@Override
public List<Event> visitRMW(RMW e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
String mo = e.getMo();
Register dummyReg = e.getThread().newRegister(resultRegister.getPrecision());
Load load = newRMWLoad(dummyReg, address, mo);
RMWStore store = newRMWStore(load, address, e.getMemValue(), mo);
return eventSequence(load, store, newLocal(resultRegister, dummyReg));
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorBase method visitLock.
@Override
public List<Event> visitLock(Lock e) {
Register resultRegister = e.getResultRegister();
String mo = e.getMo();
List<Event> events = eventSequence(newLoad(resultRegister, e.getAddress(), mo), newJump(new Atom(resultRegister, NEQ, IValue.ZERO), (Label) e.getThread().getExit()), newStore(e.getAddress(), IValue.ONE, mo));
for (Event child : events) {
child.addFilters(C11.LOCK, RMW);
}
return events;
}
use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.
the class VisitorC11 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 precision = resultRegister.getPrecision();
Register regExpected = e.getThread().newRegister(precision);
Register regValue = e.getThread().newRegister(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 VisitorIMM method visitAtomicCmpXchg.
@Override
public List<Event> visitAtomicCmpXchg(AtomicCmpXchg e) {
Register resultRegister = e.getResultRegister();
IExpr address = e.getAddress();
String mo = e.getMo();
Fence optionalFenceLoad = mo.equals(Tag.C11.MO_SC) ? newFence(Tag.C11.MO_SC) : null;
Fence optionalFenceStore = mo.equals(Tag.C11.MO_SC) ? newFence(Tag.C11.MO_SC) : null;
IExpr expectedAddr = e.getExpectedAddr();
int precision = resultRegister.getPrecision();
Register regExpected = e.getThread().newRegister(precision);
Register regValue = e.getThread().newRegister(precision);
Load loadExpected = newLoad(regExpected, expectedAddr, null);
loadExpected.addFilters(Tag.IMM.CASDEPORIGIN);
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, extractLoadMo(mo));
Store storeValue = newRMWStore(loadValue, address, e.getMemValue(), extractStoreMo(mo));
return eventSequence(// Indentation shows the branching structure
loadExpected, optionalFenceLoad, loadValue, casCmpResult, branchOnCasCmpResult, optionalFenceStore, storeValue, gotoCasEnd, casFail, storeExpected, casEnd);
}
Aggregations