New WebAssembly Backend
Clone this wiki locally
The new WebAssembly backend in LLVM is not yet stable, but you can test it. Build with something like
EMCC_WASM_BACKEND=1 emcc -s WASM=1 input.cpp [..]
EMCC_WASM_BACKEND env var tells emscripten to use the wasm backend.
Note that when using the WebAssembly backend in this manner, you do not actually need Emscripten's asm.js backend, which means you don't need Emscripten's "fastcomp" fork of LLVM. Instead you must use "vanilla" LLVM (that is, pure upstream LLVM, with no Emscripten additions).
- When doing so, you do not need the
EMCC_WASM_BACKEND=1env var, as
emccwill detect the lack of the asm.js backend and infer it must use the wasm backend. (However, you can still set it, and it's a little faster, since it avoids the check).
- If you build LLVM by yourself, note that WebAssembly is not built by default. You should pass