6 ms·
To the "but why" comments, there are some legitimate questions about backends for LLVM - what targets does gcc support that it is easier to write a frontend for
by duped 2y ago
To the "but why" comments, there are some legitimate questions about backends for LLVM - what targets does gcc support that it is easier to write a frontend for a complex language like Rust than add a backend for the desired targets?
I can think of some plausible reasons, like:
- The backends were contributed by people that have no interest in writing another backend in a different compiler framework or are retired/dead/not paid to do it anymore and no one knows the intracies anymore
- Implementing a backend for LLVM is actually harder than writing a new frontend for GCC due to the instability of LLVM IR
But I'm interested what others think. It seems like the industry could burn the candle from both ends, as it were.
- kelsey98765431 2y agoMy money is on that last one. Don't GCC frontends usually come before a new LLVM backend?
- ronsor 2y agoIn my personal experience, writing a compiler backend is hard regardless of whether you pick GCC or LLVM.
- SkiFire13 2y agoYou're assuming a new backend would have to be written for LLVM, but you can also write a codegen backend for rustc which uses GCC, this way you get almost the same benefits but without rewriting the whole frontend