public override IAstNode VisitWriteStmt(MicroCParser.WriteStmtContext context) { var label = ++_label; IAExpr value = Visit(context.a_expr()) as IAExpr; var writeStmt = new WriteStmt(value); writeStmt.Label = label; return(writeStmt); }
protected override ILattice <FVDomain> TransferFunctions(int label) { var block = GetBlock(label); var domain = _analysisCircle[label].GetDomain(); var newDomain = block switch { AssignStmt assignStmt => AssignTransfer(assignStmt, domain), RecAssignStmt recAssignStmt => RecAssignTransfer(recAssignStmt, domain), IfStmt ifStmt => ConditionTransfer(ifStmt.Condition, domain), IfElseStmt ifElseStmt => ConditionTransfer(ifElseStmt.Condition, domain), WhileStmt whileStmt => ConditionTransfer(whileStmt.Condition, domain), WriteStmt writeStmt => WriteTransfer(writeStmt, domain), ReadStmt readStmt => ReadTransfer(readStmt, domain), _ => new FVDomain(), }; return(new FVLattice(newDomain)); }
protected override ILattice <IADomain> TransferFunctions(int label) { var block = GetBlock(label); var domain = _analysisCircle[label].GetDomain(); var newDomain = block switch { IntDecl intDecl => IntDeclTransfer(intDecl, domain), ArrayDecl arrayDecl => ArrayDeclTransfer(arrayDecl, domain), RecordDecl recordDecl => RecDeclTransfer(recordDecl, domain), AssignStmt assignStmt => AssignTransfer(assignStmt, domain), RecAssignStmt recAssignStmt => RecAssignTransfer(recAssignStmt, domain), IfStmt ifStmt => IdTransfer(ifStmt, domain), IfElseStmt ifElseStmt => IdTransfer(ifElseStmt, domain), WhileStmt whileStmt => IdTransfer(whileStmt, domain), WriteStmt writeStmt => IdTransfer(writeStmt, domain), ReadStmt readStmt => ReadTransfer(readStmt, domain), _ => Bottom().GetDomain(), }; return(new IALattice(newDomain)); }
private FVDomain WriteTransfer(WriteStmt writeStmt, FVDomain domain) => domain.Union(AnalysisUtil.FreeVariables(writeStmt.Left)).ToFVDomain();
private DSDomain WriteTransfer(WriteStmt writeStmt, DSDomain domain) => CopyDomain(domain);