Search in sources :

Example 96 with Register

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

the class VisitorLitmusC method visitNreAssignment.

@Override
public Object visitNreAssignment(LitmusCParser.NreAssignmentContext ctx) {
    ExprInterface variable = (ExprInterface) ctx.varName().accept(this);
    if (ctx.Ast() == null) {
        if (variable instanceof Register) {
            returnRegister = (Register) variable;
            ctx.re().accept(this);
            return null;
        }
        throw new ParsingException("Invalid syntax near " + ctx.getText());
    }
    ExprInterface value = (ExprInterface) ctx.re().accept(this);
    if (variable instanceof MemoryObject || variable instanceof Register) {
        Event event = EventFactory.newStore((IExpr) variable, value, "NA");
        return programBuilder.addChild(currentThread, event);
    }
    throw new ParsingException("Invalid syntax near " + ctx.getText());
}
Also used : Register(com.dat3m.dartagnan.program.Register) ParsingException(com.dat3m.dartagnan.exception.ParsingException) MemoryObject(com.dat3m.dartagnan.program.memory.MemoryObject) Event(com.dat3m.dartagnan.program.event.core.Event)

Example 97 with Register

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

the class VisitorLitmusC method visitNreRegDeclaration.

@Override
public Object visitNreRegDeclaration(LitmusCParser.NreRegDeclarationContext ctx) {
    Register register = programBuilder.getRegister(scope, ctx.varName().getText());
    if (register == null) {
        register = programBuilder.getOrCreateRegister(scope, ctx.varName().getText(), ARCH_PRECISION);
        if (ctx.re() != null) {
            returnRegister = register;
            ctx.re().accept(this);
        }
        return null;
    }
    throw new ParsingException("Register " + ctx.varName().getText() + " is already initialised");
}
Also used : Register(com.dat3m.dartagnan.program.Register) ParsingException(com.dat3m.dartagnan.exception.ParsingException)

Example 98 with Register

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

the class VisitorLitmusC method visitReVarName.

@Override
public ExprInterface visitReVarName(LitmusCParser.ReVarNameContext ctx) {
    Register register = getReturnRegister(false);
    IExpr variable = visitVarName(ctx.varName());
    if (variable instanceof Register) {
        Register result = (Register) variable;
        return assignToReturnRegister(register, result);
    }
    throw new ParsingException("Invalid syntax near " + ctx.getText());
}
Also used : Register(com.dat3m.dartagnan.program.Register) ParsingException(com.dat3m.dartagnan.exception.ParsingException)

Example 99 with Register

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

the class VisitorLitmusLISA method visitLocal.

@Override
public Object visitLocal(LitmusLISAParser.LocalContext ctx) {
    Register reg = programBuilder.getOrCreateRegister(mainThread, ctx.register().getText(), ARCH_PRECISION);
    ExprInterface e = (ExprInterface) ctx.expression().accept(this);
    programBuilder.addChild(mainThread, EventFactory.newLocal(reg, e));
    return null;
}
Also used : Register(com.dat3m.dartagnan.program.Register)

Example 100 with Register

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

the class VisitorLitmusLISA method visitJump.

@Override
public Object visitJump(LitmusLISAParser.JumpContext ctx) {
    Label label = programBuilder.getOrCreateLabel(ctx.labelName().getText());
    Register reg = (Register) ctx.register().accept(this);
    Atom cond = new Atom(reg, COpBin.EQ, IValue.ONE);
    programBuilder.addChild(mainThread, EventFactory.newJump(cond, label));
    return null;
}
Also used : Register(com.dat3m.dartagnan.program.Register) Label(com.dat3m.dartagnan.program.event.core.Label)

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