protected void RunTest(string sourceFile, string outputFile) { Program program = RewriteFile(sourceFile); Build(program.Procedures.Values[0], program.Architecture); LiveCopyInserter lci = new LiveCopyInserter(ssa); lci.Transform(); using (FileUnitTester fut = new FileUnitTester(outputFile)) { proc.Write(false, fut.TextWriter); fut.AssertFilesEqual(); } }
private void Build(Program program) { var eventListener = new FakeDecompilerEventListener(); DataFlowAnalysis dfa = new DataFlowAnalysis(program, null, eventListener); dfa.UntangleProcedures(); foreach (Procedure proc in program.Procedures.Values) { Aliases alias = new Aliases(proc, program.Architecture); alias.Transform(); var gr = proc.CreateBlockDominatorGraph(); SsaTransform sst = new SsaTransform(dfa.ProgramDataFlow, proc, null, gr, new HashSet <RegisterStorage>()); SsaState ssa = sst.SsaState; ConditionCodeEliminator cce = new ConditionCodeEliminator(ssa, program.Platform); cce.Transform(); DeadCode.Eliminate(proc, ssa); var vp = new ValuePropagator(program.Architecture, ssa, eventListener); vp.Transform(); DeadCode.Eliminate(proc, ssa); Coalescer coa = new Coalescer(proc, ssa); coa.Transform(); DeadCode.Eliminate(proc, ssa); LiveCopyInserter lci = new LiveCopyInserter(proc, ssa.Identifiers); lci.Transform(); WebBuilder web = new WebBuilder(proc, ssa.Identifiers, new Dictionary <Identifier, LinearInductionVariable>()); web.Transform(); ssa.ConvertBack(false); } }