angr.analyses.decompiler.peephole_optimizations.base¶
- class angr.analyses.decompiler.peephole_optimizations.base.PeepholeOptimizationStmtBase¶
Bases:
objectThe base class for all peephole optimizations that are applied on AIL statements.
fixpoint_reachedis an output parameter; it tells the caller whether this optimizer should run on this statement again (e.g., when statements prior to the current statement are optimized and changed). The caller setsfixpoint_reachedto True before everyoptimize()call; the optimizer optionally sets it to False if it wants to be invoked again on the same statement.So,
fixpoint_reachedshould be set to (or kept) True if (a) the optimizer has optimized the statement and does not expect to optimize it ever again, or (b) the optimizer cannot ever optimize the statement.- NAME = 'Peephole Optimization - Statement'¶
- DESCRIPTION = 'Peephole Optimization - Statement'¶
- stmt_classes = None¶
- __init__(project, kb, ail_manager, func_addr=None, preserve_vvar_ids=None, type_hints=None)¶
- Parameters:
project (Project | None)
kb (KnowledgeBase | None)
ail_manager (Manager)
func_addr (int | None)
type_hints (list[tuple[VirtualVariable | MemoryLocation, str]] | None)
- kb: KnowledgeBase | None
- manager
- type_hints: list[tuple[VirtualVariable | MemoryLocation, str]]
- fixpoint_reached: bool
- class angr.analyses.decompiler.peephole_optimizations.base.PeepholeOptimizationMultiStmtBase¶
Bases:
objectThe base class for all peephole optimizations that are applied on multiple AIL statements at once.
fixpoint_reachedexists for uniformity but is unused. Multi-statement optimizers always run regardless of whether the statements have reached fixed points or not.- NAME = 'Peephole Optimization - Multi-statement'¶
- DESCRIPTION = 'Peephole Optimization - Multi-statement'¶
- stmt_classes = None¶
- __init__(project, kb, ail_manager, func_addr=None, preserve_vvar_ids=None, type_hints=None)¶
- Parameters:
project (Project | None)
kb (KnowledgeBase | None)
ail_manager (Manager)
func_addr (int | None)
type_hints (list[tuple[VirtualVariable | MemoryLocation, str]] | None)
- kb: KnowledgeBase | None
- manager
- type_hints: list[tuple[VirtualVariable | MemoryLocation, str]]
- fixpoint_reached: bool
- class angr.analyses.decompiler.peephole_optimizations.base.PeepholeOptimizationExprBase¶
Bases:
objectThe base class for all peephole optimizations that are applied on AIL expressions. Please refer to
PeepholeOptimizationStmtBasefor thefixpoint_reachedcontract.- NAME = 'Peephole Optimization - Expression'¶
- DESCRIPTION = 'Peephole Optimization - Expression'¶
- expr_classes = None¶
- __init__(project, kb, ail_manager, func_addr=None, preserve_vvar_ids=None, type_hints=None)¶
- Parameters:
project (Project | None)
kb (KnowledgeBase | None)
ail_manager (Manager)
func_addr (int | None)
type_hints (list[tuple[VirtualVariable | MemoryLocation, str]] | None)
- kb: KnowledgeBase | None
- manager
- type_hints: list[tuple[VirtualVariable | MemoryLocation, str]]
- fixpoint_reached: bool
- optimize(expr, *, stmt_idx=None, block=None, **kwargs)¶
- Return type:
- Parameters:
stmt_idx (int | None)
- static find_definition(ail_expr, stmt_idx, block)¶
- Return type:
- Parameters:
ail_expr (Expression)
stmt_idx (int)
block (Block)
- static is_bool_expr(ail_expr)¶