angr.analyses.decompiler.block_simplifier¶
- class angr.analyses.decompiler.block_simplifier.PeepholeOptimizationBundle¶
Bases:
objectPeepholeOptimizationBundle describes a set of initialized peephole optimizer instances and the dispatch structures derived from them. This bundle of peephole optimizations is reusable across BlockSimplifier invocations (so we avoid rebuilding the same optimizer instances).
- __init__(project, kb, ail_manager, func_addr=None, preserve_vvar_ids=None, type_hints=None, peephole_optimizations=None)¶
- Parameters:
ail_manager (Manager)
func_addr (int | None)
type_hints (list[tuple[VirtualVariable | MemoryLocation, str]] | None)
peephole_optimizations (Iterable[type[PeepholeOptimizationStmtBase | PeepholeOptimizationExprBase | PeepholeOptimizationMultiStmtBase]] | None)
- expr_opts
- stmt_opts
- multistmt_opts
- stmt_opts_by_kind
- expr_walker
- class angr.analyses.decompiler.block_simplifier.BlockSimplifier¶
Bases:
objectSimplify an AIL block.
Deliberately not an
Analysis: it is instantiated once per block, hundreds of times per decompilation, so it skips the analysis-factory ceremony. Instantiate it directly with the project as the first argument; exceptions always propagate.- __init__(project, block, ail_manager, func_addr=None, stack_pointer_tracker=None, peephole_optimizations=None, preserve_vvar_ids=None, type_hints=None, cached_propagator=None, peephole_bundle=None, graph_defs=None)¶
- Parameters:
block (
Block|None) – The AIL block to simplify. Setting it to None to skip calling self._analyze(), which is useful in test cases.peephole_bundle (
PeepholeOptimizationBundle|None) – A pre-built PeepholeOptimizationBundle to reuse. Its construction parameters must match this BlockSimplifier’s; callers that simplify many blocks should build one bundle and pass it to every BlockSimplifier they create.graph_defs (
GraphVVarDefs|None) – Unique vvar definitions of the graph the block belongs to, for peephole optimizations that see through definitions made in other blocks.project (Project)
ail_manager (Manager)
func_addr (int | None)
peephole_optimizations (Iterable[type[PeepholeOptimizationStmtBase | PeepholeOptimizationExprBase | PeepholeOptimizationMultiStmtBase]] | None)
type_hints (list[tuple[atoms.VirtualVariable | atoms.MemoryLocation, str]] | None)
- static replace_and_build(block, replacements, ail_manager, replace_assignment_dsts=False, replace_loads=False, gp=None, replace_registers=True, max_expr_depth=13, max_stmt_size=20000)¶
- Return type:
- Parameters:
block (Block)
replacements (Mapping[AILCodeLocation, Mapping[Expression, Expression]])
ail_manager (Manager)
replace_assignment_dsts (bool)
replace_loads (bool)
gp (int | None)
replace_registers (bool)
max_expr_depth (int | None)
max_stmt_size (int)