Vector35 / Vector35/binaryninja-api
Provide some simplification of common routines like MIN/MAX
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Created on behalf of @VisualEhrmanntraut
Optimiser for min, max expressions:
TYPE val; if (Z > Y) { val = Y } else { val = Z } // after TYPE val = MIN(Y, Z);``` ```// before TYPE val; if (Z < Y) { val = Y } else { val = Z } // after TYPE val = MAX(Y, Z);
This should be done after all IL simplifications like constant propagation so that the analysis has a chance to optimize the MIN/MAX code out entirely. This really is not about any particular architecture plugin either, one can reasonably expect this operation to be performed by a set of instructions rather than any one instruction, were it the latter you might compromise and lift as an intrinsic, however even that is a little disappointing as you will stonewall certain analysis regarding the input and output registers.
Putting this as an HLIL issue because I believe that is the only place this optimization can be made considering the first sentence above.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the HLIL simplification passes and the existing IL simplifications, especially constant propagation. Determine where a conditional assignment can be recognized as MIN or MAX after those passes, then verify that equivalent expressions are produced and that existing analysis of inputs and outputs is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100