Description
It would be great to have a consistent and accurate cost table of all wasm instructions in terms of code generation on the VM side. This would make it very easy for tools and compilers. For example, there are a couple of places in Binaryen where it is very difficult to determine the weight of a particular operation without a good knowledge of the particular VM:
WebAssembly/binaryen#4245 (comment)
https://github.com/WebAssembly/binaryen/blob/main/src/ir/cost.h#L589
https://github.com/WebAssembly/binaryen/blob/main/src/ir/cost.h#L593
It is clear that the costs may be slightly different on different VMs, but it would be possible to have some average value, which would also be averaged for x86, x64 and ARM32, AArch64. Besides, we could even give detailed recommendations for instructions where one of the arguments is a constant (for example, divider of i32.div_u or i64.rem_s in such cases computational cost would be much lower than for general case).
In addition, after some optimization of the codegen of some introduction in one of the VMs record for such a table could be promptly updated.