angr.analyses.decompiler.known_patterns.block_split¶
Utilities for splitting an AIL block into consecutive blocks within a graph.
The Outliner analysis operates at whole-block granularity, while KnownPattern matches are usually (sub-)statement-level; splitting the anchor block so the matched span becomes its own block bridges the two.
- angr.analyses.decompiler.known_patterns.block_split.rewrite_phi_sources(block, old_src, new_src, idx_alloc)¶
Rewrite phi statements at the top of
blockso that entries sourced fromold_srcare sourced fromnew_srcinstead. Mutates the block’s statement list in place.idx_allocsupplies AIL indices for the rebuilt statements: an object built withidx=Nonelands at index 0, and the decompiler’s VariableMap is keyed by index, so all of them would share one entry.
- angr.analyses.decompiler.known_patterns.block_split.split_ail_block(graph, block, pre_stmts, mid_stmts, post_stmts, block_addr_alloc, idx_alloc)¶
Replace
blockingraphwith up to three consecutive blocks holdingpre_stmts,mid_stmts, andpost_stmts.The first non-empty part keeps the original block identity
(addr, idx)so that predecessor jump targets (and the at-most-one-block-per-address assumption at the function entry) remain valid; each following part is placed at a fresh synthetic address obtained fromblock_addr_alloc. When the last part’s identity differs from the original, phi statements in the successors are rewritten to source from the new last block. Edge data is preserved.Returns
(b_pre, b_mid, b_post)whereb_pre/b_postare None when their statement list is empty.mid_stmtsmust be non-empty.