Search in sources :

Example 1 with IExprBin

use of com.dat3m.dartagnan.expression.IExprBin 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)

Example 2 with IExprBin

use of com.dat3m.dartagnan.expression.IExprBin in project Dat3M by hernanponcedeleon.

the class VisitorLitmusAArch64 method visitArithmetic.

@Override
public Object visitArithmetic(LitmusAArch64Parser.ArithmeticContext ctx) {
    Register rD = programBuilder.getOrCreateRegister(mainThread, ctx.rD, ARCH_PRECISION);
    Register r1 = programBuilder.getOrErrorRegister(mainThread, ctx.rV);
    IExpr expr = ctx.expr32() != null ? (IExpr) ctx.expr32().accept(this) : (IExpr) ctx.expr64().accept(this);
    return programBuilder.addChild(mainThread, EventFactory.newLocal(rD, new IExprBin(r1, ctx.arithmeticInstruction().op, expr)));
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) Register(com.dat3m.dartagnan.program.Register) IExpr(com.dat3m.dartagnan.expression.IExpr)

Example 3 with IExprBin

use of com.dat3m.dartagnan.expression.IExprBin in project Dat3M by hernanponcedeleon.

the class VisitorLitmusAArch64 method visitExpressionRegister64.

@Override
public IExpr visitExpressionRegister64(LitmusAArch64Parser.ExpressionRegister64Context ctx) {
    IExpr expr = programBuilder.getOrCreateRegister(mainThread, ctx.register64().id, ARCH_PRECISION);
    if (ctx.shift() != null) {
        IValue val = new IValue(new BigInteger(ctx.shift().immediate().constant().getText()), ARCH_PRECISION);
        expr = new IExprBin(expr, ctx.shift().shiftOperator().op, val);
    }
    return expr;
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) IValue(com.dat3m.dartagnan.expression.IValue) BigInteger(java.math.BigInteger) IExpr(com.dat3m.dartagnan.expression.IExpr)

Example 4 with IExprBin

use of com.dat3m.dartagnan.expression.IExprBin in project Dat3M by hernanponcedeleon.

the class VisitorLitmusAArch64 method visitExpressionImmediate.

@Override
public IExpr visitExpressionImmediate(LitmusAArch64Parser.ExpressionImmediateContext ctx) {
    IExpr expr = new IValue(new BigInteger(ctx.immediate().constant().getText()), ARCH_PRECISION);
    if (ctx.shift() != null) {
        IValue val = new IValue(new BigInteger(ctx.shift().immediate().constant().getText()), ARCH_PRECISION);
        expr = new IExprBin(expr, ctx.shift().shiftOperator().op, val);
    }
    return expr;
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) IValue(com.dat3m.dartagnan.expression.IValue) BigInteger(java.math.BigInteger) IExpr(com.dat3m.dartagnan.expression.IExpr)

Example 5 with IExprBin

use of com.dat3m.dartagnan.expression.IExprBin in project Dat3M by hernanponcedeleon.

the class VisitorLitmusPPC method visitAddi.

@Override
public Object visitAddi(LitmusPPCParser.AddiContext ctx) {
    Register r1 = programBuilder.getOrCreateRegister(mainThread, ctx.register(0).getText(), ARCH_PRECISION);
    Register r2 = programBuilder.getOrErrorRegister(mainThread, ctx.register(1).getText());
    IValue constant = new IValue(new BigInteger(ctx.constant().getText()), ARCH_PRECISION);
    return programBuilder.addChild(mainThread, EventFactory.newLocal(r1, new IExprBin(r2, IOpBin.PLUS, constant)));
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) IValue(com.dat3m.dartagnan.expression.IValue) Register(com.dat3m.dartagnan.program.Register) BigInteger(java.math.BigInteger)

Aggregations

IExprBin (com.dat3m.dartagnan.expression.IExprBin)9 IExpr (com.dat3m.dartagnan.expression.IExpr)6 Register (com.dat3m.dartagnan.program.Register)6 IValue (com.dat3m.dartagnan.expression.IValue)5 BigInteger (java.math.BigInteger)5 ExprInterface (com.dat3m.dartagnan.expression.ExprInterface)2 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)2 IConst (com.dat3m.dartagnan.expression.IConst)1 PLUS (com.dat3m.dartagnan.expression.op.IOpBin.PLUS)1 Program (com.dat3m.dartagnan.program.Program)1 Tag (com.dat3m.dartagnan.program.event.Tag)1 com.dat3m.dartagnan.program.event.core (com.dat3m.dartagnan.program.event.core)1 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)1 FilterBasic (com.dat3m.dartagnan.program.filter.FilterBasic)1 Preconditions (com.google.common.base.Preconditions)1 Verify (com.google.common.base.Verify)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 java.util (java.util)1 BiConsumer (java.util.function.BiConsumer)1