Example #1
0
        private void Build(Procedure proc, IProcessorArchitecture arch)
        {
            var platform = new DefaultPlatform(null, arch);

            this.proc = proc;
            Aliases alias = new Aliases(proc, arch);

            alias.Transform();
            SsaTransform sst = new SsaTransform(
                new ProgramDataFlow(),
                proc,
                null,
                proc.CreateBlockDominatorGraph(),
                new HashSet <RegisterStorage>());

            ssa = sst.SsaState;
            ConditionCodeEliminator cce = new ConditionCodeEliminator(ssa, platform);

            cce.Transform();
            ValuePropagator vp = new ValuePropagator(arch, ssa, new FakeDecompilerEventListener());

            vp.Transform();
            DeadCode.Eliminate(proc, ssa);
            Coalescer coa = new Coalescer(proc, ssa);

            coa.Transform();
            DeadCode.Eliminate(proc, ssa);

            sla  = new SsaLivenessAnalysis(proc, ssa.Identifiers);
            sla2 = new SsaLivenessAnalysis2(proc, ssa.Identifiers);
            sla2.Analyze();
        }
Example #2
0
        private void Build(Procedure proc, IProcessorArchitecture arch)
        {
            var platform = new DefaultPlatform(null, arch);

            this.proc = proc;
            Aliases alias = new Aliases(proc);

            alias.Transform();
            var          importResolver = new Mock <IImportResolver>().Object;
            SsaTransform sst            = new SsaTransform(
                new ProgramDataFlow(),
                proc,
                importResolver,
                proc.CreateBlockDominatorGraph(),
                new HashSet <RegisterStorage>());

            ssa = sst.SsaState;
            ConditionCodeEliminator cce = new ConditionCodeEliminator(ssa, platform);

            cce.Transform();
            var             segmentMap = new SegmentMap(Address.Ptr32(0x00123400));
            ValuePropagator vp         = new ValuePropagator(segmentMap, ssa, new CallGraph(), importResolver, new FakeDecompilerEventListener());

            vp.Transform();
            DeadCode.Eliminate(proc, ssa);
            Coalescer coa = new Coalescer(proc, ssa);

            coa.Transform();
            DeadCode.Eliminate(proc, ssa);

            sla  = new SsaLivenessAnalysis(proc, ssa.Identifiers);
            sla2 = new SsaLivenessAnalysis2(proc, ssa.Identifiers);
            sla2.Analyze();
        }
Example #3
0
        private void Build(Procedure proc, IProcessorArchitecture arch)
        {
            var platform = new DefaultPlatform(null, arch);
            var program  = new Program()
            {
                Architecture = arch,
                Platform     = platform,
            };

            this.proc = proc;
            var dynamicLinker = new Mock <IDynamicLinker>().Object;
            var listener      = new FakeDecompilerEventListener();
            var sst           = new SsaTransform(
                program,
                proc,
                new HashSet <Procedure>(),
                dynamicLinker,
                new ProgramDataFlow());

            sst.Transform();
            ssa = sst.SsaState;
            ConditionCodeEliminator cce = new ConditionCodeEliminator(ssa, platform, listener);

            cce.Transform();
            var             segmentMap = new SegmentMap(Address.Ptr32(0x00123400));
            ValuePropagator vp         = new ValuePropagator(segmentMap, ssa, program.CallGraph, dynamicLinker, listener);

            vp.Transform();
            DeadCode.Eliminate(ssa);
            Coalescer coa = new Coalescer(ssa);

            coa.Transform();
            DeadCode.Eliminate(ssa);

            sla  = new SsaLivenessAnalysis(ssa);
            sla2 = new SsaLivenessAnalysis2(ssa);
            sla2.Analyze();
        }