Open kripken opened 4 years ago
There are two levels of items for which we could generate code: instruction classes and individual instructions. Your example data would generate an instruction class, but since there are many more individual instructions than instruction classes, I think it would make sense to start by generating code for individual instructions.
These are the steps for adding a new instruction class:
Once the new instruction class is added to wasm-traversal.h, the compiler will point out other important places where it needs to be handled.
The steps for adding new instructions to existing classes are:
I think a gradual approach would be great. Also, I think it has worked well for the parser generator script to just have the data encoded in a literal python data structure rather than being parsed in from some other format.
Good point, yeah, starting there might give bigger wins early.
I think we can simplify the checklist of things to do for new instructions,
https://github.com/WebAssembly/binaryen/blob/master/Contributing.md#adding-support-for-new-instructions
We already generate the wast parser using a python script. We can do something similar for core C++ code, generating code for each of the items in that list, starting from a high level declarative format something like
Practically speaking, we can create the declaration file, then implement the items in that checklist one by one in separate PRs (no need for a single huge change).
Thoughts?