Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup idea #146

Open
radare opened this issue Mar 8, 2019 · 2 comments
Open

Code cleanup idea #146

radare opened this issue Mar 8, 2019 · 2 comments
Assignees
Projects

Comments

@radare
Copy link
Contributor

radare commented Mar 8, 2019

i wrote a js file that parses the output of r2dec and performs the following substituions. we can use that as inspiration to improve the r2dec core.

I have initially though on that as a regex parser that takes the following:

eax = 33
getopt(eax)

into

getopt(33)

And also we can support nested operations like this:

eax = 0
eax += 0xf
eax <<= 4
if (eax == 32) {

}

into:

if (((0 + 0xf) << 4) == 32) {

}

ideally this can be evaluated because all the elements are constants

if (240 == 32) {

}
@elicn
Copy link
Contributor

elicn commented Mar 21, 2019

Common Sunexpression Elimination, Constant Folding and other optimizations that require propagations are not easy or simple in the current r2dec design: there are too many corner cases that may be taken into account [e.g. instructions that affect registers implicitly, like DIV or MUL]. We are working on this in "core2" branch - stay tuned ;)

@XVilka
Copy link

XVilka commented Mar 21, 2019 via email

@wargio wargio added this to TODO in core 2 Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
core 2
  
TODO
Development

No branches or pull requests

4 participants