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());
}
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");
}
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());
}
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;
}
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;
}
Aggregations