Cranelift, an open source project developed by Mozilla in conjunction with Fastly Labs aims to help in the translation of the functions of WebAssembly portable code format to native machine-code functions, for more efficient execution on the web.
It is being built with the support of Crane Station, the Crane Compiler Organization; the Cranelift will also be useful for the running of WebAssembly code outside of the web, as it makes WebAssembly fully readable as input with native machine code as output. And the functions can be converted into static single assignment (SSA) form, with optimizations performed before the conversion to machine code, and packaged into native object files (.o files) or executed directly as a just-in-time (JIT).
Though still in developmental stage, and the APIs unstable, it has enough functionality to run certain programs such as WebAssembly MVP (minimum viable product) functions execution, with WebAssembly embedded externally as part of the complete implementation.
While the currently finished Cranelift-based product is available in Fastly’s Terrarium, a browser-based editor and deployment platform that uses Cranelift in its compiler and server launched in November 2018.
Mozilla is also working to integrate Cranelift into Firefox browser, which will be useful to generate native code to the Rust compiler, albeit Cranelift is seen as a library for bigger products rather than a product on its own. It is also working on an embeddable, nonbrowser VM for WebAssembly, which uses Cranelift for compilation and runs WebAssembly outside the web, called Wasmtime.
Wasmtime can be used as command-line utility or as library embedded in bigger application; and quite similar to LLVM compiler project, with both having textual and in-memory factors of their intermediate representation and cross-compile without rebuilding the code generator by default.
The Cranelift intermediate representation (IR), however is less friendly for mid-level optimizations, but it doesn't currently perform any by itself, and Cranelift has a larger set of instructions and no intrinsics.