Currently, we use LLVM's generic model for both the generic and baseline models. LLVM's generic model for WebAssembly somewhat annoyingly represents a moving target that can change with any given LLVM version; it's basically just "what the major implementations support at this point in time". This makes it outright wrong as a generic model by our definition, but also a bad choice for a baseline model since our notion of "baseline" means wide compatibility, and that should clearly include more than just the major WebAssembly implementations. (An example of a problematic feature currently included in generic would be reference_types.)
So, the first order of business here should be to switch our generic model to LLVM's mvp model, which, as the name implies, targets a minimum viable WebAssembly implementation with no post-1.0 features. That can be done today while still mapping baseline to LLVM's generic.
Secondly, there is a WATC proposal to add a lime1 model to LLVM to address the problem of there not being a good baseline model:
The feature set proposed there seems to me to be a very reasonable one for a baseline model. So, if that proposal is accepted, I think we should switch our baseline for WebAssembly to lime1 after we update to LLVM 20.
This may involve a bit of work in wasm2c to add support for a couple of features. Note that neither LLVM nor our self-hosted backend make use of multivalue in the mvp ABI, so we don't actually need to support that in wasm2c. That only leaves relatively simple features like nontrapping_fptoint and extended_const.
Currently, we use LLVM's
generic
model for both the generic and baseline models. LLVM'sgeneric
model for WebAssembly somewhat annoyingly represents a moving target that can change with any given LLVM version; it's basically just "what the major implementations support at this point in time". This makes it outright wrong as a generic model by our definition, but also a bad choice for a baseline model since our notion of "baseline" means wide compatibility, and that should clearly include more than just the major WebAssembly implementations. (An example of a problematic feature currently included ingeneric
would bereference_types
.)So, the first order of business here should be to switch our generic model to LLVM's
mvp
model, which, as the name implies, targets a minimum viable WebAssembly implementation with no post-1.0 features. That can be done today while still mapping baseline to LLVM'sgeneric
.Secondly, there is a WATC proposal to add a
lime1
model to LLVM to address the problem of there not being a good baseline model:The feature set proposed there seems to me to be a very reasonable one for a baseline model. So, if that proposal is accepted, I think we should switch our baseline for WebAssembly to
lime1
after we update to LLVM 20.This may involve a bit of work in
wasm2c
to add support for a couple of features. Note that neither LLVM nor our self-hosted backend make use ofmultivalue
in themvp
ABI, so we don't actually need to support that inwasm2c
. That only leaves relatively simple features likenontrapping_fptoint
andextended_const
.