4 ms·
It's not really more/less features so much as it is a tradeoff. LLVM is extremely powerful in that it lets you write front-ends for many different languages wit
by chongli 13y ago
It's not really more/less features so much as it is a tradeoff. LLVM is extremely powerful in that it lets you write front-ends for many different languages without worrying about the complexities of native code gen. Likewise, it lets you write backends for other target platforms (i.e. JavaScript), allowing you to gain the ability to port those languages to new platforms easily. Thirdly, you can write optimizers for LLVM's intermediate representation and gain the benefit across most/all front-end languages and back-end platforms.
GCC, on the other hand, seems to have a much narrower focus but with a lot more optimizations and weird extensions.
- statusgraph 13y agoThis is exactly GCC's architecture as well, where front-ends are transpiled into a generic language, which is then compiled into native code for a given platform.
- cperciva 13y agoThat's how GCC works internally, but neither the front-ends nor the back-ends are available to use individually. Indeed, RMS specifically avoided having a flexible architecture similar to llvm, because he was afraid such flexibility would be used for non-GPL "plugins".
- foobarbazqux 13y agoIf you can dump or generate the IR you can use the front or back ends as you please, no? You might have to write something that reads in the IR.
- justincormack 13y agoThats a lot of work for what you get out of the box with clang. There is a whole community of tooling around llvm for these types of use case, so why use gcc?
- foobarbazqux 13y agoSure, I was just arguing possibility, not feasibility.
- __alexs 13y agoGCC supports external dynamically loaded plugins since 4.5.0 (3 years ago) http://gcc.gnu.org/onlinedocs/gccint/Plugins.html http://gcc.gnu.org/onlinedocs/gccint/Plugins.html The wiki has links to some plugins too http://gcc.gnu.org/wiki/plugins http://gcc.gnu.org/wiki/plugins
- chongli 13y agoSure, but what about the inverse? With LLVM you can use frontends as libraries for integrating into an (possibly non-free) IDE for completion, syntax highlighting, refactoring etc. This is especially powerful because you can avoid serialization and just keep the ASTs in memory. I'm not aware of this being possible with GCC, but I could be wrong.