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

AST simplification on bitvector Extract #835

Closed
RobinDavid opened this issue Dec 4, 2019 · 4 comments
Closed

AST simplification on bitvector Extract #835

RobinDavid opened this issue Dec 4, 2019 · 4 comments

Comments

@RobinDavid
Copy link
Contributor

Some AST simplification can be performed in the AstContext::extract. Especially an extract on a constant value can be simplified.

This can be easily implemented in : https://github.com/JonathanSalwan/Triton/blob/master/src/libtriton/ast/astContext.cpp#L594

I will implement it and do the PR. (creating the issue for the record)

@JonathanSalwan
Copy link
Owner

Maybe add a new mode CONSTANT_FOLDING for that purpose.

@RobinDavid
Copy link
Contributor Author

Yes that would make sense. Need to see if it does not overlap with AST_OPTIMIZATIONS.

@RobinDavid
Copy link
Contributor Author

Nice commit. However I have a suggestion. Your optimization does not perform anything if there is at least on symbolic variable in the expression which prevents folding any foldable sub-expressions.

Thus something like bvadd(bvadd(4, 5), x) will never get simplified. By construction it seems unlikely that such expressions will get created, but by means of constant propagation that will likely happen.

After, is it worth implementing it, I don't know.

@JonathanSalwan
Copy link
Owner

I give you one beer if you are able to make this happen with the CONSTANT_FOLDING mode enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants