Search in sources :

Example 36 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class VisitorLitmusC method visitReCmpXchg.

@Override
public IExpr visitReCmpXchg(LitmusCParser.ReCmpXchgContext ctx) {
    Register register = getReturnRegister(true);
    ExprInterface cmp = (ExprInterface) ctx.cmp.accept(this);
    IExpr value = (IExpr) ctx.value.accept(this);
    Event event = EventFactory.Linux.newRMWCompareExchange(getAddress(ctx.address), register, cmp, value, ctx.mo);
    programBuilder.addChild(currentThread, event);
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 37 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class VisitorLitmusC method visitReAtomicOpAndTest.

@Override
public IExpr visitReAtomicOpAndTest(LitmusCParser.ReAtomicOpAndTestContext ctx) {
    Register register = getReturnRegister(true);
    IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
    Event event = EventFactory.Linux.newRMWOpAndTest(getAddress(ctx.address), register, value, ctx.op);
    programBuilder.addChild(currentThread, event);
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 38 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class VisitorLitmusC method visitNreAtomicOp.

// ----------------------------------------------------------------------------------------------------------------
// NonReturn expressions (all other return expressions are reduced to these ones)
@Override
public Object visitNreAtomicOp(LitmusCParser.NreAtomicOpContext ctx) {
    IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
    Register register = programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
    Event event = EventFactory.Linux.newRMWOp(getAddress(ctx.address), register, value, ctx.op);
    return programBuilder.addChild(currentThread, event);
}
Also used : Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 39 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class VisitorLitmusC method visitNreStore.

@Override
public Object visitNreStore(LitmusCParser.NreStoreContext ctx) {
    ExprInterface value = (ExprInterface) ctx.value.accept(this);
    if (ctx.mo.equals(Tag.Linux.MO_MB)) {
        Event event = EventFactory.newStore(getAddress(ctx.address), value, Tag.Linux.MO_ONCE);
        programBuilder.addChild(currentThread, event);
        return programBuilder.addChild(currentThread, EventFactory.Linux.newMemoryBarrier());
    }
    Event event = EventFactory.newStore(getAddress(ctx.address), value, ctx.mo);
    return programBuilder.addChild(currentThread, event);
}
Also used : Event(com.dat3m.dartagnan.program.event.core.Event)

Example 40 with Event

use of com.dat3m.dartagnan.program.event.core.Event in project Dat3M by hernanponcedeleon.

the class VisitorLitmusPPC method visitBranchCond.

@Override
public Object visitBranchCond(LitmusPPCParser.BranchCondContext ctx) {
    Label label = programBuilder.getOrCreateLabel(ctx.Label().getText());
    Event lastEvent = programBuilder.getLastEvent(mainThread);
    if (!(lastEvent instanceof Cmp)) {
        throw new ParsingException("Invalid syntax near " + ctx.getText());
    }
    Cmp cmp = (Cmp) lastEvent;
    Atom expr = new Atom(cmp.getLeft(), ctx.cond().op, cmp.getRight());
    return programBuilder.addChild(mainThread, EventFactory.newJump(expr, label));
}
Also used : Cmp(com.dat3m.dartagnan.program.event.core.Cmp) ParsingException(com.dat3m.dartagnan.exception.ParsingException) Label(com.dat3m.dartagnan.program.event.core.Label) Event(com.dat3m.dartagnan.program.event.core.Event) Atom(com.dat3m.dartagnan.expression.Atom)

Aggregations

Event (com.dat3m.dartagnan.program.event.core.Event)104 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)34 Thread (com.dat3m.dartagnan.program.Thread)32 Register (com.dat3m.dartagnan.program.Register)25 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)25 MemEvent (com.dat3m.dartagnan.program.event.core.MemEvent)20 Tag (com.dat3m.dartagnan.program.event.Tag)16 Label (com.dat3m.dartagnan.program.event.core.Label)16 Collectors (java.util.stream.Collectors)16 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)16 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)16 LogManager (org.apache.logging.log4j.LogManager)15 Logger (org.apache.logging.log4j.Logger)15 Program (com.dat3m.dartagnan.program.Program)12 ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)12 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)12 java.util (java.util)12 SolverContext (org.sosy_lab.java_smt.api.SolverContext)12 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)11 CondJump (com.dat3m.dartagnan.program.event.core.CondJump)10