public static DebugInstructionToken Parse(DebugBytecodeReader reader, uint token, Opcode opcode, uint size) { var result = new DebugInstructionToken(); result.token = token; result.Opcode = opcode; uint read = 0; uint destIndex = opcode == Opcode.Def ? (uint)1 : 0; while (read < size) { var index = (uint)result.Operands.Count; IDebugOperand operand; if (index == destIndex) { operand = DebugDestinationOperand.Parse(reader, index); } else { operand = DebugSourceOperand.Parse(reader, index); } result.Operands.Add(operand); read += operand.WordCount; } return(result); }
public static DebugDestinationOperand Parse(DebugBytecodeReader reader, uint index) { var token = reader.ReadUInt32($"Operand {index}"); var result = new DebugDestinationOperand(); result.WordCount = 1; result.RegisterNumber = token & 0x7FF; result.RegisterType = (RegisterType)(((token >> 28) & 0x7) | ((token >> 8) & 0x18)); result.MinPrecision = (token >> 12) & 0XC; result.DestinationWriteMask = (ComponentFlags)((token >> 16) & 0xF); result.ResultModifier = (ResultModifier)((token >> 20) & 0xF); reader.AddNote("RegisterNumber", result.RegisterNumber); reader.AddNote("RegisterType", result.RegisterType); reader.AddNote("MinPrecision", result.MinPrecision); reader.AddNote("DestinationWriteMask", result.DestinationWriteMask); reader.AddNote("ResultModifier", result.ResultModifier); return(result); }