Search in sources :

Example 86 with Register

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

the class VisitorLitmusC method visitReOpBoolNot.

@Override
public ExprInterface visitReOpBoolNot(LitmusCParser.ReOpBoolNotContext ctx) {
    Register register = getReturnRegister(false);
    ExprInterface v = (ExprInterface) ctx.re().accept(this);
    BExprUn result = new BExprUn(BOpUn.NOT, v);
    return assignToReturnRegister(register, result);
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 87 with Register

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

the class VisitorLitmusC method visitVarName.

// ----------------------------------------------------------------------------------------------------------------
// Utils
@Override
public IExpr visitVarName(LitmusCParser.VarNameContext ctx) {
    if (scope > -1) {
        Register register = programBuilder.getRegister(scope, ctx.getText());
        if (register != null) {
            return register;
        }
        MemoryObject object = programBuilder.getObject(ctx.getText());
        if (object != null) {
            register = programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
            programBuilder.addChild(currentThread, EventFactory.newLoad(register, object, "NA"));
            return register;
        }
        return programBuilder.getOrCreateRegister(scope, ctx.getText(), ARCH_PRECISION);
    }
    MemoryObject object = programBuilder.getOrNewObject(ctx.getText());
    Register register = programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
    programBuilder.addChild(currentThread, EventFactory.newLoad(register, object, "NA"));
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject)

Example 88 with Register

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

the class VisitorLitmusC method visitReAtomicOpReturn.

// ----------------------------------------------------------------------------------------------------------------
// Return expressions (memory reads, must have register for return value)
// Returns new value (the value after computation)
@Override
public IExpr visitReAtomicOpReturn(LitmusCParser.ReAtomicOpReturnContext ctx) {
    Register register = getReturnRegister(true);
    IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
    Event event = EventFactory.Linux.newRMWOpReturn(getAddress(ctx.address), register, value, ctx.op, ctx.mo);
    programBuilder.addChild(currentThread, event);
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 89 with Register

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

the class VisitorLitmusC method getReturnRegister.

private Register getReturnRegister(boolean createOnNull) {
    Register register = returnRegister;
    if (register == null && createOnNull) {
        return programBuilder.getOrCreateRegister(scope, null, ARCH_PRECISION);
    }
    returnRegister = null;
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 90 with Register

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

the class VisitorLitmusC method visitReAtomicFetchOp.

// Returns old value (the value before computation)
@Override
public IExpr visitReAtomicFetchOp(LitmusCParser.ReAtomicFetchOpContext ctx) {
    Register register = getReturnRegister(true);
    IExpr value = returnExpressionOrDefault(ctx.value, BigInteger.ONE);
    Event event = EventFactory.Linux.newRMWFetchOp(getAddress(ctx.address), register, value, ctx.op, ctx.mo);
    programBuilder.addChild(currentThread, event);
    return register;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Event(com.dat3m.dartagnan.program.event.core.Event)

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