4 ms·
Well, LLVM being written in C++ is fine for memory safety, but let's not kid ourselves. If LLVM were written in Rust it would have function level parallel compi
by sanxiyn 4y ago
Well, LLVM being written in C++ is fine for memory safety, but let's not kid ourselves. If LLVM were written in Rust it would have function level parallel compilation already. LLVM compilation is not parallelized yet because it is written in C++.
- mh7 4y ago>If LLVM were written in Rust it would have function level parallel compilation already No one is stopping anyone from writing a compiler backend/optimizer in rust, yet it hasn't happened.
- sanxiyn 4y agoCranelift exists and is in production. Hint: Cranelift does function level parallel compilation.
- azakai 4y agoI don't know enough about why LLVM doesn't use parallel compilation, you might be right there. But there are many C++ compiler codebases that do have it, such as: every major JS/Wasm VM (V8, SpiderMonkey, JSC), Binaryen, etc. Those do run in environments where parallel compilation matters a lot, unlike LLVM (which assumes parallelism in the build system, as you compile to object files).
- sanxiyn 4y agoRust wants parallel LLVM, because Rust has larger compilation unit.
- azakai 4y agoInteresting. That might be very specific to Rust, though. In that case, LLVM might not be the optimal backend for rustc. But this isn't an issue for most LLVM languages, which either assume parallelism in the build system, or they get enough benefit from ThinLTO (which is the parallelism LLVM does support at the link stage).