These function are relatively complex and will be even more. Add minimal documentation to them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- Documentation/api.rst | 5 +++++ simplify.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Documentation/api.rst b/Documentation/api.rst index 1270551cb..cb8a09820 100644 --- a/Documentation/api.rst +++ b/Documentation/api.rst @@ -20,3 +20,8 @@ Typing ~~~~~~ .. c:autodoc:: evaluate.h + +Optimization +~~~~~~~~~~~~ + +.. c:autodoc:: simplify.c diff --git a/simplify.c b/simplify.c index 4c3036963..8d3ba44f3 100644 --- a/simplify.c +++ b/simplify.c @@ -546,6 +546,13 @@ undef: return NULL; } +/// +// try to simplify OP(OR(a, b), C) +// @insn: the 'masking' instruction +// @mask: the mask associated to @insn (M) +// @ora: one of the OR's operands +// @orb: the other OR's operand +// @return: 0 if no changes have been made, one or more REPEAT_* flags otherwise. static int simplify_mask_or_and(struct instruction *insn, unsigned long long mask, pseudo_t ora, pseudo_t orb) { @@ -565,6 +572,16 @@ static int simplify_mask_or_and(struct instruction *insn, unsigned long long mas return replace_pseudo(insn, &insn->src1, orb); } +/// +// try to simplify OP(OR(a, b), C) +// @insn: the 'masking' instruction +// @mask: the mask associated to @insn (M): +// @or: the OR instruction +// @return: 0 if no changes have been made, one or more REPEAT_* flags otherwise. +// +// For the @mask (M): +// * if OP == AND, @mask M is C +// * if OP == LSR, @mask M is (-1 << C) static int simplify_mask_or(struct instruction *insn, unsigned long long mask, struct instruction *or) { pseudo_t src1 = or->src1; -- 2.18.0