angr.analyses.decompiler.peephole_optimizations.arm_cmpf

class angr.analyses.decompiler.peephole_optimizations.arm_cmpf.ARMCmpF

Bases: PeepholeOptimizationExprBase

Rewrites tests of ARM NZCV flags.

VEX lowers vcmp to FPSCR = (FPSCR & 0x0fffffff) | nzcv(CmpF(a, b)) << 28 and vmrs APSR_nzcv, fpscr to a COPY of FPSCR’s top nibble into the flags. The condition of the next branch then extracts the flag bits. This optimization rewrites the bit test by evaluating each CmpF outcome (seeing through the FPSCR definition in the same block, or its unique definition elsewhere in the function) and replacing by the equivalent comparison.

NAME = 'Simplifying CmpF on ARM'
expr_classes = (<class 'angr.ailment.expression.Convert'>, <class 'angr.ailment.expression.BinaryOp'>)
__init__(*args, **kwargs)
optimize(expr, *, stmt_idx=None, block=None, block_defs=None, **kwargs)
Parameters: