Search in sources :

Example 6 with IValue

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

the class VisitorLitmusAssertions method acceptAssertionValue.

private LastValueInterface acceptAssertionValue(LitmusAssertionsParser.AssertionValueContext ctx, boolean right) {
    if (ctx.constant() != null) {
        return new IValue(new BigInteger(ctx.constant().getText()), ARCH_PRECISION);
    }
    String name = ctx.varName().getText();
    if (ctx.threadId() != null) {
        return programBuilder.getOrErrorRegister(ctx.threadId().id, name);
    }
    MemoryObject base = programBuilder.getObject(name);
    checkState(base != null, "uninitialized location %s", name);
    TerminalNode offset = ctx.DigitSequence();
    int o = offset == null ? 0 : Integer.parseInt(offset.getText());
    return right && offset == null ? base : new Location(name, base, o);
}
Also used : IValue(com.dat3m.dartagnan.expression.IValue) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) BigInteger(java.math.BigInteger) TerminalNode(org.antlr.v4.runtime.tree.TerminalNode) Location(com.dat3m.dartagnan.program.memory.Location)

Example 7 with IValue

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

the class VisitorLitmusPPC method visitLi.

@Override
public Object visitLi(LitmusPPCParser.LiContext ctx) {
    Register register = programBuilder.getOrCreateRegister(mainThread, ctx.register().getText(), ARCH_PRECISION);
    IValue constant = new IValue(new BigInteger(ctx.constant().getText()), ARCH_PRECISION);
    return programBuilder.addChild(mainThread, EventFactory.newLocal(register, constant));
}
Also used : IValue(com.dat3m.dartagnan.expression.IValue) Register(com.dat3m.dartagnan.program.Register) BigInteger(java.math.BigInteger)

Example 8 with IValue

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

Example 9 with IValue

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

the class VisitorLitmusX86 method visitStoreValueToLocation.

@Override
public Object visitStoreValueToLocation(LitmusX86Parser.StoreValueToLocationContext ctx) {
    MemoryObject object = programBuilder.getOrNewObject(ctx.location().getText());
    IValue constant = new IValue(new BigInteger(ctx.constant().getText()), ARCH_PRECISION);
    return programBuilder.addChild(mainThread, EventFactory.newStore(object, constant, "_rx"));
}
Also used : IValue(com.dat3m.dartagnan.expression.IValue) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) BigInteger(java.math.BigInteger)

Example 10 with IValue

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

the class VisitorLitmusAArch64 method visitOffset.

private Register visitOffset(LitmusAArch64Parser.OffsetContext ctx, Register register) {
    Register result = programBuilder.getOrCreateRegister(mainThread, null, ARCH_PRECISION);
    IExpr expr = ctx.immediate() == null ? programBuilder.getOrErrorRegister(mainThread, ctx.expressionConversion().register32().id) : new IValue(new BigInteger(ctx.immediate().constant().getText()), ARCH_PRECISION);
    programBuilder.addChild(mainThread, EventFactory.newLocal(result, new IExprBin(register, IOpBin.PLUS, expr)));
    return result;
}
Also used : IExprBin(com.dat3m.dartagnan.expression.IExprBin) IValue(com.dat3m.dartagnan.expression.IValue) Register(com.dat3m.dartagnan.program.Register) BigInteger(java.math.BigInteger) IExpr(com.dat3m.dartagnan.expression.IExpr)

Aggregations

IValue (com.dat3m.dartagnan.expression.IValue)11 BigInteger (java.math.BigInteger)10 IExprBin (com.dat3m.dartagnan.expression.IExprBin)5 Register (com.dat3m.dartagnan.program.Register)5 IExpr (com.dat3m.dartagnan.expression.IExpr)4 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)2 BooleanFormula (org.sosy_lab.java_smt.api.BooleanFormula)2 BooleanFormulaManager (org.sosy_lab.java_smt.api.BooleanFormulaManager)2 Utils.generalEqual (com.dat3m.dartagnan.expression.utils.Utils.generalEqual)1 ExecutionAnalysis (com.dat3m.dartagnan.program.analysis.ExecutionAnalysis)1 Event (com.dat3m.dartagnan.program.event.core.Event)1 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)1 Location (com.dat3m.dartagnan.program.memory.Location)1 StaticRelation (com.dat3m.dartagnan.wmm.relation.base.stat.StaticRelation)1 Tuple (com.dat3m.dartagnan.wmm.utils.Tuple)1 TupleSet (com.dat3m.dartagnan.wmm.utils.TupleSet)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Collection (java.util.Collection)1 List (java.util.List)1