Search in sources :

Example 6 with IExpr

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

the class AtomicProcedures method atomicLoad.

private static void atomicLoad(VisitorBoogie visitor, Call_cmdContext ctx) {
    Register reg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, visitor.currentScope.getID() + ":" + ctx.call_params().Ident(0).getText(), ARCH_PRECISION);
    IExpr add = (IExpr) ctx.call_params().exprs().expr().get(0).accept(visitor);
    String mo = null;
    if (ctx.call_params().exprs().expr().size() > 1) {
        mo = intToMo(((IConst) ctx.call_params().exprs().expr().get(1).accept(visitor)).getValueAsInt());
    }
    visitor.programBuilder.addChild(visitor.threadCount, Atomic.newLoad(reg, add, mo)).setCLine(visitor.currentLine).setSourceCodeFile(visitor.sourceCodeFile);
}
Also used : Register(com.dat3m.dartagnan.program.Register) IExpr(com.dat3m.dartagnan.expression.IExpr) IConst(com.dat3m.dartagnan.expression.IConst)

Example 7 with IExpr

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

the class PthreadsProcedures method mutexUnlock.

private static void mutexUnlock(VisitorBoogie visitor, Call_cmdContext ctx) {
    ExprsContext lock = ctx.call_params().exprs();
    Register register = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, null, ARCH_PRECISION);
    IExpr lockAddress = (IExpr) lock.accept(visitor);
    if (lockAddress != null) {
        visitor.programBuilder.addChild(visitor.threadCount, EventFactory.Pthread.newUnlock(lock.getText(), lockAddress, register));
    }
}
Also used : Register(com.dat3m.dartagnan.program.Register) ExprsContext(com.dat3m.dartagnan.parsers.BoogieParser.ExprsContext) IExpr(com.dat3m.dartagnan.expression.IExpr)

Example 8 with IExpr

use of com.dat3m.dartagnan.expression.IExpr 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 9 with IExpr

use of com.dat3m.dartagnan.expression.IExpr 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 10 with IExpr

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

the class VisitorLitmusAArch64 method visitMov.

@Override
public Object visitMov(LitmusAArch64Parser.MovContext ctx) {
    Register register = programBuilder.getOrCreateRegister(mainThread, ctx.rD, ARCH_PRECISION);
    IExpr expr = ctx.expr32() != null ? (IExpr) ctx.expr32().accept(this) : (IExpr) ctx.expr64().accept(this);
    return programBuilder.addChild(mainThread, EventFactory.newLocal(register, expr));
}
Also used : Register(com.dat3m.dartagnan.program.Register) IExpr(com.dat3m.dartagnan.expression.IExpr)

Aggregations

IExpr (com.dat3m.dartagnan.expression.IExpr)23 Register (com.dat3m.dartagnan.program.Register)16 IConst (com.dat3m.dartagnan.expression.IConst)7 IExprBin (com.dat3m.dartagnan.expression.IExprBin)6 ExprInterface (com.dat3m.dartagnan.expression.ExprInterface)4 IValue (com.dat3m.dartagnan.expression.IValue)4 BigInteger (java.math.BigInteger)4 ExprsContext (com.dat3m.dartagnan.parsers.BoogieParser.ExprsContext)2 Event (com.dat3m.dartagnan.program.event.core.Event)2 RegWriter (com.dat3m.dartagnan.program.event.core.utils.RegWriter)2 MemoryObject (com.dat3m.dartagnan.program.memory.MemoryObject)2 ParsingException (com.dat3m.dartagnan.exception.ParsingException)1 Atom (com.dat3m.dartagnan.expression.Atom)1 IOpBin (com.dat3m.dartagnan.expression.op.IOpBin)1 PLUS (com.dat3m.dartagnan.expression.op.IOpBin.PLUS)1 ExprContext (com.dat3m.dartagnan.parsers.BoogieParser.ExprContext)1 Program (com.dat3m.dartagnan.program.Program)1 AliasAnalysis (com.dat3m.dartagnan.program.analysis.AliasAnalysis)1 Tag (com.dat3m.dartagnan.program.event.Tag)1 com.dat3m.dartagnan.program.event.core (com.dat3m.dartagnan.program.event.core)1