Skip to content

add evaluateFunctionExit for backward analyzer in monotone-analyzer #7547

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HerrCai0907
Copy link
Contributor

For backward analyzer, it is helpful to have a function to init state in the "entry point" (exit block).

@kripken kripken requested a review from tlively April 24, 2025 23:03
@tlively
Copy link
Member

tlively commented Apr 24, 2025

Makes sense, but would it be possible to add some usage somewhere to avoid this getting deleted as dead code in the future?

@HerrCai0907
Copy link
Contributor Author

I am writing our own pass to analyze the opcode between local.get and corresponding really uses (ignore block / if / loop...). It needs to handle uses as return value from operand stack which needs this functional.
In current binaryen, I can only find LivenessTransferFunction is backward analysis but it does not need this function.

@tlively
Copy link
Member

tlively commented Apr 25, 2025

Would you be interested in upstreaming the pass you're writing? If not, and you're maintaining downstream patches, what's the benefit of having this function upstream?

@HerrCai0907
Copy link
Contributor Author

Would you be interested in upstreaming the pass you're writing?

I am not sure the attitude of the bianryen community to frontend language specific pass. I guess it only welcomes the common part.

what's the benefit of having this function upstream?

To make the lattice based analysis framework more complete. If it is not needed, feel free to close this PR.

@tlively
Copy link
Member

tlively commented Apr 29, 2025

There is some precedent for having frontend-specific passes in Binaryen. We have J2CLOpts.cpp, which is specific to the j2wasm compiler, for example. We could consider adding more frontend-specific passes on a case-by-case basis. This would have the benefit to you of making sure your pass isn't broken if we refactor the static analysis framework and would also make sure that we have test coverage for the new method in this PR.

Alternatively we can just land this PR as-is, but be aware that future refactors might break your downstream pass unexpectedly. This isn't meant to be a stable, external-facing API.

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

Successfully merging this pull request may close these issues.

2 participants