mirror of
https://github.com/mii443/wasmer.git
synced 2025-09-03 16:09:20 +00:00
48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
# `wasmer-compiler-llvm` [](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [](https://slack.wasmer.io) [](https://github.com/wasmerio/wasmer/blob/master/LICENSE) [](https://crates.io/crates/wasmer-compiler-llvm)
|
|
|
|
This crate contains a compiler implementation based on [the LLVM Compiler Infrastructure][LLVM].
|
|
|
|
## 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][example].*
|
|
|
|
## When to use LLVM
|
|
|
|
We recommend using LLVM as the default compiler when running WebAssembly
|
|
files on any **production** system, as it offers maximum peformance near
|
|
to native speeds.
|
|
|
|
## Requirements
|
|
|
|
The LLVM compiler requires a valid installation of LLVM in your system.
|
|
It currently requires **LLVM 15**.
|
|
|
|
|
|
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 14
|
|
```
|
|
|
|
Or in macOS:
|
|
|
|
```bash
|
|
brew install llvm@14
|
|
```
|
|
|
|
Or via any of the [pre-built binaries that LLVM offers][llvm-pre-built].
|
|
|
|
|
|
[LLVM]: https://llvm.org/
|
|
[example]: https://github.com/wasmerio/wasmer/blob/master/examples/compiler_llvm.rs
|
|
[llvm-pre-built]: https://releases.llvm.org/download.html
|