public void TrfMergeSubregisterRegister() { Given_Contexts(); var cl = frame.EnsureRegister(Registers.cl); var cx = frame.EnsureRegister(Registers.cx); trf.RegisterSymbolicValues[cl.Storage] = Constant.Zero(cl.DataType); blockflow.SymbolicIn.SetValue(cx, Constant.Invalid); trf.MergeDataFlow(blockflow); var sw = new StringWriter(); DataFlow.EmitRegisterValues("", blockflow.SymbolicIn.RegisterState, sw); Assert.AreEqual("cx:<invalid>", sw.ToString()); }
private TextWriter DumpProcedureSummaries(TextWriter writer) { foreach (Procedure proc in prog.Procedures.Values) { DataFlow.EmitRegisters(prog.Architecture, proc.Name, flow[proc].grfTrashed, flow[proc].TrashedRegisters, writer); writer.WriteLine(); if (flow[proc].ConstantRegisters.Count > 0) { DataFlow.EmitRegisterValues("const", flow[proc].ConstantRegisters, writer); writer.WriteLine(); } foreach (var block in proc.ControlGraph.Blocks.OrderBy(b => b, new Procedure.BlockComparer())) { DataFlow.EmitRegisterValues(" " + block.Name, flow[block].SymbolicIn.RegisterState, writer); writer.WriteLine(); } writer.WriteLine(); } return(writer); }
protected void DumpProcedureFlows(Program program, DataFlowAnalysis dfa, TextWriter w) { foreach (Procedure proc in program.Procedures.Values) { w.WriteLine("// {0} /////////////////////", proc.Name); ProcedureFlow flow = dfa.ProgramDataFlow[proc]; DataFlow.EmitRegisters(program.Architecture, "\tLiveOut: ", flow.grfLiveOut, flow.BitsLiveOut, w); w.WriteLine(); DataFlow.EmitRegisterValues("\tBitsUsed: ", flow.BitsUsed, w); w.WriteLine(); DataFlow.EmitRegisters(program.Architecture, "\tTrashed: ", flow.grfTrashed, flow.Trashed, w); w.WriteLine(); DataFlow.EmitRegisters(program.Architecture, "\tPreserved:", flow.grfPreserved, flow.Preserved, w); w.WriteLine(); w.WriteLine("// {0}", proc.Name); proc.Signature.Emit(proc.Name, FunctionType.EmitFlags.None, new TextFormatter(w)); w.WriteLine(); foreach (Block block in proc.SortBlocksByName()) { block.Write(w); } } }