///////////////////////////////////////////////////////
        public ProcedureImp getProcedure(Implementation implementation)
        {
            var p = new ProcedureImp(implementation.Name, program, implementation);

            p.setCFG(StructuredProgramToCFG.makeCFGFromDAG(implementation, boogieProgram, p));
            return(p);
        }
Exemplo n.º 2
0
        private static void FOLAnalyzer(ProcedureImp procedure)
        {
            var analysisSW = new Stopwatch();

            analysisSW.Start();
            Console.WriteLine("FOLing around:");
            Analyzers.FOLConverter.Slicer.slice(procedure);
            analysisSW.Stop();
            Console.WriteLine("FOL - {0,6}s", analysisSW.ElapsedMilliseconds / 1000);
        }
Exemplo n.º 3
0
        private static void recordExps(ProcedureImp procedure, ref Dictionary <string, IList <Expression> > dir)
        {
            dir = new Dictionary <string, IList <Expression> >();
            foreach (var bb in procedure.blocks)
            {
                var n  = bb.statements.Count;
                var nn = n - 1;
                if (bb.successors.Count == 0)
                {
                    while (nn >= 0)
                    {
                        var s = bb.statements[nn].statement as Assert;
                        if (s != null)
                        {
                            break;
                        }
                        nn--;
                    }
                }
                var nnn = nn;
                while (nnn >= 0)
                {
                    var s = bb.statements[nnn].statement as Assume;
                    if (s != null && isFalse(s.expression))
                    {
                        nnn--;
                        while (nnn > 0)
                        {
                            var ss = bb.statements[nnn].statement as Assert;
                            if (ss != null)
                            {
                                nnn++;
                                break;
                            }
                            nnn--;
                        }
                        nn = nnn;
                    }
                    nnn--;
                }

                n = nn;

                dir[bb.label] = new List <Expression>();
                for (var i = 0; i < n; i++)
                {
                    var si = bb.statements[i];
                    if (si.statement is PredicateStatement)
                    {
                        dir[bb.label].Add((si.statement as PredicateStatement).expression);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private string getBaseFileName(ProcedureImp procedure)
        {
            string fileName = Microsoft.Boogie.CommandLineOptions.Clo.Files.First();

            if (fileName.EndsWith(@".bpl"))
            {
                fileName = fileName.Substring(0, fileName.Length - 4);
            }
            int originalStatementCount = procedure.numStatements;

            string baseFileName = calculateBaseFileName(fileName);

            return(baseFileName);
        }
Exemplo n.º 5
0
        ///////////////////////////////////////////////////////
        public void dumpCFG(ProcedureImp p)
        {
            dumpCFGPrefix();

            ////////////////////////////////////
            dumpCFGNodesHTML(p.blocks);
            cfgFile.WriteLine();
            dumpCFGEdges(p.blocks);

            ////////////////////////////////////
            //Finish Dump
            dumpCFGPostfix();
            cfgFile.Close();

            runDOT(fileName);
        }