3 ms·
You're missing my point. LLVM's design is fundamentally superior in this context - LLVM can "fork" itself inside an LLVM compiler whereas the way GCC is design
by mhh__ 5y ago
You're missing my point.
LLVM's design is fundamentally superior in this context - LLVM can "fork" itself inside an LLVM compiler whereas the way GCC is designed basically means all the hooks don't really like having multiple backends connected to the same frontend. It's probably possible, but it's something where GCC's baggage does actually hold it back even if the basic algorithms are exactly the same (and better implemented sometimes, GCC is still king across the whole benchmark suite even if LLVM is increasingly good on a few).
GCC forks, I am aware are nothing new, but the future of programming is not multiple monolithic compilers but rather (say) C++ (or D, e.g. DCompute would be a real hack if implemented on GCC) with shader and WASM bytecode output as part of one compiler.
GCC can and does do the stuff above but it's just a bit hacky and "please scroll through our mailing list" whereas LLVM is much more welcoming and is a proper library to be consumed.
- pjmlp 5y agoThe only thing LLVM has over GCC is the license for companies that don't like sharing. I can enjoy most of C++20 on GCC, whereas good luck waiting for clang to reach parity. GCC has more frontends and backends available in total than LLVM has yet to achieve, despite being "better". One of the reasons for Rust-GCC existence is exactly the lack of support for the backends that Linux kernel doesn't want to compromise only to allow Rust into the kernel.
- mhh__ 5y agoLLVM is a better codebase than GCC despite all that. There is a real technical reason to not go with GCC as I have elaborated on above, the GCC codebase really does have its warts even if it's remarkably clear considering how old it is in places. Just read the code. It's obvious that LLVM has been structured around being consumed as a library, whereas GCC was famously not designed to do that - e.g. LOTS of preprocessor magic versus templates, it's a bit 1980s even if they have done a superb job cleaning it up. I am a GCC fanboy too, but just be realistic. Also GCC really needs a kick up the arse when it comes to onboarding new contributors and CI etc. They don't need to go full webscale but I think there's a real risk that GCC ends up being maintained by an increasingly small group of people who eventually just die/retire-off. The way GCC is tested is quite dumb too, things are pulled but then weeks later someone finds out it failed on such and such a a target because they happened to run the testsuite. It's not terrible but I can't imagine it encourages new contributors.
- pjmlp 5y agoI used to be quite comfortable with GCC source code back in the egcs wars. GCC is doing quite alright, looking at upstream contributions for C++, Fortran and Ada compliance. LLVM on the other hand, I guess those lechers are quite happy not having to upstream anything.