Esempio n. 1
0
        public void Propagate()
        {
            this.callGraph = CallGraphHelper.ComputeCallGraph(program);
            Queue <Procedure> workQueue = new Queue <Procedure>(this.ProcedureToUseSet.Keys.Where(key => this.callGraph.Nodes.Contains(key)));

            while (workQueue.Count > 0)
            {
                Procedure current = workQueue.Dequeue();
                BitArray  useSet  = this.ProcedureToUseSet[current];
                BitArray  copy    = useSet.Clone() as BitArray;
                Debug.Assert(copy != null);
                bool changed = false;
                foreach (var suc in this.callGraph.Successors(current))
                {
                    useSet.Or(this.ProcedureToUseSet[suc]);
                }
                if (!this.BitArrayEquals(copy, useSet))
                {
                    changed = true;
                }

                if (changed)
                {
                    foreach (var pred in this.callGraph.Predecessors(current))
                    {
                        if (!workQueue.Contains(pred) && !pred.Equals(current))
                        {
                            workQueue.Enqueue(pred);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public HoudiniAnalyzeImplSubset(Program prog, IEnumerable <Procedure> procs)
 {
     this.prog            = prog;
     procsToAnalyze       = procs;
     callGraph            = CallGraphHelper.ComputeCallGraph(prog);
     this.candidateConsts = this.prog.Variables.Where(Item =>
                                                      QKeyValue.FindBoolAttribute(Item.Attributes, "existential")).Select(Item => Item.Name).ToList();
 }