We are currently utilizing precompute to find out whether conditions to branches are constant by
- creating a temporary function
- using the expression of interest as its body
- running the precompute pass on that function
- evaluating the new body
- removing the temporary function again.
This has downsides in regards to overhead and that we have to replace the expression instead of keeping it intact, leading to not-so-untouched output, and doesn't work if the expression has side-effects.
So I've been thinking about adding an API like BinaryenExpressionEvaluate to aid here, but since precompute is a pass with no header that isn't meant to be used this way, it seems to require substantial code changes that I'm unsure about. Any suggestions how to tackle this? :)
We are currently utilizing precompute to find out whether conditions to branches are constant by
This has downsides in regards to overhead and that we have to replace the expression instead of keeping it intact, leading to not-so-untouched output, and doesn't work if the expression has side-effects.
So I've been thinking about adding an API like
BinaryenExpressionEvaluateto aid here, but since precompute is a pass with no header that isn't meant to be used this way, it seems to require substantial code changes that I'm unsure about. Any suggestions how to tackle this? :)