use of com.dat3m.dartagnan.expression.op.BOpUn.NOT in project Dat3M by hernanponcedeleon.
the class VisitorBoogie method visitFun_expr.
@Override
public Object visitFun_expr(Fun_exprContext ctx) {
String name = ctx.Ident().getText();
Function function = functions.get(name);
if (function == null) {
throw new ParsingException("Function " + name + " is not defined");
}
if (name.contains("$load.")) {
return ctx.expr(1).accept(this);
}
if (name.contains("$store.")) {
if (smackDummyVariables.contains(ctx.expr(1).getText())) {
return null;
}
IExpr address = (IExpr) ctx.expr(1).accept(this);
IExpr value = (IExpr) ctx.expr(2).accept(this);
// This improves the blow-up
if (initMode && !(value instanceof MemoryObject)) {
ExprInterface lhs = address;
int rhs = 0;
while (lhs instanceof IExprBin) {
rhs += ((IExprBin) lhs).getRHS().reduce().getValueAsInt();
lhs = ((IExprBin) lhs).getLHS();
}
String text = ctx.expr(1).getText();
String[] split = text.split("add.ref");
if (split.length > 1) {
text = split[split.length - 1];
text = text.substring(text.indexOf("(") + 1, text.indexOf(","));
}
programBuilder.getOrNewObject(text).appendInitialValue(rhs, value.reduce());
return null;
}
programBuilder.addChild(threadCount, EventFactory.newStore(address, value, null)).setCLine(currentLine).setSourceCodeFile(sourceCodeFile);
return null;
}
// push currentCall to the call stack
List<Object> callParams = ctx.expr().stream().map(e -> e.accept(this)).collect(Collectors.toList());
currentCall = new FunctionCall(function, callParams, currentCall);
if (LLVMFUNCTIONS.stream().anyMatch(name::startsWith)) {
currentCall = currentCall.getParent();
return llvmFunction(name, callParams);
}
if (LLVMPREDICATES.stream().anyMatch(name::equals)) {
currentCall = currentCall.getParent();
return llvmPredicate(name, callParams);
}
if (LLVMUNARY.stream().anyMatch(name::startsWith)) {
currentCall = currentCall.getParent();
return llvmUnary(name, callParams);
}
if (SMACKPREDICATES.stream().anyMatch(name::equals)) {
currentCall = currentCall.getParent();
return smackPredicate(name, callParams);
}
// Some functions do not have a body
if (function.getBody() == null) {
throw new ParsingException("Function " + name + " has no implementation");
}
Object ret = function.getBody().accept(this);
// pop currentCall from the call stack
currentCall = currentCall.getParent();
return ret;
}
Aggregations