GCC vs LLVM: Compiler Infrastructure
Both GCC (GNU Compiler Collection) and LLVM are written in C++. GCC is the older, traditionally Unix-focused compiler. LLVM is a modular, reusable compiler infrastructure used by Clang, Rust, Swift, Kotlin/Native, and many others.
GCC
GCC has been the primary open-source C/C++ compiler since 1987. It supports dozens of languages (C, C++, Fortran, Ada, Go, D) and targets hundreds of architectures. GCC is written in C++ (migrated from C in 2012) and is licensed under GPL.
LLVM
LLVM started as a research project at the University of Illinois in 2000. It provides a modular compiler infrastructure with a well-defined intermediate representation (LLVM IR). Languages that compile to LLVM IR can target any architecture LLVM supports.
Languages That Use LLVM
- Clang (C/C++/Objective-C frontend)
- Rust (rustc uses LLVM as its backend)
- Swift
- Kotlin/Native
- Julia
- Haskell (GHC LLVM backend)
Key Differences
| Aspect | GCC | LLVM |
|---|---|---|
| License | GPL | Apache 2.0 |
| Modularity | Monolithic | Highly modular |
| IR | GIMPLE/RTL | LLVM IR |
| JIT support | Limited | First-class (MCJIT) |