- Notifications
You must be signed in to change notification settings - Fork694
Description
According to theMVP, the WebAssembly binary format has a striking similarity to theLLVM-IR.
Quotes for comparison from the sources given above:
WebAssembly Minimum Viable Product:
- Abinary format provides efficiency: it reduces download size and accelerates decoding, thus enabling even very large codebases to have quick startup times. Towards that goal, the binary format will be natively decoded by browsers.
- The binary format has an equivalent and isomorphictext format. Conversion from one format to the other is both straightforward and causes no loss of information in either direction.
LLVM Language Reference:
The LLVM code representation is designed to be used in three different forms: as an in-memory compiler IR, as an on-disk bitcode representation (suitable for fast loading by a Just-In-Time compiler), and as a human readable assembly language representation.
The LLVM bitcode accomplishes the goals of the MVP binary format. The LLVM human readable assembly language accomplishes the goals of the MVP text format.
Another point to mention is that LLVM-IR can already be compiled to native code for dozens of platforms using any (already existing) LLVM backend,including JavaScript, which accomplishes thePolyfill's goals.
That said, what are the pure advantages (if any) of a new binary and text format over an existing spec and implementation? And second, if there are any compelling advantages at all, how are the two related? Are they in direct competition?
I looked around for any prior recommendations for using LLVM-IR directly, and came up empty. So here it is: Use LLVM-IR directly! It's already built, already compiles into native code for dozens of platforms, already has several front ends including C/C++, it'sfree, covers many or all of the desired goals, and has a huge community of developers supporting it.