Re:Combining GNAT with LLVM
by 7thaccount on Tuesday October 01, 2019 @09:36AM
(#21125150)
In theory would the performance be better or machine code smaller?
[ Parent
| on HN ]
It would be interesting to see comparisons, since afaik it's the only compiler front end that has llvm and gcc back end.
No.
I 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.
The 'old' backend is modern gcc, which is on par with or beats llvm.
I 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.