angr.analyses.decompiler.optimization_passes.optimization_pass¶
- class angr.analyses.decompiler.optimization_passes.optimization_pass.BlockCache¶
Bases:
tupleBlockCache(rd, prop)
- static __new__(_cls, rd, prop)
Create new instance of BlockCache(rd, prop)
- prop
Alias for field number 1
- rd
Alias for field number 0
- exception angr.analyses.decompiler.optimization_passes.optimization_pass.MultipleBlocksException¶
Bases:
ExceptionAn exception that is raised in _get_block() where multiple blocks satisfy the criteria but only one block was requested.
- class angr.analyses.decompiler.optimization_passes.optimization_pass.OptimizationPassStage¶
Bases:
EnumEnums about optimization pass stages.
Note that the region identification pass (RegionIdentifier) may modify existing AIL blocks without updating the topology of the original AIL graph. For example, loop successor refinement may modify create a new AIL block with an artificial address, and alter existing jump targets of jump statements and conditional jump statements to point to this new block. However, loop successor refinement does not update the topology of the original AIL graph, which means this new AIL block does not exist in the original AIL graph. As a result, until this behavior of RegionIdentifier changes in the future, DURING_REGION_IDENTIFICATION optimization passes should not modify existing jump targets.
- AFTER_AIL_GRAPH_CREATION = 0¶
- BEFORE_SSA_LEVEL0_TRANSFORMATION = 1¶
- AFTER_SINGLE_BLOCK_SIMPLIFICATION = 2¶
- BEFORE_SSA_LEVEL1_TRANSFORMATION = 3¶
- AFTER_SSA_LEVEL1_TRANSFORMATION = 4¶
- AFTER_MAKING_CALLSITES = 5¶
- AFTER_GLOBAL_SIMPLIFICATION = 6¶
- BEFORE_VARIABLE_RECOVERY = 7¶
- AFTER_VARIABLE_RECOVERY = 8¶
- BEFORE_REGION_IDENTIFICATION = 9¶
- DURING_REGION_IDENTIFICATION = 10¶
- AFTER_STRUCTURING = 11¶
- class angr.analyses.decompiler.optimization_passes.optimization_pass.BaseOptimizationPass¶
Bases:
objectThe base class for any optimization pass.
- ARCHES = []¶
- PLATFORMS = []¶
- STAGE: OptimizationPassStage
- NAME = 'N/A'¶
- DESCRIPTION = 'N/A'¶
- property kb¶
- analyze()¶
- class angr.analyses.decompiler.optimization_passes.optimization_pass.OptimizationPass¶
Bases:
BaseOptimizationPassThe base class for any function-level graph optimization pass.
- __init__(func, manager, *, graph, blocks_by_addr=None, blocks_by_addr_and_idx=None, variable_kb=None, region_identifier=None, reaching_definitions=None, vvar_id_start=0, entry_node_addr=None, scratch=None, force_loop_single_exit=True, refine_loops_with_single_successor=False, complete_successors=False, fold_expressions=True, avoid_vvar_ids=None, arg_vvars=None, peephole_optimizations=None, stack_pointer_tracker=None, notes=None, **kwargs)¶
- Parameters:
- out_graph: DiGraph | None
- bfs_nodes(depth=None, start_node=None)¶
- class angr.analyses.decompiler.optimization_passes.optimization_pass.SequenceOptimizationPass¶
Bases:
BaseOptimizationPassThe base class for any sequence node optimization pass.
- __init__(func, manager, seq=None, **kwargs)¶
- class angr.analyses.decompiler.optimization_passes.optimization_pass.StructuringOptimizationPass¶
Bases:
OptimizationPassThe base class for any optimization pass that requires structuring. Optimization passes that inherit from this class should directly depend on structuring artifacts, such as regions and gotos. Otherwise, they should use OptimizationPass. This is the heaviest (computation time) optimization pass class.
By default this type of optimization should work: - on any architecture - on any platform - during region identification (to have iterative structuring) - only with the SAILR structuring algorithm
- ARCHES = None¶
- PLATFORMS = None¶
- STAGE: OptimizationPassStage = 10¶
- __init__(func, manager, require_structurable_graph=True, prevent_new_gotos=True, strictly_less_gotos=False, recover_structure_fails=True, must_improve_rel_quality=True, max_opt_iters=1, simplify_ail=True, require_gotos=True, readd_labels=False, edges_to_remove=None, **kwargs)¶
- Parameters:
require_structurable_graph (bool)
prevent_new_gotos (bool)
strictly_less_gotos (bool)
recover_structure_fails (bool)
must_improve_rel_quality (bool)
max_opt_iters (int)
simplify_ail (bool)
require_gotos (bool)
readd_labels (bool)
edges_to_remove (list[tuple[tuple[int, int | None], tuple[int, int | None]]] | None)
- analyze()¶
Wrapper for _analyze() that verifies the graph is structurable before and after the optimization.