Remix.run Logo
wg0 2 hours ago

Noob question - Does gcc use LLVM anywhere under the hood or it has its own code generation and optimization pipeline? How does it stack in comparison to LLVM?

ksherlock 6 minutes ago | parent | next [-]

The other answers (NO!) are correct, but... there was a gcc plug-in to use the llvm backend with gcc. Apple used llvm-gcc (circa 2012; gcc front end, llvm back end) while transitioning from gcc to llvm.

https://dragonegg.llvm.org

sintax 23 minutes ago | parent | prev | next [-]

Let me wikipedia that for you :-) Like people mentioned already, gcc predates LLVM by quite some years, ie. Wikipedia mentions March 22, 1987 for gcc, while LLVM's initial release was 2003.

A big difference between the 2 is also the license. GCC uses the GPL while LLVM uses Apache License, hence the projects don't share code.

kouosi 2 hours ago | parent | prev | next [-]

> Does gcc use LLVM anywhere under the hood or it has its own code generation and optimization pipeline? No it doesn't use LLVM > How does it stack in comparison to LLVM? Well it support more targets then LLVM and in most cases it generates similar if not better executable.

kelnos an hour ago | parent | prev | next [-]

GCC far far far predates LLVM. They do not share code.

fweimer 10 minutes ago | parent [-]

The libsanitizer library is imported from the LLVM sources into the GCC source tree. There are probably more examples of code sharing. Both projects are quite large.

steve1977 4 minutes ago | parent [-]

I would assume the code sharing is one-way only due to the licenses. I.e. a GPL project can use MIT licensed code, but not vice versa (AFAIK).

mshockwave 2 hours ago | parent | prev [-]

> Does gcc use LLVM anywhere under the hood

No