Search in sources :

Example 61 with Register

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

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

the class PthreadsProcedures method pthread_join.

private static void pthread_join(VisitorBoogie visitor, Call_cmdContext ctx) {
    String namePtr = ctx.call_params().exprs().expr().get(0).getText();
    // This names are global so we don't use currentScope.getID(), but per thread.
    Register callReg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, namePtr, ARCH_PRECISION);
    if (visitor.pool.getPtrFromReg(callReg) == null) {
        throw new UnsupportedOperationException("pthread_join cannot be handled");
    }
    MemoryObject object = visitor.programBuilder.getOrNewObject(String.format("%s(%s)_active", visitor.pool.getPtrFromReg(callReg), visitor.pool.getCreatorFromPtr(visitor.pool.getPtrFromReg(callReg))));
    Register reg = visitor.programBuilder.getOrCreateRegister(visitor.threadCount, null, ARCH_PRECISION);
    visitor.programBuilder.addChild(visitor.threadCount, EventFactory.Pthread.newJoin(visitor.pool.getPtrFromReg(callReg), reg, object));
}
Also used : Register(com.dat3m.dartagnan.program.Register) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject)

Example 63 with Register

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

the class ProgramBuilder method initRegEqLocPtr.

public void initRegEqLocPtr(int regThread, String regName, String locName, int precision) {
    MemoryObject object = getOrNewObject(locName);
    Register reg = getOrCreateRegister(regThread, regName, precision);
    addChild(regThread, EventFactory.newLocal(reg, object));
}
Also used : Register(com.dat3m.dartagnan.program.Register) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject)

Example 64 with Register

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

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

the class VisitorLitmusAArch64 method visitStoreExclusive.

@Override
public Object visitStoreExclusive(LitmusAArch64Parser.StoreExclusiveContext ctx) {
    Register register = programBuilder.getOrCreateRegister(mainThread, ctx.rV, ARCH_PRECISION);
    Register statusReg = programBuilder.getOrCreateRegister(mainThread, ctx.rS, ARCH_PRECISION);
    Register address = programBuilder.getOrErrorRegister(mainThread, ctx.address().id);
    if (ctx.offset() != null) {
        address = visitOffset(ctx.offset(), address);
    }
    StoreExclusive event = EventFactory.AArch64.newExclusiveStore(statusReg, address, register, ctx.storeExclusiveInstruction().mo);
    return programBuilder.addChild(mainThread, event);
}
Also used : StoreExclusive(com.dat3m.dartagnan.program.event.arch.aarch64.StoreExclusive) 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