private void AddRecursive(AccCIL.IR.InstructionElement el, TreeNode parentNode) { TreeNode n = new TreeNode(el.Instruction.OpCode.ToString()); n.Tag = el; parentNode.Nodes.Add(n); foreach (var elc in el.Childnodes) { AddRecursive(elc, n); } }
private void AssignRegister(AccCIL.IR.InstructionElement el, int register, List <int> usedRegisters, bool assignparent) { if (el == null || el.Register == null) { return; } el.Register.RegisterNumber = register; usedRegisters.Add(register); if (assignparent) { //Pass the assignment up while (el.Parent != null && el.Parent.Register != null && el.Parent.Register.RegisterNumber < 0) { el.Parent.Register.RegisterNumber = register; el = el.Parent; } } }
private static void RecursiveTranslate(CompiledMethod state, SPEOpCodeMapper mapper, AccCIL.IR.InstructionElement el, Dictionary <AccCIL.IR.InstructionElement, string> compiled) { if (compiled.ContainsKey(el)) { System.Diagnostics.Debug.Assert(el.Instruction.OpCode.Code == Mono.Cecil.Cil.Code.Dup); return; } compiled.Add(el, null); foreach (AccCIL.IR.InstructionElement els in el.Childnodes) { RecursiveTranslate(state, mapper, els, compiled); } int stackdepth = state.VirtualStackDepth; System.Reflection.MethodInfo translator; if (!_opTranslations.TryGetValue(el.Instruction.OpCode.Code, out translator)) { throw new Exception(string.Format("Missing a translator for CIL code {0}", el.Instruction.OpCode.Code)); } state.StartInstruction(el.Instruction); translator.Invoke(mapper, new object[] { el }); state.EndInstruction(); //Verify that the instruction handler managed to handle the stack System.Diagnostics.Debug.Assert(state.VirtualStackDepth == stackdepth + AccCIL.AccCIL.StackChangeCount(el)); }