private static List <Cmd> ProcessAssume(AssumeCmd cmd) { var ret = new List <Cmd>(); var gm = new GatherMemAccesses(); gm.VisitExpr(cmd.Expr); foreach (var tup in gm.accesses) { ret.Add(BoogieAstFactory.MkVarEqExpr(memAccess, tup.Item2)); ret.Add(Read(tup.Item1)); } ret.Add(cmd); return(ret); }
private static List <Cmd> ProcessAssign(AssignCmd cmd) { var ret = new List <Cmd>(); var reads = new GatherMemAccesses(); var writes = new List <Tuple <Variable, Expr> >(); var scalars = new List <Variable>(); foreach (var lhs in cmd.Lhss) { if (lhs is MapAssignLhs) { var ma = lhs as MapAssignLhs; ma.Indexes.Iter(e => writes.Add(Tuple.Create(ma.DeepAssignedVariable, e))); ma.Indexes.Iter(e => reads.VisitExpr(e)); } else if (lhs is SimpleAssignLhs && scalarGlobals.Contains(lhs.DeepAssignedVariable.Name)) { scalars.Add(lhs.DeepAssignedVariable); } } cmd.Rhss.Iter(e => reads.VisitExpr(e)); writes.Iter(tup => { ret.Add(BoogieAstFactory.MkVarEqExpr(memAccess, tup.Item2)); ret.Add(Write(tup.Item1)); }); reads.accesses.Iter(tup => { ret.Add(BoogieAstFactory.MkVarEqExpr(memAccess, tup.Item2)); ret.Add(Read(tup.Item1)); }); ret.Add(cmd); scalars.Iter(v => ret.Add(RecordScalar(v))); return(ret); }
private static List <Cmd> ProcessCall(CallCmd cmd) { var ret = new List <Cmd>(); var gm = new GatherMemAccesses(); cmd.Ins.Where(e => e != null).Iter(e => gm.VisitExpr(e)); foreach (var tup in gm.accesses) { ret.Add(BoogieAstFactory.MkVarEqExpr(memAccess, tup.Item2)); ret.Add(Read(tup.Item1)); } ret.Add(cmd); cmd.Outs.Where(ie => ie != null && scalarGlobals.Contains(ie.Name)) .Iter(ie => ret.Add(RecordScalar(ie.Decl))); return(ret); }