fc826a7525
[BENCH COMPILE] ebobby/simple-raytracer Benchmark #1: RUSTFLAGS='' cargo build --target x86_64-apple-darwin Time (mean ± σ): 16.539 s ± 0.781 s [User: 46.043 s, System: 3.822 s] Range (min … max): 15.057 s … 17.566 s 10 runs Benchmark #2: ../cargo.sh build Time (mean ± σ): 14.550 s ± 0.443 s [User: 25.856 s, System: 4.214 s] Range (min … max): 14.208 s … 15.751 s 10 runs Summary '../cargo.sh build' ran 1.14 ± 0.06 times faster than 'RUSTFLAGS='' cargo build --target x86_64-apple-darwin' [BENCH RUN] ebobby/simple-raytracer Benchmark #1: ./raytracer_cg_llvm Time (mean ± σ): 6.436 s ± 0.022 s [User: 6.392 s, System: 0.018 s] Range (min … max): 6.408 s … 6.466 s 10 runs Benchmark #2: ./raytracer_cg_clif Time (mean ± σ): 9.604 s ± 0.088 s [User: 9.547 s, System: 0.023 s] Range (min … max): 9.503 s … 9.742 s 10 runs Summary './raytracer_cg_llvm' ran 1.49 ± 0.01 times faster than './raytracer_cg_clif' |
||
---|---|---|
build_sysroot | ||
crate_patches | ||
example | ||
patches | ||
src | ||
.gitignore | ||
.travis.yml | ||
abc.cpp | ||
Cargo.lock | ||
cargo.sh | ||
Cargo.toml | ||
clean_all.sh | ||
config.sh | ||
copy.clif | ||
flamegraph.sh | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
prepare.sh | ||
Readme.md | ||
rust-toolchain | ||
test.sh |
WIP Cranelift codegen backend for rust
⚠⚠⚠ Threads and certain kinds of FFI don't work yet. ⚠⚠⚠
Building
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
$ cd rustc_codegen_cranelift
$ ./prepare.sh # download and patch sysroot src and install hyperfine for benchmarking
$ ./test.sh
Usage
$cg_clif_dir
is the directory you cloned this repo into in the following instruction.
Cargo
$ $cg_clif_dir/cargo.sh run
Rustc
$ rustc -Cpanic=abort -Zcodegen-backend=$cg_clif_dir/target/debug/librustc_codegen_cranelift.so --sysroot $cg_clif_dir/build_sysroot/sysroot my_crate.rs
Not yet supported
- Good non-rust abi support (several problems)
- Checked binops (some missing instructions in cranelift)
- Inline assembly (no cranelift support, not coming soon)
- SIMD (tracked here, some basic things work)
Troubleshooting
Can't compile
Try updating your nightly compiler. You can try to use an nightly a day or two older if updating rustc doesn't fix it. If you still can't compile it, please fill an issue.