static void AddIrql(Procedure proc, Program program) { var v1 = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "pm_loop_loc", Microsoft.Boogie.Type.Int)); v1.AddAttribute("template"); v1.AddAttribute("includeLoopLocals"); proc.Ensures.Add(new Ensures(false, Expr.Eq(Expr.Ident(v1), new OldExpr(Token.NoToken, Expr.Ident(v1))))); program.TopLevelDeclarations.Add(v1); }
Variable CreateLoopVar(int cnt) { if (!template_var_loop.ContainsKey(cnt)) { var nvar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "pm_tvar_loop_" + (cnt).ToString(), Microsoft.Boogie.Type.Int)); nvar.AddAttribute("template"); nvar.AddAttribute("includeLoopLocals"); template_var_loop.Add(cnt, nvar); } return(template_var_loop[cnt]); }
Variable CreateFormalOut(int cnt) { if (!template_var_out.ContainsKey(cnt)) { var nvar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "pm_tvar_out_" + (cnt).ToString(), Microsoft.Boogie.Type.Int)); nvar.AddAttribute("template"); nvar.AddAttribute("includeFormalOut"); template_var_out.Add(cnt, nvar); } return(template_var_out[cnt]); }
private void AddAccessCheckingVariables() { for (int i = 0; i < this.MemoryRegions.Count; i++) { var wavar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "WRITTEN_" + this.MemoryRegions[i].Name + "_$" + this.EP.Name, Microsoft.Boogie.Type.Bool)); var ravar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "READ_" + this.MemoryRegions[i].Name + "_$" + this.EP.Name, Microsoft.Boogie.Type.Bool)); wavar.AddAttribute("access_checking", new object[] { }); ravar.AddAttribute("access_checking", new object[] { }); if (!this.AC.TopLevelDeclarations.OfType <Variable>().Any(val => val.Name.Equals(wavar.Name))) { this.AC.TopLevelDeclarations.Add(wavar); } if (!this.AC.TopLevelDeclarations.OfType <Variable>().Any(val => val.Name.Equals(ravar.Name))) { this.AC.TopLevelDeclarations.Add(ravar); } } }
private void AddCurrentLocksets() { foreach (var l in this.AC.GetLockVariables()) { var ls = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, l.Name + "_in_CLS_$" + this.EP.Name, Microsoft.Boogie.Type.Bool)); ls.AddAttribute("current_lockset", new object[] { }); this.AC.TopLevelDeclarations.Add(ls); this.AC.CurrentLocksets.Add(new Lockset(ls, l, this.EP)); } }
Function collectBoolFunc, collectIntFunc, collectMapFunc; //functions to accumulate out := f(out, assign) public RefinedStmtTaintInstrumentation(Program prog, HashSet <Implementation> modifiedImpls) { this.prog = prog; syntacticModifiedImpls = modifiedImpls; guardWritesConsts = new Dictionary <AssignCmd, Constant>(); globalCollectAssignmentsVar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, globalCollectAssignName, BType.Int)); globalCollectAssignmentsVar.AddAttribute(globalCollectAssignVarAttribute, Expr.True); prog.AddTopLevelDeclaration(globalCollectAssignmentsVar); InitializeFuncs(); currImpl = null; }
private void AddMemoryLocksets() { foreach (var mr in this.MemoryRegions) { foreach (var l in this.AC.GetLockVariables()) { var ls = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, l.Name + "_in_LS_" + mr.Name + "_$" + this.EP.Name, Microsoft.Boogie.Type.Bool)); ls.AddAttribute("lockset", new object[] { }); this.AC.TopLevelDeclarations.Add(ls); this.AC.MemoryLocksets.Add(new Lockset(ls, l, this.EP, mr.Name)); } } }
private void AddAccessCheckingVariables(Thread thread) { foreach (var mr in this.AC.ThreadMemoryRegions[thread]) { var wavar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "WRITTEN_" + mr.Name + "_$" + thread.Name + "_$" + thread.Id, Microsoft.Boogie.Type.Bool)); var ravar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "READ_" + mr.Name + "_$" + thread.Name + "_$" + thread.Id, Microsoft.Boogie.Type.Bool)); wavar.AddAttribute("access_checking", new object[] { }); ravar.AddAttribute("access_checking", new object[] { }); if (!this.AC.TopLevelDeclarations.OfType <Variable>().Any(val => val.Name.Equals(wavar.Name))) { this.AC.TopLevelDeclarations.Add(wavar); } if (!this.AC.TopLevelDeclarations.OfType <Variable>().Any(val => val.Name.Equals(ravar.Name))) { this.AC.TopLevelDeclarations.Add(ravar); } } }