references/bnil-hlil.md
GitHubHLIL Instruction Reference
High Level IL is Binary Ninja's decompiler output. It recovers high-level language constructs (if/while/for/switch), folds expressions, and eliminates dead code. Tree-based with significant nesting.
Key Differences from MLIL
- Control flow recovery -- while, do-while, for, switch/case, break, continue
- Expression folding -- multiple MLIL statements collapsed into single expressions
- No
.outputon HLIL_CALL -- return values appear asinst.rightofHighLevelILVarInitorHighLevelILVarAssign - Struct fields and array indexing --
HLIL_STRUCT_FIELD,HLIL_ARRAY_INDEX,HLIL_DEREF_FIELD
Important: Tree Structure
HLIL is heavily tree-based. Naive iteration over top-level instructions will miss nested calls, comparisons, and operations. Use the traverse API or visit methods for thorough analysis.
Control Flow
HLIL_JUMP-- Branch todestaddressHLIL_CALL-- Calldestwithparams(nooutput-- returns via assignment)HLIL_TAILCALL-- Tail call todestwithparamsHLIL_SYSCALL-- System call withparamsHLIL_RET-- Return to callerHLIL_NORET-- Unreachable code markerHLIL_IF-- Conditional:condition->true/falsebranchHLIL_GOTO-- Branch to IL labelHLIL_WHILE-- While loopHLIL_DO_WHILE-- Do-while loopHLIL_FOR-- For loopHLIL_SWITCH-- Switch statementHLIL_CASE-- Case within switchHLIL_BREAK-- Break from loop/switchHLIL_CONTINUE-- Continue to next loop iteration
Variable Reads and Writes
HLIL_VAR_DECLARE-- Declaration ofvarHLIL_VAR_INIT-- Initializedestvariable withsrcexpressionHLIL_ASSIGN-- SetdesttosrcexpressionHLIL_ASSIGN_UNPACK-- Destructuring assignmentHLIL_VAR-- Variable referenceHLIL_VAR_PHI-- PHI node for variable versionsHLIL_MEM_PHI-- Memory PHIHLIL_ADDRESS_OF-- Address of variablesrc
Memory Access
HLIL_DEREF-- Dereferencesrc(pointer read)HLIL_DEREF_FIELD-- Dereference with field offsetHLIL_STRUCT_FIELD-- Access struct fieldHLIL_ARRAY_INDEX-- Array element accessHLIL_SPLIT-- Split pairhigh:low
Constants
HLIL_CONST-- Constant integerHLIL_CONST_DATA-- Constant data referenceHLIL_CONST_PTR-- Constant pointerHLIL_EXTERN_PTR-- External symbol pointerHLIL_FLOAT_CONST-- Floating point constantHLIL_IMPORT-- Imported addressHLIL_LOW_PART--sizebytes from low end ofsrc
Arithmetic Operations
HLIL_ADD/HLIL_ADC-- Add / Add with carryHLIL_SUB/HLIL_SBB-- Subtract / Subtract with borrowHLIL_AND/HLIL_OR/HLIL_XOR-- Bitwise AND/OR/XORHLIL_LSL/HLIL_LSR/HLIL_ASR-- ShiftsHLIL_ROL/HLIL_ROR/HLIL_RLC/HLIL_RRC-- RotationsHLIL_MUL/HLIL_MULU_DP/HLIL_MULS_DP-- MultiplyHLIL_DIVU/HLIL_DIVS/HLIL_DIVU_DP/HLIL_DIVS_DP-- DivideHLIL_MODU/HLIL_MODS/HLIL_MODU_DP/HLIL_MODS_DP-- ModulusHLIL_NEG/HLIL_NOT-- Negate/ComplementHLIL_SX/HLIL_ZX-- Sign/Zero extendHLIL_ADD_OVERFLOW-- Overflow of additionHLIL_BOOL_TO_INT-- Bool to integer
Floating Point
HLIL_FADD/HLIL_FSUB/HLIL_FMUL/HLIL_FDIV-- FP arithmeticHLIL_FSQRT/HLIL_FNEG/HLIL_FABS-- FP operationsHLIL_FLOAT_TO_INT/HLIL_INT_TO_FLOAT/HLIL_FLOAT_CONV-- ConversionsHLIL_ROUND_TO_INT/HLIL_FLOOR/HLIL_CEIL/HLIL_FTRUNC-- Rounding
Comparisons
HLIL_CMP_E/HLIL_CMP_NE-- Equal / Not equalHLIL_CMP_SLT/HLIL_CMP_ULT-- Signed/Unsigned less thanHLIL_CMP_SLE/HLIL_CMP_ULE-- Signed/Unsigned less than or equalHLIL_CMP_SGE/HLIL_CMP_UGE-- Signed/Unsigned greater than or equalHLIL_CMP_SGT/HLIL_CMP_UGT-- Signed/Unsigned greater thanHLIL_TEST_BIT-- Test if bitHLIL_FCMP_E/HLIL_FCMP_NE/HLIL_FCMP_LT/HLIL_FCMP_LE/HLIL_FCMP_GE/HLIL_FCMP_GTHLIL_FCMP_O(ordered) /HLIL_FCMP_UO(unordered)
Miscellaneous
HLIL_NOP-- No operationHLIL_BP-- BreakpointHLIL_TRAP-- Trap withvectorHLIL_INTRINSIC-- Architecture intrinsicHLIL_UNDEF-- Undefined behaviorHLIL_UNIMPL/HLIL_UNIMPL_MEM-- UnimplementedHLIL_BLOCK-- Block of statementsHLIL_LABEL-- Label targetHLIL_UNREACHABLE-- Unreachable code