Cranelift
More info
- Creator
- Jakob Stoklund Olesen (Mozilla)
- Owner
- Bytecode Alliance
- Type
- Code generator
- License
- Apache 2.0 with LLVM exception
- Source
- github.com/bytecodealliance/wasmtime
A code generator written in Rust that trades some of LLVM's optimisation depth for fast compilation, mainly for WebAssembly and JITs.
It started at Mozilla in 2016 as Cretonne, written by Jakob Stoklund Olesen, who had previously built LLVM's greedy register allocator. Renamed Cranelift in 2018, it is now maintained by the Bytecode Alliance as the engine inside Wasmtime. Its IR is SSA-based but uses block parameters instead of φ-functions, which makes it simpler both to construct and to read.
Since 2022 instruction selection has been written as pattern rules in a dedicated language, ISLE, and the register allocator, regalloc2, descends from Firefox's JavaScript JIT. Cranelift also ships as an alternative backend for rustc, for anyone who would rather have a debug build now than a fast binary in a while.