コード例 #1
0
ファイル: VCDoomed.cs プロジェクト: Chenguang-Zhu/ICE-C5
        private void Transform4DoomedCheck(Implementation impl)
        {
            variable2SequenceNumber = new Dictionary<Variable, int>();
            incarnationOriginMap = new Dictionary<Incarnation, Absy>();
            if (impl.Blocks.Count < 1) return;

            impl.PruneUnreachableBlocks();
            AddBlocksBetween(impl.Blocks);
            ResetPredecessors(impl.Blocks);

            GraphAnalyzer ga = new GraphAnalyzer(impl.Blocks);
            LoopRemover lr = new LoopRemover(ga);
            lr.AbstractLoopUnrolling();

            impl.Blocks = ga.ToImplementation(out m_UncheckableBlocks);
            ResetPredecessors(impl.Blocks);

            // Check for the "BlocksBetween" if all their successors are in m_UncheckableBlocks
            List<Block> oldblocks = new List<Block>();
            oldblocks.AddRange(impl.Blocks);
            GenerateHelperBlocks(impl);
            #region Check for the "BlocksBetween" if all their successors are in m_UncheckableBlocks
            foreach (Block b in impl.Blocks)
            {
            if (oldblocks.Contains(b)) continue;
            GotoCmd gc = b.TransferCmd as GotoCmd;
            if (gc != null)
            {
                bool allsuccUncheckable = true;
                foreach (Block _b in gc.labelTargets)
                {
                    if (!m_UncheckableBlocks.Contains(_b))
                    {
                        allsuccUncheckable = false; break;
                    }
                }
                if (allsuccUncheckable && !m_UncheckableBlocks.Contains(b)) m_UncheckableBlocks.Add(b);
            }
            }
            #endregion

            impl.Blocks = DeepCopyBlocks(impl.Blocks, m_UncheckableBlocks);

            m_BlockReachabilityMap = new Dictionary<Block, Variable>();
            List<Cmd> cs = GenerateReachabilityPredicates(impl);

            //foreach (Block test in getTheFFinalBlock(impl.Blocks[0]))
            //{
            //    test.Cmds.AddRange(cs);
            //}

            ResetPredecessors(impl.Blocks);
            //EmitImpl(impl,false);

            Dictionary<Variable, Expr> var2Expr = PassifyProgram(impl, new ModelViewInfo(program, impl));

            // Collect the last incarnation of each reachability variable in the passive program
            foreach (KeyValuePair<Block, Variable> kvp in m_BlockReachabilityMap)
            {
            if (var2Expr.ContainsKey(kvp.Value))
            {
                m_LastReachVarIncarnation[kvp.Value] = (Expr)var2Expr[kvp.Value];
            }
            }
        }
コード例 #2
0
ファイル: VCDoomed.cs プロジェクト: omaragb/tlp182
        private void Transform4DoomedCheck(Implementation impl)
        {
            variable2SequenceNumber = new Dictionary <Variable, int>();
            incarnationOriginMap    = new Dictionary <Incarnation, Absy>();
            if (impl.Blocks.Count < 1)
            {
                return;
            }

            impl.PruneUnreachableBlocks();
            AddBlocksBetween(impl.Blocks);
            ResetPredecessors(impl.Blocks);

            GraphAnalyzer ga = new GraphAnalyzer(impl.Blocks);
            LoopRemover   lr = new LoopRemover(ga);

            lr.AbstractLoopUnrolling();

            impl.Blocks = ga.ToImplementation(out m_UncheckableBlocks);
            ResetPredecessors(impl.Blocks);

            // Check for the "BlocksBetween" if all their successors are in m_UncheckableBlocks
            List <Block> oldblocks = new List <Block>();

            oldblocks.AddRange(impl.Blocks);
            GenerateHelperBlocks(impl);
            #region Check for the "BlocksBetween" if all their successors are in m_UncheckableBlocks
            foreach (Block b in impl.Blocks)
            {
                if (oldblocks.Contains(b))
                {
                    continue;
                }
                GotoCmd gc = b.TransferCmd as GotoCmd;
                if (gc != null)
                {
                    bool allsuccUncheckable = true;
                    foreach (Block _b in gc.labelTargets)
                    {
                        if (!m_UncheckableBlocks.Contains(_b))
                        {
                            allsuccUncheckable = false; break;
                        }
                    }
                    if (allsuccUncheckable && !m_UncheckableBlocks.Contains(b))
                    {
                        m_UncheckableBlocks.Add(b);
                    }
                }
            }
            #endregion

            impl.Blocks = DeepCopyBlocks(impl.Blocks, m_UncheckableBlocks);

            m_BlockReachabilityMap = new Dictionary <Block, Variable>();
            List <Cmd> cs = GenerateReachabilityPredicates(impl);

            //foreach (Block test in getTheFFinalBlock(impl.Blocks[0]))
            //{
            //    test.Cmds.AddRange(cs);
            //}

            ResetPredecessors(impl.Blocks);
            //EmitImpl(impl,false);

            Dictionary <Variable, Expr> var2Expr = PassifyProgram(impl, new ModelViewInfo(program, impl));

            // Collect the last incarnation of each reachability variable in the passive program
            foreach (KeyValuePair <Block, Variable> kvp in m_BlockReachabilityMap)
            {
                if (var2Expr.ContainsKey(kvp.Value))
                {
                    m_LastReachVarIncarnation[kvp.Value] = (Expr)var2Expr[kvp.Value];
                }
            }
        }