angr.analyses.decompiler.peephole_optimizations.bt_rflags_merge

class angr.analyses.decompiler.peephole_optimizations.bt_rflags_merge.BTRflagsMergeBitExtraction

Bases: PeepholeOptimizationExprBase

Fold CF extractions from the flags merge that the libVEX 3.27+ amd64 BT/BTS/BTR/BTC lifting emits.

The new lifting preserves O/S/A/P/Z across BT-family instructions by writing (amd64g_calculate_rflags_all(...) & 0x8D4) | bt_bit into the flags thunk. A downstream condition that tests the tested bit (CF, bit 0) extracts it as (merge & 0x8D4 | bt_bit) & 1; since 0x8D4 has bit 0 cleared, this is just bt_bit, and folding it lets the (otherwise unreducible) rflags_all ccall become dead.

NAME = '(x & 0x8d4 | bit) & 1 => bit'
expr_classes = (<class 'angr.ailment.expression.BinaryOp'>,)
optimize(expr, **kwargs)
Parameters:

expr (BinaryOp)