public virtual Dictionary <int, HashSet <int> > GetExtendedPostdominators(Statement
                                                                                  statement)
        {
            this.statement = statement;
            HashSet <int> set = new HashSet <int>();

            foreach (Statement st in statement.GetStats())
            {
                set.Add(st.id);
            }
            this.factory            = new FastFixedSetFactory <int>(set);
            lstReversePostOrderList = statement.GetReversePostOrderList();
            //		try {
            //			DotExporter.toDotFile(statement, new File("c:\\Temp\\stat1.dot"));
            //		} catch (Exception ex) {
            //			ex.printStackTrace();
            //		}
            CalcDefaultReachableSets();
            RemoveErroneousNodes();
            DominatorTreeExceptionFilter filter = new DominatorTreeExceptionFilter(statement);

            filter.Initialize();
            FilterOnExceptionRanges(filter);
            FilterOnDominance(filter);
            Dictionary <int, FastFixedSetFactory <int> .FastFixedSet <int> > entries = mapExtPostdominators;
            Dictionary <int, HashSet <int> > res = new Dictionary <int, HashSet <int> >(entries.Count
                                                                                        );

            foreach (KeyValuePair <int, FastFixedSetFactory <int> .FastFixedSet <int> > entry in entries)
            {
                Sharpen.Collections.Put(res, entry.Key, entry.Value.ToPlainSet());
            }
            return(res);
        }
        private void FilterOnDominance(DominatorTreeExceptionFilter filter)
        {
            DominatorEngine engine = filter.GetDomEngine();

            foreach (int head in new HashSet <int>(mapExtPostdominators.Keys))
            {
                FastFixedSetFactory <int> .FastFixedSet <int> setPostdoms = mapExtPostdominators.GetOrNull
                                                                                (head);
                LinkedList <Statement> stack = new LinkedList <Statement>();
                LinkedList <FastFixedSetFactory <int> .FastFixedSet <int> > stackPath = new LinkedList <FastFixedSetFactory <int> .FastFixedSet
                                                                                                        <int> >();
                stack.AddLast(statement.GetStats().GetWithKey(head));
                stackPath.AddLast(factory.SpawnEmptySet());
                HashSet <Statement> setVisited = new HashSet <Statement>();
                setVisited.Add(stack.First.Value);
                while (!(stack.Count == 0))
                {
                    Statement stat = Sharpen.Collections.RemoveFirst(stack);
                    FastFixedSetFactory <int> .FastFixedSet <int> path = Sharpen.Collections.RemoveFirst(stackPath
                                                                                                         );
                    if (setPostdoms.Contains(stat.id))
                    {
                        path.Add(stat.id);
                    }
                    if (path.Contains(setPostdoms))
                    {
                        continue;
                    }
                    if (!engine.IsDominator(stat.id, head))
                    {
                        setPostdoms.Complement(path);
                        continue;
                    }
                    foreach (StatEdge edge in stat.GetSuccessorEdges(StatEdge.Type_Regular))
                    {
                        Statement edge_destination = edge.GetDestination();
                        if (!setVisited.Contains(edge_destination))
                        {
                            stack.AddLast(edge_destination);
                            stackPath.AddLast(path.GetCopy());
                            setVisited.Add(edge_destination);
                        }
                    }
                }
                if (setPostdoms.IsEmpty())
                {
                    Sharpen.Collections.Remove(mapExtPostdominators, head);
                }
            }
        }
 private void FilterOnExceptionRanges(DominatorTreeExceptionFilter filter)
 {
     foreach (int head in new HashSet <int>(mapExtPostdominators.Keys))
     {
         FastFixedSetFactory <int> .FastFixedSet <int> set = mapExtPostdominators.GetOrNull(head);
         foreach (var it in set.ToList())
         {
             if (!filter.AcceptStatementPair(head, it))
             {
                 set.Remove(it);
             }
         }
         if (set.IsEmpty())
         {
             Sharpen.Collections.Remove(mapExtPostdominators, head);
         }
     }
 }