Exemplo n.º 1
0
        protected override void RunTest(Program prog, TextWriter writer)
        {
            var flow           = new ProgramDataFlow(prog);
            var eventListener  = new FakeDecompilerEventListener();
            var importResolver = MockRepository.GenerateStub <IImportResolver>();

            importResolver.Replay();
            var trf = new TrashedRegisterFinder(prog, prog.Procedures.Values, flow, eventListener);

            trf.Compute();
            trf.RewriteBasicBlocks();
            Dump(prog.CallGraph);
            RegisterLiveness.Compute(prog, flow, eventListener);
            GlobalCallRewriter.Rewrite(prog, flow, eventListener);

            foreach (Procedure proc in prog.Procedures.Values)
            {
                Aliases alias = new Aliases(proc, prog.Architecture);
                alias.Transform();
                var          gr  = proc.CreateBlockDominatorGraph();
                SsaTransform sst = new SsaTransform(
                    flow,
                    proc,
                    importResolver,
                    gr,
                    new HashSet <RegisterStorage>());
                ssa = sst.SsaState;
                ssa.Write(writer);
                proc.Write(false, true, writer);
                writer.WriteLine();
                ssa.CheckUses(s => Assert.Fail(s));
            }
        }
Exemplo n.º 2
0
        protected override void RunTest(Program prog, TextWriter writer)
        {
            var flow          = new ProgramDataFlow(prog);
            var eventListener = new FakeDecompilerEventListener();
            var trf           = new TrashedRegisterFinder(prog, prog.Procedures.Values, flow, eventListener);

            trf.Compute();
            trf.RewriteBasicBlocks();
            Dump(prog.CallGraph);
            var rl = RegisterLiveness.Compute(prog, flow, eventListener);

            GlobalCallRewriter.Rewrite(prog, flow);

            foreach (Procedure proc in prog.Procedures.Values)
            {
                Aliases alias = new Aliases(proc, prog.Architecture);
                alias.Transform();
                var          gr  = proc.CreateBlockDominatorGraph();
                SsaTransform sst = new SsaTransform(flow, proc, gr);
                ssa = sst.SsaState;
                ssa.Write(writer);
                proc.Write(false, true, writer);
                writer.WriteLine();
            }
        }