Пример #1
0
        public void DumpWatchedProcedure(string phase, string caption, SsaState ssa)
        {
            DumpWatchedProcedure(phase, caption, ssa.Procedure);
#if FIND_BUGS
// This is currently disabled because of hard-to-fix problems with the UnalignedMemoryAccessFuser
            ssa.Validate(s =>
            {
                Console.WriteLine("== SSA validation failure; {0} {1}", caption, ssa.Procedure.Name, s);
                Console.WriteLine("    {0}", s);
                ssa.Write(Console.Out);
                ssa.Procedure.Write(false, Console.Out);
            });
#endif
        }
Пример #2
0
 private void DumpProc(Procedure proc, SsaState ssa, TextWriter writer)
 {
     ssa.Write(writer);
     proc.Write(false, writer);
 }
Пример #3
0
 private void AssertStringsEqual(string sExp, SsaState ssa)
 {
     var sw = new StringWriter();
     ssa.Write(sw);
     ssa.Procedure.Write(false, sw);
     var sActual = sw.ToString();
     if (sExp != sActual)
     {
         Debug.Print("{0}", sActual);
         Assert.AreEqual(sExp, sActual);
     }
 }
Пример #4
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();
			}
		}
Пример #5
0
 private void RunUnitTest(ProcedureBuilder m, string outfile)
 {
     var proc = m.Procedure;
     var sst = new SsaTransform(
         new ProgramDataFlow(),
         proc,
         null,
         proc.CreateBlockDominatorGraph(),
         new HashSet<RegisterStorage>());
     ssa = sst.SsaState;
     using (var fut = new FileUnitTester(outfile))
     {
         ssa.Write(fut.TextWriter);
         proc.Write(false, fut.TextWriter);
         fut.AssertFilesEqual();
     }
 }