Пример #1
0
		public void LciLiveAtLoop()
		{
			Build(new LiveLoopMock().Procedure, MkArch());
			var lci = new LiveCopyInserter(ssa);

            ssa.Dump(true);
            var i = ssaIds.Where(s => s.Identifier.Name == "i").Single().Identifier;
			var i_3 = ssaIds.Where(s => s.Identifier.Name == "i_3").Single().Identifier;
            var loopHdr = proc.ControlGraph.Blocks[2];
			Assert.IsFalse(lci.IsLiveAtCopyPoint(i, loopHdr));
            Assert.IsTrue(lci.IsLiveAtCopyPoint(i_3, loopHdr), "i_3 should be live");
		}
Пример #2
0
        protected override void RunTest(Program program, TextWriter fut)
        {
            IDynamicLinker   dynamicLinker = null;
            var              listener      = sc.RequireService <DecompilerEventListener>();
            DataFlowAnalysis dfa           = new DataFlowAnalysis(program, dynamicLinker, sc);
            var              ssts          = dfa.UntangleProcedures();

            foreach (Procedure proc in program.Procedures.Values)
            {
                var      sst = ssts.Single(s => s.SsaState.Procedure == proc);
                SsaState ssa = sst.SsaState;

                ConditionCodeEliminator cce = new ConditionCodeEliminator(program, ssa, listener);
                cce.Transform();
                DeadCode.Eliminate(ssa);

                ValuePropagator vp = new ValuePropagator(program.SegmentMap, ssa, program.CallGraph, dynamicLinker, listener);
                vp.Transform();
                DeadCode.Eliminate(ssa);
                Coalescer co = new Coalescer(ssa);
                co.Transform();

                ssa.Write(fut);
                proc.Write(false, fut);
                fut.WriteLine();

                ssa.Validate(s => { ssa.Dump(true); Assert.Fail(s); });
            }
        }