Search in sources :

Example 51 with Register

use of com.dat3m.dartagnan.program.Register 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 52 with Register

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

the class VisitorLitmusC method visitReAtomicAddUnless.

// Returns non-zero if the addition was executed, zero otherwise
@Override
public IExpr visitReAtomicAddUnless(LitmusCParser.ReAtomicAddUnlessContext ctx) {
    Register register = getReturnRegister(true);
    IExpr value = (IExpr) ctx.value.accept(this);
    ExprInterface cmp = (ExprInterface) ctx.cmp.accept(this);
    programBuilder.addChild(currentThread, EventFactory.Linux.newRMWAddUnless(getAddress(ctx.address), register, cmp, value));
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 53 with Register

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

the class VisitorLitmusLISA method visitLoad.

@Override
public Object visitLoad(LitmusLISAParser.LoadContext ctx) {
    Register reg = programBuilder.getOrCreateRegister(mainThread, ctx.register().getText(), ARCH_PRECISION);
    IExpr address = (IExpr) ctx.expression().accept(this);
    String mo = ctx.mo() != null ? ctx.mo().getText() : null;
    programBuilder.addChild(mainThread, EventFactory.newLoad(reg, address, mo));
    return null;
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 54 with Register

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

the class VisitorLitmusPPC method visitStw.

@Override
public Object visitStw(LitmusPPCParser.StwContext ctx) {
    Register r1 = programBuilder.getOrErrorRegister(mainThread, ctx.register(0).getText());
    Register ra = programBuilder.getOrErrorRegister(mainThread, ctx.register(1).getText());
    return programBuilder.addChild(mainThread, EventFactory.newStore(ra, r1, "_rx"));
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 55 with Register

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

the class VisitorLitmusPPC method visitXor.

@Override
public Object visitXor(LitmusPPCParser.XorContext ctx) {
    Register r1 = programBuilder.getOrCreateRegister(mainThread, ctx.register(0).getText(), ARCH_PRECISION);
    Register r2 = programBuilder.getOrErrorRegister(mainThread, ctx.register(1).getText());
    Register r3 = programBuilder.getOrErrorRegister(mainThread, ctx.register(2).getText());
    return programBuilder.addChild(mainThread, EventFactory.newLocal(r1, new IExprBin(r2, IOpBin.XOR, r3)));
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) 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