public override CBAProgram runCBAPass(CBAProgram p) { // Type information is needed in some cases. For instance, the Command // Mem[x] := untracked-expr is converted to havoc temp; Mem[x] := temp. Here // we need the type of "untracked-expr" or of "Mem[x]" if (p.Typecheck() != 0) { p.Emit(new TokenTextWriter("error.bpl")); throw new InternalError("Type errors"); } vslice.VisitProgram(p as Program); BoogieUtil.DoModSetAnalysis(p); return(p); }
public Program run(Program node) { globalsRead = new HashSet <string>(); // Typecheck -- needed for variable abstraction if (node.Typecheck() != 0) { BoogieUtil.PrintProgram(node, "error.bpl"); throw new InternalError("Type errors"); } // Go through all procedures and implementations (slice locals) var TopLevelDeclarations = node.TopLevelDeclarations.ToList(); for (int i = 0; i < TopLevelDeclarations.Count; i++) { if (TopLevelDeclarations[i] is Implementation) { TopLevelDeclarations[i] = processImplementation(TopLevelDeclarations[i] as Implementation); } else if (TopLevelDeclarations[i] is Procedure) { processProcedure(TopLevelDeclarations[i] as Procedure); } } node.TopLevelDeclarations = TopLevelDeclarations; if (onlyLocals) { return(node); } sliceGlobals = new VariableSlicing(VarSet.ToVarSet(globalsRead, node), gtinfo); node = sliceGlobals.VisitProgram(node); BoogieUtil.DoModSetAnalysis(node); return(node); }