From 26d710e9d745cf2957171a87cfe9e7bace812f03 Mon Sep 17 00:00:00 2001 From: tinysec Date: Thu, 9 Jul 2026 14:13:18 +0800 Subject: [PATCH] feat: add MLIL DetailedOperands/Operands/Traverse + shared IL operand types (#42) Mirror Python MediumLevelILInstruction.detailed_operands / operands / traverse (mediumlevelil.py) by driving them from a static descriptor table, the same pattern already used for HighLevelIL. Shared types (IL/): extract ILOperand, ILOperandKind, ILOperandDescriptor out of the HLIL-specific copies so both ILs share one source of truth. ILOperandDescriptor gains a SecondaryRawIndex for the MLIL "aliased" dest/prev operands, where prev shares the variable slot with dest but reads a different version slot (e.g. SET_VAR_ALIASED is var@0, dest-version@1, prev-version@2). HLIL is refactored onto the shared types; its DetailedOperands reader now takes a descriptor and threads the secondary index through the SSAVariable / ConstantData cases. MLIL table (MediumLevelIL/MediumLevelILDetailedOperandsTable.cs): 140 rows generated from the official Python overrides by reading each property's actual _get_*(N) raw index (not accumulated slot widths -- the core's advance=0 rule desynchronises accumulation for sub-instruction-derived operands). Empirically cross-checked against the live core (5.3.9757): detailed_operands succeeds with zero exceptions across cat/ls/true, and the operand indices match. Fixes that surfaced: - OperationOperands counts were too low for five ops whose copied RawOperands array was shorter than the descriptors read, which would have thrown IndexOutOfRange: MLIL_CALL_UNTYPED 3->4, MLIL_RET_HINT 0->1, MLIL_STORE_STRUCT_SSA 4->5, MLIL_SYSCALL_UNTYPED 2->3, MLIL_TAILCALL_UNTYPED 2->4. - GetOperandAsIntegerArray passed the slot VALUE to BNMediumLevelILGetOperandList instead of the operand index, returning a garbage list; now mirrors GetOperandAsIntegerMap. KNOWN PARITY GAP (documented in the table header): the call/syscall/intrinsic family lists an output/params/output_dest_memory operand whose value is reached by unwrapping a CallOutput/CallParam sub-instruction expression (BNMediumLevelILGetOperandList does not flatten across the parent->sub boundary). Those derived operands are omitted; the flat-readable operands are included. Sub-instruction navigation to close the gap is tracked as a follow-up. VERSION NOTE: the C# MediumLevelILOperation enum was generated against a newer binaryninja-api than the installed core (5.3.9757 / aa25bfc). The table matches the installed core (140 ops). 11 enum members the core never emits have no row (empty DetailedOperands); the one rename (installed MLIL_CALL_OUTPUT == C# MLIL_VAR_OUTPUT) is handled in the generator. E2E + consistency tests live in the separate sharp-binaryninja-tests harness. --- .../HighLevelILDetailedOperandsTable.cs | 232 +++++++++--------- HighLevelIL/HighLevelILOperand.cs | 110 --------- IL/ILOperand.cs | 35 +++ IL/ILOperandDescriptor.cs | 52 ++++ IL/ILOperandKind.cs | 51 ++++ .../MediumLevelILDetailedOperandsTable.cs | 177 +++++++++++++ Struct/BNHighLevelILInstruction.cs | 65 ++--- Struct/BNMediumLevelILInstruction.cs | 203 ++++++++++++++- 8 files changed, 661 insertions(+), 264 deletions(-) delete mode 100644 HighLevelIL/HighLevelILOperand.cs create mode 100644 IL/ILOperand.cs create mode 100644 IL/ILOperandDescriptor.cs create mode 100644 IL/ILOperandKind.cs create mode 100644 MediumLevelIL/MediumLevelILDetailedOperandsTable.cs diff --git a/HighLevelIL/HighLevelILDetailedOperandsTable.cs b/HighLevelIL/HighLevelILDetailedOperandsTable.cs index 345f214..fc34b49 100644 --- a/HighLevelIL/HighLevelILDetailedOperandsTable.cs +++ b/HighLevelIL/HighLevelILDetailedOperandsTable.cs @@ -19,123 +19,123 @@ namespace BinaryNinja // carry slot in the core, so they keep it. internal static class HighLevelILDetailedOperandsTable { - internal static readonly Dictionary Table = - new Dictionary + internal static readonly Dictionary Table = + new Dictionary { - { HighLevelILOperation.HLIL_ADC, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("carry", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ADD, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ADDRESS_OF, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ADD_OVERFLOW, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_AND, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ARRAY_INDEX, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("index", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ARRAY_INDEX_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 1, "int"), new HighLevelILOperandDescriptor("index", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ASR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ASSIGN, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ASSIGN_MEM_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("dest_memory", HighLevelILOperandKind.Integer, 1, "int"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 3, "int") } }, - { HighLevelILOperation.HLIL_ASSIGN_UNPACK, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ASSIGN_UNPACK_MEM_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("dest_memory", HighLevelILOperandKind.Integer, 2, "int"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 3, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 4, "int") } }, - { HighLevelILOperation.HLIL_BLOCK, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_BOOL_TO_INT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CALL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_CALL_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("dest_memory", HighLevelILOperandKind.Integer, 3, "int"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 4, "int") } }, - { HighLevelILOperation.HLIL_CASE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("values", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CEIL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_E, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_NE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_SGE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_SGT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_SLE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_SLT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_UGE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_UGT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_ULE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CMP_ULT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_CONST, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.Integer, 0, "int") } }, - { HighLevelILOperation.HLIL_CONST_DATA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.ConstantData, 0, "ConstantData") } }, - { HighLevelILOperation.HLIL_CONST_PTR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.Integer, 0, "int") } }, - { HighLevelILOperation.HLIL_DEREF, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DEREF_FIELD, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("offset", HighLevelILOperandKind.Integer, 1, "int"), new HighLevelILOperandDescriptor("member_index", HighLevelILOperandKind.Integer, 2, "Optional[int]") } }, - { HighLevelILOperation.HLIL_DEREF_FIELD_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 1, "int"), new HighLevelILOperandDescriptor("offset", HighLevelILOperandKind.Integer, 2, "int"), new HighLevelILOperandDescriptor("member_index", HighLevelILOperandKind.Integer, 3, "Optional[int]") } }, - { HighLevelILOperation.HLIL_DEREF_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 1, "int") } }, - { HighLevelILOperation.HLIL_DIVS, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DIVS_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DIVU, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DIVU_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DO_WHILE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_DO_WHILE_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition_phi", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_EXTERN_PTR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.Integer, 0, "int"), new HighLevelILOperandDescriptor("offset", HighLevelILOperandKind.Integer, 1, "int") } }, - { HighLevelILOperation.HLIL_FABS, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FADD, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_E, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_GE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_GT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_LE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_LT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_NE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_O, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FCMP_UO, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FDIV, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FLOAT_CONST, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.Float, 0, "float") } }, - { HighLevelILOperation.HLIL_FLOAT_CONV, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FLOAT_TO_INT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FLOOR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FMUL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FNEG, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FOR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("init", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("update", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 3, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FOR_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("init", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition_phi", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("update", HighLevelILOperandKind.Expression, 3, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 4, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FSQRT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FSUB, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_FTRUNC, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_GOTO, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("target", HighLevelILOperandKind.GotoLabel, 0, "GotoLabel") } }, - { HighLevelILOperation.HLIL_IF, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("true", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("false", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_IMPORT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("constant", HighLevelILOperandKind.Integer, 0, "int") } }, - { HighLevelILOperation.HLIL_INTRINSIC, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("intrinsic", HighLevelILOperandKind.Intrinsic, 0, "ILIntrinsic"), new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_INTRINSIC_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("intrinsic", HighLevelILOperandKind.Intrinsic, 0, "ILIntrinsic"), new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("dest_memory", HighLevelILOperandKind.Integer, 3, "int"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 4, "int") } }, - { HighLevelILOperation.HLIL_INT_TO_FLOAT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_JUMP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_LABEL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("target", HighLevelILOperandKind.GotoLabel, 0, "GotoLabel") } }, - { HighLevelILOperation.HLIL_LOW_PART, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_LSL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_LSR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MEM_PHI, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Integer, 0, "int"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.IntegerList, 1, "List[int]") } }, - { HighLevelILOperation.HLIL_MODS, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MODS_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MODU, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MODU_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MUL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MULS_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_MULU_DP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_NEG, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_NOT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_OR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_RET, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_RLC, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("carry", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ROL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ROR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, // See file header: ROR intentionally omits Python's buggy "carry" (no slot in the core). - { HighLevelILOperation.HLIL_ROUND_TO_INT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_RRC, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("carry", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_SBB, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("carry", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_SPLIT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("high", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("low", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_STRUCT_FIELD, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("offset", HighLevelILOperandKind.Integer, 1, "int"), new HighLevelILOperandDescriptor("member_index", HighLevelILOperandKind.Integer, 2, "Optional[int]") } }, - { HighLevelILOperation.HLIL_SUB, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_SWITCH, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("default", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("cases", HighLevelILOperandKind.ExpressionList, 2, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_SX, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_SYSCALL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_SYSCALL_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new HighLevelILOperandDescriptor("dest_memory", HighLevelILOperandKind.Integer, 2, "int"), new HighLevelILOperandDescriptor("src_memory", HighLevelILOperandKind.Integer, 3, "int") } }, - { HighLevelILOperation.HLIL_TAILCALL, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("params", HighLevelILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, - { HighLevelILOperation.HLIL_TEST_BIT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_TRAP, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("vector", HighLevelILOperandKind.Integer, 0, "int") } }, - { HighLevelILOperation.HLIL_UNIMPL_MEM, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_VAR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("var", HighLevelILOperandKind.Variable, 0, "Variable") } }, - { HighLevelILOperation.HLIL_VAR_DECLARE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("var", HighLevelILOperandKind.Variable, 0, "Variable") } }, - { HighLevelILOperation.HLIL_VAR_INIT, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.Variable, 0, "Variable"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_VAR_INIT_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.SSAVariable, 0, "SSAVariable"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_VAR_PHI, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("dest", HighLevelILOperandKind.SSAVariable, 0, "SSAVariable"), new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.SSAVariableList, 2, "List[SSAVariable]") } }, - { HighLevelILOperation.HLIL_VAR_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("var", HighLevelILOperandKind.SSAVariable, 0, "SSAVariable") } }, - { HighLevelILOperation.HLIL_WHILE, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_WHILE_SSA, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("condition_phi", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("condition", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("body", HighLevelILOperandKind.Expression, 2, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_XOR, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("left", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction"), new HighLevelILOperandDescriptor("right", HighLevelILOperandKind.Expression, 1, "HighLevelILInstruction") } }, - { HighLevelILOperation.HLIL_ZX, new HighLevelILOperandDescriptor[] { new HighLevelILOperandDescriptor("src", HighLevelILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ADC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ADD, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ADDRESS_OF, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ADD_OVERFLOW, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_AND, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ARRAY_INDEX, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("index", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ARRAY_INDEX_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("index", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ASR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ASSIGN, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("src", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ASSIGN_MEM_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "HighLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 3, "int") } }, + { HighLevelILOperation.HLIL_ASSIGN_UNPACK, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ASSIGN_UNPACK_MEM_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 2, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 3, "HighLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { HighLevelILOperation.HLIL_BLOCK, new ILOperandDescriptor[] { new ILOperandDescriptor("body", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_BOOL_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CALL, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_CALL_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 3, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { HighLevelILOperation.HLIL_CASE, new ILOperandDescriptor[] { new ILOperandDescriptor("values", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new ILOperandDescriptor("body", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CEIL, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_E, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_NE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_SGE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_SGT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_SLE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_SLT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_UGE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_UGT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_ULE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CMP_ULT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_CONST, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { HighLevelILOperation.HLIL_CONST_DATA, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.ConstantData, 0, "ConstantData") } }, + { HighLevelILOperation.HLIL_CONST_PTR, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { HighLevelILOperation.HLIL_DEREF, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DEREF_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("member_index", ILOperandKind.Integer, 2, "Optional[int]") } }, + { HighLevelILOperation.HLIL_DEREF_FIELD_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 2, "int"), new ILOperandDescriptor("member_index", ILOperandKind.Integer, 3, "Optional[int]") } }, + { HighLevelILOperation.HLIL_DEREF_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 1, "int") } }, + { HighLevelILOperation.HLIL_DIVS, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DIVS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DIVU, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DIVU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DO_WHILE, new ILOperandDescriptor[] { new ILOperandDescriptor("body", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("condition", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_DO_WHILE_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("body", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("condition_phi", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("condition", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_EXTERN_PTR, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int") } }, + { HighLevelILOperation.HLIL_FABS, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FADD, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_E, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_GE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_GT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_LE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_LT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_NE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_O, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FCMP_UO, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FDIV, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FLOAT_CONST, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Float, 0, "float") } }, + { HighLevelILOperation.HLIL_FLOAT_CONV, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FLOAT_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FLOOR, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FMUL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FNEG, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FOR, new ILOperandDescriptor[] { new ILOperandDescriptor("init", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("condition", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("update", ILOperandKind.Expression, 2, "HighLevelILInstruction"), new ILOperandDescriptor("body", ILOperandKind.Expression, 3, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FOR_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("init", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("condition_phi", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("condition", ILOperandKind.Expression, 2, "HighLevelILInstruction"), new ILOperandDescriptor("update", ILOperandKind.Expression, 3, "HighLevelILInstruction"), new ILOperandDescriptor("body", ILOperandKind.Expression, 4, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FSQRT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FSUB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_FTRUNC, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_GOTO, new ILOperandDescriptor[] { new ILOperandDescriptor("target", ILOperandKind.GotoLabel, 0, "GotoLabel") } }, + { HighLevelILOperation.HLIL_IF, new ILOperandDescriptor[] { new ILOperandDescriptor("condition", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("true", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("false", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_IMPORT, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { HighLevelILOperation.HLIL_INTRINSIC, new ILOperandDescriptor[] { new ILOperandDescriptor("intrinsic", ILOperandKind.Intrinsic, 0, "ILIntrinsic"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_INTRINSIC_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("intrinsic", ILOperandKind.Intrinsic, 0, "ILIntrinsic"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 3, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { HighLevelILOperation.HLIL_INT_TO_FLOAT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_JUMP, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_LABEL, new ILOperandDescriptor[] { new ILOperandDescriptor("target", ILOperandKind.GotoLabel, 0, "GotoLabel") } }, + { HighLevelILOperation.HLIL_LOW_PART, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_LSL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_LSR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MEM_PHI, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("src", ILOperandKind.IntegerList, 1, "List[int]") } }, + { HighLevelILOperation.HLIL_MODS, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MODS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MODU, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MODU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MUL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MULS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_MULU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_NEG, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_NOT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_OR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_RET, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_RLC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ROL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ROR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, // See file header: ROR intentionally omits Python's buggy "carry" (no slot in the core). + { HighLevelILOperation.HLIL_ROUND_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_RRC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_SBB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_SPLIT, new ILOperandDescriptor[] { new ILOperandDescriptor("high", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("low", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_STRUCT_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("member_index", ILOperandKind.Integer, 2, "Optional[int]") } }, + { HighLevelILOperation.HLIL_SUB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_SWITCH, new ILOperandDescriptor[] { new ILOperandDescriptor("condition", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("default", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("cases", ILOperandKind.ExpressionList, 2, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_SX, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_SYSCALL, new ILOperandDescriptor[] { new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_SYSCALL_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 0, "List[HighLevelILInstruction]"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 2, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 3, "int") } }, + { HighLevelILOperation.HLIL_TAILCALL, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[HighLevelILInstruction]") } }, + { HighLevelILOperation.HLIL_TEST_BIT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_TRAP, new ILOperandDescriptor[] { new ILOperandDescriptor("vector", ILOperandKind.Integer, 0, "int") } }, + { HighLevelILOperation.HLIL_UNIMPL_MEM, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_VAR, new ILOperandDescriptor[] { new ILOperandDescriptor("var", ILOperandKind.Variable, 0, "Variable") } }, + { HighLevelILOperation.HLIL_VAR_DECLARE, new ILOperandDescriptor[] { new ILOperandDescriptor("var", ILOperandKind.Variable, 0, "Variable") } }, + { HighLevelILOperation.HLIL_VAR_INIT, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_VAR_INIT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_VAR_PHI, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.SSAVariableList, 2, "List[SSAVariable]") } }, + { HighLevelILOperation.HLIL_VAR_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("var", ILOperandKind.SSAVariable, 0, "SSAVariable") } }, + { HighLevelILOperation.HLIL_WHILE, new ILOperandDescriptor[] { new ILOperandDescriptor("condition", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("body", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_WHILE_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("condition_phi", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("condition", ILOperandKind.Expression, 1, "HighLevelILInstruction"), new ILOperandDescriptor("body", ILOperandKind.Expression, 2, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_XOR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "HighLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "HighLevelILInstruction") } }, + { HighLevelILOperation.HLIL_ZX, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "HighLevelILInstruction") } }, }; } } diff --git a/HighLevelIL/HighLevelILOperand.cs b/HighLevelIL/HighLevelILOperand.cs deleted file mode 100644 index 576562e..0000000 --- a/HighLevelIL/HighLevelILOperand.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace BinaryNinja -{ - /// - /// Categorizes one detailed operand of a by how it is read - /// from the native instruction's raw operand slots. Mirrors the type strings returned by Python's - /// HighLevelILInstruction.detailed_operands (highlevelil.py), collapsed to the reader - /// dispatched in . - /// - public enum HighLevelILOperandKind - { - /// A single sub-expression (Python type "HighLevelILInstruction"). - Expression, - - /// A list of sub-expressions (Python type "List[HighLevelILInstruction]"). - ExpressionList, - - /// A single integer slot (Python type "int" or "Optional[int]"). - Integer, - - /// A list of integer slots (Python type "List[int]"). - IntegerList, - - /// A single variable (Python type "Variable"). - Variable, - - /// A list of variables (Python type "List[Variable]"). - VariableList, - - /// A single SSA variable occupying two raw slots (Python type "SSAVariable"). - SSAVariable, - - /// A list of SSA variables (Python type "List[SSAVariable]"). - SSAVariableList, - - /// A floating-point constant (Python type "float"). - Float, - - /// A goto label reference (Python type "GotoLabel"). - GotoLabel, - - /// Constant data (Python type "ConstantData"). - ConstantData, - - /// An intrinsic reference (Python type "ILIntrinsic"). - Intrinsic - } - - /// - /// A named, typed operand of a : the value plus its name, - /// kind, and the Python type string. This is the C# equivalent of one - /// (name, value, type_str) tuple from Python - /// HighLevelILInstruction.detailed_operands (highlevelil.py:795). - /// - public readonly struct HighLevelILOperand - { - /// The operand's name, e.g. "left", "src", "condition" (matches Python). - public string Name { get; } - - /// - /// The operand value. The runtime type follows : a - /// , long, , - /// , float, or an array of those. May be null - /// when the underlying native operand is absent. - /// - public object? Value { get; } - - /// How the value was read; drives traversal and variable collection. - public HighLevelILOperandKind Kind { get; } - - /// The Python type string, e.g. "HighLevelILInstruction", "int", "Variable". - public string TypeName { get; } - - internal HighLevelILOperand(string name, object? value, HighLevelILOperandKind kind, string typeName) - { - this.Name = name; - this.Value = value; - this.Kind = kind; - this.TypeName = typeName; - } - } - - /// - /// One row of the static detailed-operands table: an operand's name, the reader kind, the raw - /// operand index it occupies, and the Python type string. Used to build - /// values at query time. - /// - internal readonly struct HighLevelILOperandDescriptor - { - internal string Name { get; } - - internal HighLevelILOperandKind Kind { get; } - - /// - /// The raw operand slot the value starts at. For - /// the version occupies the next slot (index + 1). - /// - internal int RawIndex { get; } - - internal string TypeName { get; } - - internal HighLevelILOperandDescriptor( - string name, HighLevelILOperandKind kind, int rawIndex, string typeName) - { - this.Name = name; - this.Kind = kind; - this.RawIndex = rawIndex; - this.TypeName = typeName; - } - } -} diff --git a/IL/ILOperand.cs b/IL/ILOperand.cs new file mode 100644 index 0000000..9825a4d --- /dev/null +++ b/IL/ILOperand.cs @@ -0,0 +1,35 @@ +namespace BinaryNinja +{ + /// + /// A named, typed operand of an IL instruction: the value plus its name, kind, and the Python + /// type string. Shared by every IL. This is the C# equivalent of one + /// (name, value, type_str) tuple from the official Python binding's + /// *ILInstruction.detailed_operands property. + /// + public readonly struct ILOperand + { + /// The operand's name, e.g. "left", "src", "condition" (matches Python). + public string Name { get; } + + /// + /// The operand value. The runtime type follows : an IL instruction, + /// long, a Variable/SSAVariable, float, or an array of those. May be null + /// when the underlying native operand is absent. + /// + public object? Value { get; } + + /// How the value was read; drives traversal and variable collection. + public ILOperandKind Kind { get; } + + /// The Python type string, e.g. "*ILInstruction", "int", "Variable". + public string TypeName { get; } + + internal ILOperand(string name, object? value, ILOperandKind kind, string typeName) + { + this.Name = name; + this.Value = value; + this.Kind = kind; + this.TypeName = typeName; + } + } +} diff --git a/IL/ILOperandDescriptor.cs b/IL/ILOperandDescriptor.cs new file mode 100644 index 0000000..e9e9324 --- /dev/null +++ b/IL/ILOperandDescriptor.cs @@ -0,0 +1,52 @@ +namespace BinaryNinja +{ + /// + /// One row of the static detailed-operands table shared by every IL: an operand's name, the + /// reader kind, the raw operand index it occupies, and the Python type string. Used to build + /// values at query time. + /// + internal readonly struct ILOperandDescriptor + { + internal string Name { get; } + + internal ILOperandKind Kind { get; } + + /// + /// The raw operand slot the value starts at. For + /// the variable identifier occupies this slot; for + /// the register-value state occupies this slot. + /// + internal int RawIndex { get; } + + /// + /// The second raw slot a two-slot operand uses, or -1 to mean "the slot right after + /// ". For this is the version + /// slot; for it is the value slot. The explicit + /// form is needed for the MediumLevelIL "aliased" dest/prev operands, where prev + /// shares the variable slot with dest but reads a different version slot (e.g. the + /// core lays out SET_VAR_ALIASED as var@0, dest-version@1, prev-version@2). + /// + internal int SecondaryRawIndex { get; } + + internal string TypeName { get; } + + internal ILOperandDescriptor(string name, ILOperandKind kind, int rawIndex, string typeName) + { + this.Name = name; + this.Kind = kind; + this.RawIndex = rawIndex; + this.SecondaryRawIndex = -1; + this.TypeName = typeName; + } + + internal ILOperandDescriptor( + string name, ILOperandKind kind, int rawIndex, int secondaryRawIndex, string typeName) + { + this.Name = name; + this.Kind = kind; + this.RawIndex = rawIndex; + this.SecondaryRawIndex = secondaryRawIndex; + this.TypeName = typeName; + } + } +} diff --git a/IL/ILOperandKind.cs b/IL/ILOperandKind.cs new file mode 100644 index 0000000..f165d91 --- /dev/null +++ b/IL/ILOperandKind.cs @@ -0,0 +1,51 @@ +namespace BinaryNinja +{ + /// + /// Categorizes one detailed operand of an IL instruction by how it is read from the native + /// instruction's raw operand slots. Shared by every IL (HighLevelIL, MediumLevelIL, ...) so the + /// descriptor tables, traversal, and operand collection can be written once. + /// + /// + /// Each value mirrors a type string returned by the official Python binding's + /// *ILInstruction.detailed_operands property, collapsed to the reader dispatched in the + /// matching DetailedOperands implementation. + /// + public enum ILOperandKind + { + /// A single sub-expression (Python type "*ILInstruction"). + Expression, + + /// A list of sub-expressions (Python type "List[*ILInstruction]"). + ExpressionList, + + /// A single integer slot (Python type "int" or "Optional[int]"). + Integer, + + /// A list of integer slots (Python type "List[int]" or "Dict[int, int]"). + IntegerList, + + /// A single variable (Python type "Variable"). + Variable, + + /// A list of variables (Python type "List[Variable]"). + VariableList, + + /// A single SSA variable occupying two raw slots (Python type "SSAVariable"). + SSAVariable, + + /// A list of SSA variables (Python type "List[SSAVariable]"). + SSAVariableList, + + /// A floating-point constant (Python type "float"). + Float, + + /// A goto label reference (Python type "GotoLabel"). HighLevelIL only. + GotoLabel, + + /// Constant data (Python type "ConstantData"). + ConstantData, + + /// An intrinsic reference (Python type "ILIntrinsic"). + Intrinsic + } +} diff --git a/MediumLevelIL/MediumLevelILDetailedOperandsTable.cs b/MediumLevelIL/MediumLevelILDetailedOperandsTable.cs new file mode 100644 index 0000000..5f98344 --- /dev/null +++ b/MediumLevelIL/MediumLevelILDetailedOperandsTable.cs @@ -0,0 +1,177 @@ +using System.Collections.Generic; + +namespace BinaryNinja +{ + // Static table driving MediumLevelILInstruction.DetailedOperands. Maps each + // MediumLevelILOperation to its named operand descriptors (name, kind, raw operand index, + // Python type name). Generated from the official Python + // MediumLevelILInstruction.detailed_operands overrides (mediumlevelil.py) by reading each + // property's actual _get_*(N) raw index -- NOT by accumulating slot widths -- because the + // core applies an "advance = 0" rule when an operand is derived from a nested + // sub-instruction (mediumlevelilinstruction.cpp), which desynchronises the accumulated index + // from the real one. Ops absent from the table return an empty DetailedOperands list. + // + // KNOWN PARITY GAP -- derived (sub-instruction) operands omitted. ~10 call/syscall/intrinsic + // ops (CALL, CALL_UNTYPED, SYSCALL_*, TAILCALL_*, INTRINSIC_*, MEMORY_INTRINSIC_SSA, and + // their *_SSA forms) list an output/params/output_dest_memory operand whose VALUE is reached + // by reading a CallOutput/CallParam sub-instruction expression and then unwrapping it (e.g. + // MediumLevelILCallUntyped.params = self._get_expr(2).src). BNMediumLevelILGetOperandList does + // not flatten across the parent->sub boundary, so these operands cannot be served by the flat + // raw-slot readers this table dispatches. They are OMITTED here; the flat-readable operands + // (dest, stack, intrinsic, src_memory, ...) ARE included. Closing this gap needs bespoke + // sub-instruction navigation per op -- tracked as a follow-up, not silently dropped. + // + // VERSION NOTE. This table matches the INSTALLED core (5.3.9757 / python api revision + // aa25bfc): 140 operations. The C# MediumLevelILOperation enum was generated against a newer + // binaryninja-api and has 11 members the installed core never emits (MLIL_ABS, MLIL_BSWAP, + // MLIL_CLS, MLIL_CLZ, MLIL_CTZ, MLIL_MAXS, MLIL_MAXU, MLIL_MINS, MLIL_MINU, MLIL_POPCNT, + // MLIL_RBIT); those have no row and return an empty DetailedOperands list. The one rename + // (installed core MLIL_CALL_OUTPUT == C# MLIL_VAR_OUTPUT) is handled below. + internal static class MediumLevelILDetailedOperandsTable + { + internal static readonly Dictionary Table = + new Dictionary + { + { MediumLevelILOperation.MLIL_NOP, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_NORET, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_BP, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_UNDEF, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_UNIMPL, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_LOAD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_VAR, new ILOperandDescriptor[] { new ILOperandDescriptor("var", ILOperandKind.Variable, 0, "Variable") } }, + { MediumLevelILOperation.MLIL_ADDRESS_OF, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Variable, 0, "Variable") } }, + { MediumLevelILOperation.MLIL_CONST, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { MediumLevelILOperation.MLIL_CONST_PTR, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { MediumLevelILOperation.MLIL_FLOAT_CONST, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Float, 0, "float") } }, + { MediumLevelILOperation.MLIL_IMPORT, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int") } }, + { MediumLevelILOperation.MLIL_CONST_DATA, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.ConstantData, 0, "ConstantData") } }, + { MediumLevelILOperation.MLIL_SET_VAR, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_LOAD_STRUCT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int") } }, + { MediumLevelILOperation.MLIL_STORE, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("src", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_VAR_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int") } }, + { MediumLevelILOperation.MLIL_VAR_SPLIT, new ILOperandDescriptor[] { new ILOperandDescriptor("high", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("low", ILOperandKind.Variable, 1, "Variable") } }, + { MediumLevelILOperation.MLIL_ADDRESS_OF_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int") } }, + { MediumLevelILOperation.MLIL_EXTERN_PTR, new ILOperandDescriptor[] { new ILOperandDescriptor("constant", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int") } }, + { MediumLevelILOperation.MLIL_ADD, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SUB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_AND, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_OR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_XOR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_LSL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_LSR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ASR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ROL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ROR, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MUL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MULU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MULS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_DIVU, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_DIVU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_DIVS, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_DIVS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MODU, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MODU_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MODS, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_MODS_DP, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_NEG, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_NOT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SX, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ZX, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_LOW_PART, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_JUMP, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_RET_HINT, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_VAR_OUTPUT, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.VariableList, 0, "List[Variable]") } }, + { MediumLevelILOperation.MLIL_CALL_PARAM, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.ExpressionList, 0, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_SEPARATE_PARAM_LIST, new ILOperandDescriptor[] { new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 0, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_SHARED_PARAM_SLOT, new ILOperandDescriptor[] { new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 0, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_RET, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.ExpressionList, 0, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_GOTO, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Integer, 0, "InstructionIndex") } }, + { MediumLevelILOperation.MLIL_BOOL_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FREE_VAR_SLOT, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Variable, 0, "Variable") } }, + { MediumLevelILOperation.MLIL_TRAP, new ILOperandDescriptor[] { new ILOperandDescriptor("vector", ILOperandKind.Integer, 0, "int") } }, + { MediumLevelILOperation.MLIL_FREE_VAR_SLOT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("prev", ILOperandKind.SSAVariable, 0, 2, "SSAVariable") } }, + { MediumLevelILOperation.MLIL_UNIMPL_MEM, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FSQRT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FNEG, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FABS, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FLOAT_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_INT_TO_FLOAT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FLOAT_CONV, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ROUND_TO_INT, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FLOOR, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CEIL, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FTRUNC, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_VAR_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("var", ILOperandKind.SSAVariable, 0, "SSAVariable") } }, + { MediumLevelILOperation.MLIL_VAR_ALIASED, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.SSAVariable, 0, "SSAVariable") } }, + { MediumLevelILOperation.MLIL_CMP_E, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_NE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_SLT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_ULT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_SLE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_ULE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_SGE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_UGE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_SGT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CMP_UGT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_TEST_BIT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ADD_OVERFLOW, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SYSCALL, new ILOperandDescriptor[] { new ILOperandDescriptor("output", ILOperandKind.VariableList, 0, "List[Variable]"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 2, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_VAR_SSA_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 2, "int") } }, + { MediumLevelILOperation.MLIL_VAR_ALIASED_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 2, "int") } }, + { MediumLevelILOperation.MLIL_VAR_SPLIT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("high", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("low", ILOperandKind.SSAVariable, 2, "SSAVariable") } }, + { MediumLevelILOperation.MLIL_CALL_OUTPUT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("dest", ILOperandKind.SSAVariableList, 1, "List[SSAVariable]") } }, + { MediumLevelILOperation.MLIL_CALL_PARAM_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("src", ILOperandKind.ExpressionList, 1, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_LOAD_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 1, "int") } }, + { MediumLevelILOperation.MLIL_VAR_PHI, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.SSAVariableList, 2, "List[SSAVariable]") } }, + { MediumLevelILOperation.MLIL_MEM_PHI, new ILOperandDescriptor[] { new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.IntegerList, 1, "List[int]") } }, + { MediumLevelILOperation.MLIL_SET_VAR_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_E, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_NE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_LT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_LE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_GE, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_GT, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_O, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FCMP_UO, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FADD, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FSUB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FMUL, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_FDIV, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_JUMP_TO, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("targets", ILOperandKind.IntegerList, 1, "Dict[int, int]") } }, + { MediumLevelILOperation.MLIL_SET_VAR_ALIASED, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("prev", ILOperandKind.SSAVariable, 0, 2, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SYSCALL_UNTYPED, new ILOperandDescriptor[] { new ILOperandDescriptor("stack", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_TAILCALL, new ILOperandDescriptor[] { new ILOperandDescriptor("output", ILOperandKind.VariableList, 0, "List[Variable]"), new ILOperandDescriptor("dest", ILOperandKind.Expression, 2, "MediumLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 3, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_INTRINSIC, new ILOperandDescriptor[] { new ILOperandDescriptor("output", ILOperandKind.VariableList, 0, "List[Variable]"), new ILOperandDescriptor("intrinsic", ILOperandKind.Intrinsic, 2, "ILIntrinsic"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 3, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_INTRINSIC_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("output", ILOperandKind.SSAVariableList, 0, "List[SSAVariable]"), new ILOperandDescriptor("intrinsic", ILOperandKind.Intrinsic, 2, "ILIntrinsic"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 3, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_MEMORY_INTRINSIC_OUTPUT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 0, "int"), new ILOperandDescriptor("output", ILOperandKind.SSAVariableList, 1, "List[SSAVariable]") } }, + { MediumLevelILOperation.MLIL_MEMORY_INTRINSIC_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("intrinsic", ILOperandKind.Intrinsic, 1, "ILIntrinsic"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 2, "List[MediumLevelILInstruction]"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { MediumLevelILOperation.MLIL_SET_VAR_SSA_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("prev", ILOperandKind.SSAVariable, 0, 2, "SSAVariable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 3, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 4, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SET_VAR_SPLIT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("high", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("low", ILOperandKind.SSAVariable, 2, "SSAVariable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 4, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SET_VAR_ALIASED_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.SSAVariable, 0, "SSAVariable"), new ILOperandDescriptor("prev", ILOperandKind.SSAVariable, 0, 2, "SSAVariable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 3, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 4, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SYSCALL_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 1, "List[MediumLevelILInstruction]"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 3, "int") } }, + { MediumLevelILOperation.MLIL_SYSCALL_UNTYPED_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("stack", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_LOAD_STRUCT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("src", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 2, "int") } }, + { MediumLevelILOperation.MLIL_SET_VAR_FIELD, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SET_VAR_SPLIT, new ILOperandDescriptor[] { new ILOperandDescriptor("high", ILOperandKind.Variable, 0, "Variable"), new ILOperandDescriptor("low", ILOperandKind.Variable, 1, "Variable"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_STORE_STRUCT, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ADC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_SBB, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_RLC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_RRC, new ILOperandDescriptor[] { new ILOperandDescriptor("left", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("right", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("carry", ILOperandKind.Expression, 2, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_TAILCALL_UNTYPED, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("stack", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CALL_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 2, "List[MediumLevelILInstruction]"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { MediumLevelILOperation.MLIL_CALL_UNTYPED_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("stack", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_TAILCALL_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 2, "List[MediumLevelILInstruction]"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 4, "int") } }, + { MediumLevelILOperation.MLIL_TAILCALL_UNTYPED_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("stack", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CALL, new ILOperandDescriptor[] { new ILOperandDescriptor("output", ILOperandKind.VariableList, 0, "List[Variable]"), new ILOperandDescriptor("dest", ILOperandKind.Expression, 2, "MediumLevelILInstruction"), new ILOperandDescriptor("params", ILOperandKind.ExpressionList, 3, "List[MediumLevelILInstruction]") } }, + { MediumLevelILOperation.MLIL_IF, new ILOperandDescriptor[] { new ILOperandDescriptor("condition", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("true", ILOperandKind.Integer, 1, "InstructionIndex"), new ILOperandDescriptor("false", ILOperandKind.Integer, 2, "InstructionIndex") } }, + { MediumLevelILOperation.MLIL_STORE_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 2, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_CALL_UNTYPED, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 1, "MediumLevelILInstruction"), new ILOperandDescriptor("stack", ILOperandKind.Expression, 3, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_STORE_STRUCT_SSA, new ILOperandDescriptor[] { new ILOperandDescriptor("dest", ILOperandKind.Expression, 0, "MediumLevelILInstruction"), new ILOperandDescriptor("offset", ILOperandKind.Integer, 1, "int"), new ILOperandDescriptor("dest_memory", ILOperandKind.Integer, 2, "int"), new ILOperandDescriptor("src_memory", ILOperandKind.Integer, 3, "int"), new ILOperandDescriptor("src", ILOperandKind.Expression, 4, "MediumLevelILInstruction") } }, + { MediumLevelILOperation.MLIL_ASSERT, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_ASSERT_SSA, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_FORCE_VER, new ILOperandDescriptor[] { } }, + { MediumLevelILOperation.MLIL_FORCE_VER_SSA, new ILOperandDescriptor[] { } }, + }; + } +} diff --git a/Struct/BNHighLevelILInstruction.cs b/Struct/BNHighLevelILInstruction.cs index b632fcd..3ce2c1c 100644 --- a/Struct/BNHighLevelILInstruction.cs +++ b/Struct/BNHighLevelILInstruction.cs @@ -1754,22 +1754,22 @@ public long GetOperandAsInteger(OperandIndex operand) /// Operations with no operands return an empty list. This is the foundation for /// and . /// - public virtual IList DetailedOperands + public virtual IList DetailedOperands { get { if (false == HighLevelILDetailedOperandsTable.Table.TryGetValue( - this.Operation, out HighLevelILOperandDescriptor[]? descriptors)) + this.Operation, out ILOperandDescriptor[]? descriptors)) { - return new List(); + return new List(); } - List result = new List(descriptors.Length); + List result = new List(descriptors.Length); - foreach (HighLevelILOperandDescriptor descriptor in descriptors) + foreach (ILOperandDescriptor descriptor in descriptors) { - object? value = this.ReadDetailedOperandByKind(descriptor.Kind, descriptor.RawIndex); - result.Add(new HighLevelILOperand( + object? value = this.ReadDetailedOperandByKind(descriptor); + result.Add(new ILOperand( descriptor.Name, value, descriptor.Kind, descriptor.TypeName)); } @@ -1778,49 +1778,56 @@ public virtual IList DetailedOperands } /// - /// Reads one operand by its descriptor kind. An SSA variable occupies two raw slots -- the - /// variable identifier at RawIndex and its version at RawIndex + 1. + /// Reads one operand by its descriptor. SSA variables and constant data each occupy two raw + /// slots: the identifier/state at and the + /// version/value at (which defaults to + /// RawIndex + 1 when not set explicitly). /// - private object? ReadDetailedOperandByKind(HighLevelILOperandKind kind, int rawIndex) + private object? ReadDetailedOperandByKind(ILOperandDescriptor descriptor) { - OperandIndex index = (OperandIndex)(ulong)rawIndex; + OperandIndex index = (OperandIndex)(ulong)descriptor.RawIndex; - switch (kind) + int secondary = descriptor.SecondaryRawIndex < 0 + ? descriptor.RawIndex + 1 + : descriptor.SecondaryRawIndex; + OperandIndex secondaryIndex = (OperandIndex)(ulong)secondary; + + switch (descriptor.Kind) { - case HighLevelILOperandKind.Expression: + case ILOperandKind.Expression: return this.GetOperandAsExpression(index); - case HighLevelILOperandKind.ExpressionList: + case ILOperandKind.ExpressionList: return this.GetOperandAsExpressionList(index); - case HighLevelILOperandKind.Integer: + case ILOperandKind.Integer: return this.GetOperandAsInteger(index); - case HighLevelILOperandKind.IntegerList: + case ILOperandKind.IntegerList: return this.GetOperandAsIntegerArray(index); - case HighLevelILOperandKind.Variable: + case ILOperandKind.Variable: return this.GetOperandAsVariable(index); - case HighLevelILOperandKind.VariableList: + case ILOperandKind.VariableList: return this.GetOperandAsVariableList(index); - case HighLevelILOperandKind.SSAVariable: - return this.GetOperandAsSSAVariable(index, (OperandIndex)(ulong)(rawIndex + 1)); + case ILOperandKind.SSAVariable: + return this.GetOperandAsSSAVariable(index, secondaryIndex); - case HighLevelILOperandKind.SSAVariableList: + case ILOperandKind.SSAVariableList: return this.GetOperandAsSSAVariableList(index); - case HighLevelILOperandKind.Float: + case ILOperandKind.Float: return this.GetOperandAsDouble(index); - case HighLevelILOperandKind.GotoLabel: + case ILOperandKind.GotoLabel: return this.GetOperandAsLabel(index); - case HighLevelILOperandKind.ConstantData: - return this.GetOperandAsConstantData(index, (OperandIndex)(ulong)(rawIndex + 1)); + case ILOperandKind.ConstantData: + return this.GetOperandAsConstantData(index, secondaryIndex); - case HighLevelILOperandKind.Intrinsic: + case ILOperandKind.Intrinsic: return this.GetOperandAsIntrinsic(index); default: @@ -1838,10 +1845,10 @@ public IList Operands { get { - IList detailed = this.DetailedOperands; + IList detailed = this.DetailedOperands; List result = new List(detailed.Count); - foreach (HighLevelILOperand operand in detailed) + foreach (ILOperand operand in detailed) { result.Add(operand.Value); } @@ -1870,7 +1877,7 @@ public IEnumerable Traverse( yield return root; } - foreach (HighLevelILOperand operand in this.DetailedOperands) + foreach (ILOperand operand in this.DetailedOperands) { if (shallow && HighLevelILInstruction.ShallowTraversalBlacklist.Contains(operand.Name)) { diff --git a/Struct/BNMediumLevelILInstruction.cs b/Struct/BNMediumLevelILInstruction.cs index b6770ec..514373b 100644 --- a/Struct/BNMediumLevelILInstruction.cs +++ b/Struct/BNMediumLevelILInstruction.cs @@ -129,9 +129,9 @@ public MediumLevelILFunction Function { MediumLevelILOperation.MLIL_LOW_PART, 2 }, // value, toSize { MediumLevelILOperation.MLIL_JUMP, 1 }, { MediumLevelILOperation.MLIL_JUMP_TO, 2 }, // target, switchVar - { MediumLevelILOperation.MLIL_RET_HINT, 0 }, + { MediumLevelILOperation.MLIL_RET_HINT, 1 }, // dest(expr)@0 { MediumLevelILOperation.MLIL_CALL, 3 }, // dest, params(list), outputs(list) - { MediumLevelILOperation.MLIL_CALL_UNTYPED, 3 }, // dest, params(list), outputs(list) + { MediumLevelILOperation.MLIL_CALL_UNTYPED, 4 }, // output(subexpr)@0, dest@1, params(subexpr)@2, stack@3 { MediumLevelILOperation.MLIL_VAR_OUTPUT, 2 }, // outputLoc, sourceExpr { MediumLevelILOperation.MLIL_CALL_PARAM, 2 }, // paramLoc, sourceExpr { MediumLevelILOperation.MLIL_SEPARATE_PARAM_LIST, 2 }, // intParams(list), floatParams(list) @@ -154,9 +154,9 @@ public MediumLevelILFunction Function { MediumLevelILOperation.MLIL_BOOL_TO_INT, 1 }, { MediumLevelILOperation.MLIL_ADD_OVERFLOW, 2 }, { MediumLevelILOperation.MLIL_SYSCALL, 3 }, // output(varList), params(list) - { MediumLevelILOperation.MLIL_SYSCALL_UNTYPED, 2 }, // params(list), outputs(list) + { MediumLevelILOperation.MLIL_SYSCALL_UNTYPED, 3 }, // output(subexpr)@0, params(subexpr)@1, stack@2 { MediumLevelILOperation.MLIL_TAILCALL, 4 }, // output(varList), dest, params(list) - { MediumLevelILOperation.MLIL_TAILCALL_UNTYPED, 2 }, // dest, params(list) + { MediumLevelILOperation.MLIL_TAILCALL_UNTYPED, 4 }, // output(subexpr)@0, dest@1, params(subexpr)@2, stack@3 { MediumLevelILOperation.MLIL_INTRINSIC, 4 }, // output(varList), intrinsic, params(list) { MediumLevelILOperation.MLIL_FREE_VAR_SLOT, 1 }, // var { MediumLevelILOperation.MLIL_BP, 0 }, @@ -211,7 +211,7 @@ public MediumLevelILFunction Function { MediumLevelILOperation.MLIL_LOAD_SSA, 2 }, // addr, srcMem { MediumLevelILOperation.MLIL_LOAD_STRUCT_SSA, 3 }, // addr, offset, srcMem { MediumLevelILOperation.MLIL_STORE_SSA, 4 }, // destExpr, destMemoryVersion, sourceMemoryVersion, sourceExpr - { MediumLevelILOperation.MLIL_STORE_STRUCT_SSA, 4 }, // addr, offset, value, dstMem + { MediumLevelILOperation.MLIL_STORE_STRUCT_SSA, 5 }, // dest@0, offset@1, dest_memory@2, src_memory@3, src@4 { MediumLevelILOperation.MLIL_INTRINSIC_SSA, 4 }, // intrinsicId, params(list), outputs(list), srcMem { MediumLevelILOperation.MLIL_MEMORY_INTRINSIC_SSA, 5 }, // output, destMemory, intrinsic, params(list), srcMemory { MediumLevelILOperation.MLIL_FREE_VAR_SLOT_SSA, 3 }, // destSSAVariable(var,version), prev @@ -1025,10 +1025,14 @@ public virtual MediumLevelILSSAVariable[] SSAVariablesWrite public T[] GetOperandAsIntegerArray(OperandIndex operand) where T : unmanaged { + // BNMediumLevelILGetOperandList takes the operand INDEX (not the value at that slot): + // the core walks the operation's operand layout to locate the list, so passing the + // slot value -- as this method did before -- read an unrelated number and returned a + // garbage list. Mirrors GetOperandAsIntegerMap below. IntPtr arrayPointer = NativeMethods.BNMediumLevelILGetOperandList( this.ILFunction.DangerousGetHandle() , this.ExpressionIndex , - this.RawOperands[(ulong)operand] , + (ulong)operand , out ulong arrayLength ); @@ -1084,7 +1088,17 @@ public double GetOperandAsDouble(OperandIndex operand) { return BitConverter.UInt64BitsToDouble(this.RawOperands[(ulong)operand]); } - + + /// + /// Reads one raw operand slot as a signed integer, mirroring the integer operands exposed by + /// Python MediumLevelILInstruction detailed_operands (e.g. StructField.offset, + /// StoreSsa.dest_memory, JumpTo.targets). + /// + public long GetOperandAsInteger(OperandIndex operand) + { + return (long)this.RawOperands[(ulong)operand]; + } + public RegisterValue GetOperandAsConstantData( OperandIndex operand1 , OperandIndex operand2 @@ -1450,7 +1464,178 @@ public HighLevelILInstruction? HighLevelILInstruction return this.ILFunction.GetHighLevelILInstruction(this.InstructionIndex); } } - + + /// + /// The named, typed operands of this instruction, mirroring Python + /// MediumLevelILInstruction.detailed_operands (mediumlevelil.py:495). Each entry pairs the + /// operand name (e.g. "left", "src", "dest"), its value, its kind, and the Python type + /// string. Operations with no operands return an empty list. This is the foundation for + /// and . + /// + /// See MediumLevelILDetailedOperandsTable for the known gap: the derived (sub-instruction) + /// operands of the call/syscall/intrinsic family are omitted because they cannot be served by + /// a flat raw-slot reader. + /// + public virtual IList DetailedOperands + { + get + { + if (false == MediumLevelILDetailedOperandsTable.Table.TryGetValue( + this.Operation, out ILOperandDescriptor[]? descriptors)) + { + return new List(); + } + + List result = new List(descriptors.Length); + + foreach (ILOperandDescriptor descriptor in descriptors) + { + object? value = this.ReadDetailedOperandByKind(descriptor); + result.Add(new ILOperand( + descriptor.Name, value, descriptor.Kind, descriptor.TypeName)); + } + + return result; + } + } + + /// + /// Reads one operand by its descriptor. SSA variables and constant data each occupy two raw + /// slots: the identifier/state at and the + /// version/value at (which defaults to + /// RawIndex + 1 when not set explicitly). + /// + private object? ReadDetailedOperandByKind(ILOperandDescriptor descriptor) + { + OperandIndex index = (OperandIndex)(ulong)descriptor.RawIndex; + + int secondary = descriptor.SecondaryRawIndex < 0 + ? descriptor.RawIndex + 1 + : descriptor.SecondaryRawIndex; + OperandIndex secondaryIndex = (OperandIndex)(ulong)secondary; + + switch (descriptor.Kind) + { + case ILOperandKind.Expression: + return this.GetOperandAsExpression(index); + + case ILOperandKind.ExpressionList: + return this.GetOperandAsExpressionList(index); + + case ILOperandKind.Integer: + return this.GetOperandAsInteger(index); + + case ILOperandKind.IntegerList: + return this.GetOperandAsIntegerArray(index); + + case ILOperandKind.Variable: + return this.GetOperandAsVariable(index); + + case ILOperandKind.VariableList: + return this.GetOperandAsVariableList(index); + + case ILOperandKind.SSAVariable: + return this.GetOperandAsSSAVariable(index, secondaryIndex); + + case ILOperandKind.SSAVariableList: + return this.GetOperandAsSSAVariableList(index); + + case ILOperandKind.Float: + return this.GetOperandAsDouble(index); + + case ILOperandKind.ConstantData: + return this.GetOperandAsConstantData(index, secondaryIndex); + + case ILOperandKind.Intrinsic: + return this.GetOperandAsIntrinsic(index); + + default: + return null; + } + } + + /// + /// The operand values of this instruction (the value component of + /// ), mirroring Python MediumLevelILInstruction.operands + /// (mediumlevelil.py:486). Prefer the named accessors (Source, Left, Condition, ...) when the + /// operand kind is known at the call site. + /// + public IList Operands + { + get + { + IList detailed = this.DetailedOperands; + List result = new List(detailed.Count); + + foreach (ILOperand operand in detailed) + { + result.Add(operand.Value); + } + + return result; + } + } + + /// + /// Depth-first traversal of this instruction's operand tree, mirroring Python + /// MediumLevelILInstruction.traverse (mediumlevelil.py:511). The callback is invoked on this + /// node and every reachable sub-instruction; each non-null result is yielded. Pass a named + /// method (method group) as the callback. + /// + /// Python's MLIL traverse descends into every detailed operand unconditionally -- unlike + /// HighLevelIL it has no blacklist, because MLIL branch targets are instruction/label indices + /// rather than sub-instructions, so no operand leaves the enclosing instruction's scope. The + /// parameter is kept for signature parity with + /// ; MLIL has no blacklisted names, so it has + /// no effect here. + /// + /// The result type; constrained to a reference type so null signals + /// "do not yield". + public IEnumerable Traverse( + Func callback, bool shallow = true) where T : class + { + T? root = callback(this); + + if (null != root) + { + yield return root; + } + + foreach (ILOperand operand in this.DetailedOperands) + { + if (shallow && MediumLevelILInstruction.ShallowTraversalBlacklist.Contains(operand.Name)) + { + continue; + } + + if (operand.Value is MediumLevelILInstruction subInstruction) + { + foreach (T nested in subInstruction.Traverse(callback, shallow)) + { + yield return nested; + } + } + else if (operand.Value is MediumLevelILInstruction[] subList) + { + foreach (MediumLevelILInstruction item in subList) + { + foreach (T nested in item.Traverse(callback, shallow)) + { + yield return nested; + } + } + } + } + } + + // Operand names to skip during shallow traversal. Empty for MLIL: Python's + // MediumLevelILInstruction.traverse (mediumlevelil.py:511) has no blacklist, because MLIL + // branch targets are indices/labels, not sub-instructions. Kept as the extension point so + // the signature matches HighLevelILInstruction.Traverse and a future operand that should be + // skipped can be added in one place. + private static readonly HashSet ShallowTraversalBlacklist = + new HashSet(); + } - + }