Skip to content

How to traverse the module tree? #4515

Answered by kripken
t4lz asked this question in Q&A
Feb 15, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

The C API by itself doesn't have enough, I think.

Using C++, you'd write a module traversal (see wasm-traversal.h, but it is usually easier to read example code in the various passes, I'd say).

You can write that C++ in a new pass inside binaryen, or you can write a new program that uses libbinaryen and the C++ API, externally to binaryen.

(I don't think we have a way to write an external pass atm: binaryen won't scan for passes in a dynamic way, the list is hardcoded. But external code can do pretty much anything else using the C++ API.)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tlively
Comment options

@t4lz
Comment options

Answer selected by t4lz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants