Back to Wasmer

`wasmer-compiler-llvm`

lib/compiler-llvm/README.md

7.1.01.7 KB
Original Source

wasmer-compiler-llvm

This crate contains a compiler implementation based on the LLVM Compiler Infrastructure.

Usage

rust
use wasmer::{Store, EngineBuilder};
use wasmer_compiler_llvm::LLVM;

let compiler = LLVM::new();
let mut store = Store::new(compiler);

Note: you can find a full working example using LLVM compiler here.

When to use LLVM

We recommend using LLVM as the default compiler when running WebAssembly files on any production system, as it offers maximum performance near to native speeds.

Requirements

The LLVM compiler requires a valid installation of LLVM in your system. It currently requires LLVM 21.

You can install LLVM easily on your Debian-like system via this command:

bash
wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
sudo bash /tmp/llvm.sh 21

Or in macOS:

bash
brew install llvm@21

Or via any of the pre-built binaries that LLVM offers.