10 ms·
Combining GNAT with LLVM
- 7thaccount 7y agoIn theory would the performance be better or machine code smaller?
- sanxiyn 7y agoNo.
- 0xDEEPFAC 7y agoI wouldn't be so sure. Given that this is a new backend for GNAT and the first one is close to 25 years old I assume it will have more modern optimizations and experience behind it - presumably leading to something faster.
- earenndil 7y agoThe 'old' backend is modern gcc, which is on par with or beats llvm.
- 0xDEEPFAC 7y agoI would say gcc and llvm are competitive - asserting gcc is faster at its current state is quite a claim. Also, I was referring to AdaCore's implementation of the compiler backend. GNAT's architecture is structured like so: GNAT Frontend (parsing, analysis, expansion) -> GNAT Backend (translation of frontend tree to something GNU or LLVM can understand) -> LLVM or GCC This backend is quite complex and has a large role in how LLVM can optimize. My argument is that GNAT's GCC backend is 25 years old and a new backend written for LLVM probably generates better/cleaner code. Also of note is that the GCC backend is written and C and the LLVM is actually written in Ada meaning its more uniform with the GNAT frontend.
- monocasa 7y agoOn the other hand, the GCC implementation has 25 years performance optimizations across the whole battery of programs they run.
- Glacia 7y agoIt would be interesting to see comparisons, since afaik it's the only compiler front end that has llvm and gcc back end.
- lbenes 7y ago> a natural question would be "why are you starting a GNAT LLVM project from scratch instead of building on top of DragonEgg?". If you want to know the answer, check the file README.dragonegg in the repository! Correct me if I'm wrong, but from the README [1], the answer appears to be: > The dragonegg plugin works with gcc 4.5, 4.6, 4.7 or 4.8 But a little more digging reveals that there are patches so[2] > DragonEgg works for for GCC v8.x Lack of Google-fu or am I missing something? If they believed dragonegg is flawed, why not just lay it out? I prefer that over a goose chase that doesn't fully check out. [1] http://llvm.org/svn/llvm-project/dragonegg/trunk/README http://llvm.org/svn/llvm-project/dragonegg/trunk/README [2] https://lists.llvm.org/pipermail/llvm-dev/2017-August/116705.html https://lists.llvm.org/pipermail/llvm-dev/2017-August/116705...
- mCOLlSVIxp6c 7y agoArguments against DragonEgg are laid out in the gnat-llvm repo here: https://github.com/AdaCore/gnat-llvm/blob/master/README.dragonegg https://github.com/AdaCore/gnat-llvm/blob/master/README.drag...
- jcranmer 7y agoDragonegg was never a particularly well-maintained project. You're building a bridge between GCC's and LLVM's IR, which means you're highly susceptible to changes in one or the other, and the conversion tends to drop annotations (such as debugging info!). Most people only really cared about Dragonegg as a way to get Fortran code compiled to LLVM IR. Now that Flang exists, the Fortran motivation isn't there. Essentially, Dragonegg was only ever a last-resort way to get LLVM IR. If you're trying to build a LLVM backend, you might as well emit LLVM IR directly from your frontend rather than trying to deal with a GIMPLE backend and then a GIMPLE-to-LLVM converter.
- pyler 7y agoAda-C++ LTO?
- pjmlp 7y agoGreen Hills Ada does it. https://www.ghs.com/products/AdaMULTI_IDE.html https://www.ghs.com/products/AdaMULTI_IDE.html
- thesuperbigfrog 7y agoThere are many advantages of porting GNAT to an LLVM-based backend: 1) Clean-up of backend interface code to make it more robust and less GCC-specific 2) Allow for GNAT to target more platforms such as modern Apple devices (where GCC support is waning and LLVM is preferred) and WebAssembly Right now they are stating that it is not production-ready, but I would not be surprised if the LLVM-based GNAT gains peer status with the GCC-based GNAT or even overtakes it.
- andikleen7 7y agoThey already have 5 others, according to the article. There's nothing gcc specific about it.
- 7thaccount 7y agoThe main GNAT compiler that people actually use is based on GCC
- protomyth 7y agoGPLv3 license, so the flexibility of how you can include clang in your own tools won't be available for Ada.
- saagarjha 7y agoNo runtime license exception?
- fiddlerwoaroof 7y agoIt's complicated, I believe the way it works is that the Community Edition you can download from the Adacore website doesn't have the runtime exception but, if it's built from the code in the FSF's repo, it does. This is Adacore's scheme to make sure that people making money off Ada buy a license.
- protomyth 7y agoThat approach worked so well for the Lisp and Smalltalk vendors.
- 7thaccount 7y agoIt might work if the US Department of Defense, NASA, and Boeing are customers (my assumption) and they keep their company small.
- planteen 7y agoI think that is exactly what OP meant, as in, no new projects or further Ada marketshare. I think the same can be said for Lisp and Smalltalk.
- pjmlp 7y agoMany seem to think GNAT is the only game in town, when actually there are 6 commercial compilers still available. Just like Lisp and Smalltalk still have their commercial offerings available. Naturally communities that want to be payed for their work, while refusing to pay for their tools aren't aware of such offerings.
- ajxs 7y agoI'm very interested in seeing where this leads. I've had so many problems creating Ada capable GCC cross-compilers from the FSF source, and it looks like I'm not alone in this area. This might open up new and better possibilities for platform support. Great work!