public AIntLiteralExpIR getDefaultNatValue() { return consIntLiteral(0L); }
public AIntLiteralExpIR getDefaultNat1Value() { return consIntLiteral(1L); }
public AIntLiteralExpIR getDefaultIntValue() { return consIntLiteral(0L); }
private CounterData consCounterData() { AExternalTypeIR type = new AExternalTypeIR(); type.setName("Long"); IRInfo irInfo = codeGen.getIRGenerator().getIRInfo(); AIntLiteralExpIR initExp = irInfo.getExpAssistant().consIntLiteral(0); return new CounterData(type, initExp); }
public SExpIR consLessThanCheck(String varName, long value) { AIdentifierVarExpIR left = new AIdentifierVarExpIR(); left.setType(new AIntNumericBasicTypeIR()); left.setIsLocal(true); left.setName(varName); AIntLiteralExpIR right = info.getExpAssistant().consIntLiteral(value); ALessNumericBinaryExpIR less = new ALessNumericBinaryExpIR(); less.setType(new ABoolBasicTypeIR()); less.setLeft(left); less.setRight(right); return less; }
@Override public TraceNodeData caseARepeatTraceDeclIR(ARepeatTraceDeclIR node) throws AnalysisException { Long from = node.getFrom(); Long to = node.getTo(); if (from == 1 && to == 1) { return node.getCore().apply(this); } else { String name = getInfo().getTempVarNameGen().nextVarName(traceTrans.getTracePrefixes().repeatTraceNodeNamePrefix()); TraceNodeData traceData = node.getCore().apply(this); AIdentifierVarExpIR varArg = traceData.getNodeVar(); AIntLiteralExpIR fromArg = getInfo().getExpAssistant().consIntLiteral(from); AIntLiteralExpIR toArg = getInfo().getExpAssistant().consIntLiteral(to); AClassTypeIR repeat = getTransAssist().consClassType(traceTrans.getTracePrefixes().repeatTraceNodeNamePrefix()); ABlockStmIR block = new ABlockStmIR(); block.getStatements().add(traceData.getStms()); block.getStatements().add(consDecl(traceTrans.getTracePrefixes().repeatTraceNodeNodeClassName(), name, varArg, fromArg, toArg)); return new TraceNodeData(getInfo().getExpAssistant().consIdVar(name, repeat), block, block); } }
@Override public List<SStmIR> getPostOuterBlockStms(AIdentifierVarExpIR setVar, List<SPatternIR> patterns) { AEqualsBinaryExpIR noMatches = new AEqualsBinaryExpIR(); noMatches.setType(new ABoolBasicTypeIR()); noMatches.setLeft(transAssist.getInfo().getExpAssistant().consIdVar(counterName, new AIntNumericBasicTypeIR())); noMatches.setRight(transAssist.getInfo().getExpAssistant().consIntLiteral(0)); AIfStmIR ifStm = new AIfStmIR(); ifStm.setIfExp(noMatches); ifStm.setThenStm(consIotaMultipleResultsError()); return packStm(ifStm); }
@Override public void caseAExists1QuantifierExpIR(AExists1QuantifierExpIR node) throws AnalysisException { SStmIR enclosingStm = transAssistant.getEnclosingStm(node, "exists1 expression"); SExpIR predicate = node.getPredicate(); ITempVarGen tempVarNameGen = transAssistant.getInfo().getTempVarNameGen(); String var = tempVarNameGen.nextVarName(prefixes.exists1()); Exists1QuantifierStrategy strategy = consExists1QuantifierStrategy(predicate, tempVarNameGen, var); List<SMultipleBindIR> multipleSetBinds = filterBindList(node, node.getBindList()); ABlockStmIR block = transAssistant.consComplexCompIterationBlock(multipleSetBinds, tempVarNameGen, strategy, iteVarPrefixes); if (multipleSetBinds.isEmpty()) { ABoolLiteralExpIR exists1Result = transAssistant.getInfo().getExpAssistant().consBoolLiteral(false); transAssistant.replaceNodeWith(node, exists1Result); } else { AIdentifierVarExpIR counter = new AIdentifierVarExpIR(); counter.setType(new AIntNumericBasicTypeIR()); counter.setIsLocal(true); counter.setName(var); AEqualsBinaryExpIR exists1Result = new AEqualsBinaryExpIR(); exists1Result.setType(new ABoolBasicTypeIR()); exists1Result.setLeft(counter); exists1Result.setRight(transAssistant.getInfo().getExpAssistant().consIntLiteral(1)); transform(enclosingStm, block, exists1Result, node); block.apply(this); } }
tooManyMatches.setType(new ABoolBasicTypeIR()); tooManyMatches.setLeft(transAssist.getInfo().getExpAssistant().consIdVar(counterName, new ANatNumericBasicTypeIR())); tooManyMatches.setRight(transAssist.getInfo().getExpAssistant().consIntLiteral(1));
AIntLiteralExpIR intLit = transAssistant.getInfo().getExpAssistant().consIntLiteral(value);