stdarch-gen-wasm32: Tool that creates spec sheet from wasm32's C and Rust source files. - #1910
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use |
|
i just realized that for this specific intrinsic, it may be difficult to match the C version of the arguments with its Rust version: (Also noticed a bug where the |
stdarch-gen-wasm32: Tool that creates spec sheet from C and Rust source files.stdarch-gen-wasm32: Tool that creates spec sheet from wasm32's C and Rust source files.
f731d86 to
b78dc49
Compare
b78dc49 to
93b452f
Compare
|
☔ The latest upstream changes (possibly #2053) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I'm a bit confused by the goal of this tool. Usually gen-* binaries generate Rust code from a specification and we have no precedent for generating a spec sheet from C code. Why did you choose this shape of specification in particular - is it useful for generating Rust code? I also have concerns about the copyright of the original C code here. |
What does
stdarch-gen-wasm32do?wasm_simd128.hfile (for the definitions in C)tree-sittercrate)How to run
Context
C Abstract Syntax Tree
Take an intrinsic definition for example:
For a C intrinsic, the immediate children would have their grammar names as:
static__inline____DEFAULT_FN_ATTRS. The parser doesn't recognize it as a valid part of the tree and annotates it as ERROR.wasm_u32x4_make(uint32_t __c0, uint32_t __c1, uint32_t __c2, uint32_t __c3)The immediate children of the
function_declaratornode would have their grammar as follows:wasm_u32x4_make(uint32_t __c0, uint32_t __c1, uint32_t __c2, uint32_t __c3)The immediate children of a parameter_list node would have their grammar as follows:
uint32_t __c0uint32_t __c1uint32_t __c2uint32_t __c3Each node with the grammar name parameter_declaration could have its children structured in a few ways:
int x:v128_t, which is actually a type (but the parser is unaware of the same).x.*and identifier (which is__mem).Rust Abstract Syntax Tree
Take a Rust intrinsic definition for example:
For this Rust intrinsic, the immediate children would have their grammar names as:
pubunsafe. May not always be presentfnv128_load64_splatconstgeneric arguments. (This is not always present)(m: *const u64)v128The children of the
const_parametersnode have theirgrammar_namesas the following (assuming 2 generic arguments):constgeneric argumentconstgeneric argumentThe children of the
parametersnode have theirgrammar_namesas the following (assuming 2 arguments):cc: @Amanieu @folkertdev