Example #1
0
        public void Transform()
        {
            CollectLiveOutStorages();
            DumpLiveOut();
            bool change;

            do
            {
                if (eventListener.IsCanceled())
                {
                    return;
                }
                change = false;
                this.wl.AddRange(ssaStates);
                while (wl.GetWorkItem(out SsaState ssa))
                {
                    if (this.eventListener.IsCanceled())
                    {
                        return;
                    }
                    var vp = new ValuePropagator(program.SegmentMap, ssa, program.CallGraph, dynamicLinker, eventListener);
                    vp.Transform();
                    change |= RemoveUnusedDefinedValues(ssa, wl);
                    DataFlowAnalysis.DumpWatchedProcedure("After RemoveUnusedDefinedValues", ssa.Procedure);
                    change |= RemoveLiveInStorages(ssa.Procedure, dataFlow[ssa.Procedure], wl);
                    DataFlowAnalysis.DumpWatchedProcedure("After RemoveLiveInStorages", ssa.Procedure);
                }
            } while (change);
            foreach (var proc in procToSsa.Keys)
            {
                var liveOut = CollectLiveOutStorages(proc);
                var flow    = this.dataFlow[proc];
                flow.BitsLiveOut = SummarizeStorageBitranges(flow.BitsLiveOut.Concat(liveOut));
                flow.grfLiveOut  = SummarizeFlagGroups(liveOut);
            }
        }