4 ms·
I always thought Rust and other PLs generate LLVM IR and leave the optimizations to LLVM while GCC has something more complex to deal with, doesnt it make thing
by up6w6 5y ago
I always thought Rust and other PLs generate LLVM IR and leave the optimizations to LLVM while GCC has something more complex to deal with, doesnt it make things much complicated ?
- steveklabnik 5y agoThis has largely been true for Rust, however, there are some optimizations that the compiler does before generating LLVM IR. * Compiler docs: https://rustc-dev-guide.rust-lang.org/mir/optimizations.html https://rustc-dev-guide.rust-lang.org/mir/optimizations.html * Working Group: https://rust-lang.github.io/compiler-team/working-groups/mir-opt/ https://rust-lang.github.io/compiler-team/working-groups/mir... * Example of one such optimization, "constant propagation" https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop-on-by-default.html https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop...
- gostsamo 5y agoIt is complicated, but GCC has more target platforms.
- mhh__ 5y agoAnd generates faster code depending on which benchmarks matter to you
- astrange 5y agoGCC and LLVM have very similar structures, as do all compilers. LLVM IR is only special because it has a defined serialization. GCC has an IR called GIMPLE that’s fine.