Search in sources :

Example 36 with Register

use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.

the class VisitorIMM method visitAtomicFetchOp.

@Override
public List<Event> visitAtomicFetchOp(AtomicFetchOp e) {
    Register resultRegister = e.getResultRegister();
    IOpBin op = e.getOp();
    IExpr address = e.getAddress();
    String mo = e.getMo();
    Fence optionalFence = mo.equals(Tag.C11.MO_SC) ? newFence(Tag.C11.MO_SC) : null;
    Register dummyReg = e.getThread().newRegister(resultRegister.getPrecision());
    Load load = newRMWLoad(resultRegister, address, extractLoadMo(mo));
    return eventSequence(optionalFence, load, newLocal(dummyReg, new IExprBin(resultRegister, op, (IExpr) e.getMemValue())), optionalFence, newRMWStore(load, address, dummyReg, extractStoreMo(mo)));
}
Also used : IOpBin(com.dat3m.dartagnan.expression.op.IOpBin) Register(com.dat3m.dartagnan.program.Register)

Example 37 with Register

use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.

the class VisitorIMM method visitJoin.

@Override
public List<Event> visitJoin(Join e) {
    Register resultRegister = e.getResultRegister();
    Load load = newLoad(resultRegister, e.getAddress(), extractLoadMo(e.getMo()));
    load.addFilters(C11.PTHREAD);
    return eventSequence(load, newJumpUnless(new Atom(resultRegister, EQ, IValue.ZERO), (Label) e.getThread().getExit()), newFence(Tag.C11.MO_SC));
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 38 with Register

use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.

the class VisitorLKMM method visitJoin.

@Override
public List<Event> visitJoin(Join e) {
    Register resultRegister = e.getResultRegister();
    Load load = newLoad(resultRegister, e.getAddress(), Tag.Linux.MO_ACQUIRE);
    load.addFilters(C11.PTHREAD);
    return eventSequence(load, newJumpUnless(new Atom(resultRegister, EQ, IValue.ZERO), (Label) e.getThread().getExit()));
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 39 with Register

use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.

the class VisitorLKMM method visitRMWOp.

@Override
public List<Event> visitRMWOp(RMWOp e) {
    IExpr address = e.getAddress();
    Register resultRegister = e.getResultRegister();
    Load load = newRMWLoad(resultRegister, address, Tag.Linux.MO_ONCE);
    load.addFilters(Tag.Linux.NORETURN);
    return eventSequence(load, newRMWStore(load, address, new IExprBin(resultRegister, e.getOp(), (IExpr) e.getMemValue()), Tag.Linux.MO_ONCE));
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 40 with Register

use of com.dat3m.dartagnan.program.Register in project Dat3M by hernanponcedeleon.

the class VisitorLKMM method visitLKMMLock.

@Override
public List<Event> visitLKMMLock(LKMMLock e) {
    Register dummy = e.getThread().newRegister(GlobalSettings.ARCH_PRECISION);
    // In litmus tests, spinlocks are guaranteed to success, i.e. its read part gets value 0
    Event middle = e.getThread().getProgram().getFormat().equals(LITMUS) ? newAssume(new Atom(dummy, COpBin.EQ, IValue.ZERO)) : newJump(new Atom(dummy, NEQ, IValue.ZERO), (Label) e.getThread().getExit());
    return eventSequence(Linux.newLockRead(dummy, e.getLock()), middle, Linux.newLockWrite(e.getLock()));
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Aggregations

Register (com.dat3m.dartagnan.program.Register)154 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)29 Event (com.dat3m.dartagnan.program.event.core.Event)25 IExpr (com.dat3m.dartagnan.expression.IExpr)16 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)15 ProgramBuilder (com.dat3m.dartagnan.parsers.program.utils.ProgramBuilder)13 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)12 Label (com.dat3m.dartagnan.program.event.core.Label)11 ParsingException (com.dat3m.dartagnan.exception.ParsingException)10 BigInteger (java.math.BigInteger)8 IConst (com.dat3m.dartagnan.expression.IConst)7 IExprBin (com.dat3m.dartagnan.expression.IExprBin)6 IValue (com.dat3m.dartagnan.expression.IValue)6 IOpBin (com.dat3m.dartagnan.expression.op.IOpBin)6 Program (com.dat3m.dartagnan.program.Program)6 Dependency (com.dat3m.dartagnan.program.analysis.Dependency)6 ExprInterface (com.dat3m.dartagnan.expression.ExprInterface)5 Thread (com.dat3m.dartagnan.program.Thread)5 java.util (java.util)5 Atom (com.dat3m.dartagnan.expression.Atom)4