Binaryen

Jul 20, 2023

Compiler infrastructure and toolchain library for WebAssembly

The aim of Binaryen, a compiler and toolchain infrastructure library for WebAssembly, is to make compiling to WebAssembly easy, fast, and effective.

  • Easy Binaryen has a simple C API in a single header, and can also be used from JavaScript. It accepts input in WebAssembly-like form but also accepts a general control flow graph for compilers that prefer that.
  • Fast Binaryen’s internal IR uses compact data structures and is designed for completely parallel codegen and optimization, using all available CPU cores. Binaryen’s IR also compiles down to WebAssembly extremely easily and quickly because it is essentially a subset of WebAssembly.
  • Effective Binaryen’s optimizer has many passes that can improve code very significantly e.g. local coloring to coalesce local variables; dead code elimination; precomputing expressions when possible at compile time; etc.. These optimizations aim to make Binaryen powerful enough to be used as a compiler backend by itself. One specific area of focus is on WebAssembly-specific optimizations that general-purpose compilers might not do, which you can think of as wasm minification, similar to minification for JavaScript, CSS, etc., all of which are language-specific an example of such an optimization is block return value generation in SimplifyLocals.


Checkout these related ports:
  • Zziplib - Library to provide transparent read access to zipped files
  • Zydis - Fast and lightweight x86/x86-64 disassembler library
  • Zycore-c - Support library with platform independent types, macros, etc for Zydis
  • Zthread - Platform-independent object-oriented C++ threading library
  • Zookeeper - Coordination Service for Distributed Applications
  • Zls - Zig LSP implementation + Zig Language Server
  • Zfp - High throughput library for compressed floating-point arrays
  • Zeal - Offline documentation browser
  • Zapcc - C++ caching compiler based on clang
  • Zanata-platform - Web-based translation platform
  • Zanata-cli - Zanata Java command line client
  • Z88dk - Complete Z80/Z180 development kit
  • Z80ex - ZiLOG Z80 CPU emulator library
  • Z80asm - Assembler for the Z80 microprocessor
  • Z80-asm - Z80 assembly code assembler and disassembler