LLVM
- is a collection of modular and reusable compiler and toolchain technologies
- has little to do with traditional virtual machines
LLVM - Compilation Stages
In the LLVM the compilation takes three stages
-compiler---interpreter---assembler---linker---loader/compiler/compilers/low-level-virtual-machine-(llvm)/llvm_compiler_pipeline.png)
The stages are:
- The frontend, parsing the original language and spits out IR code
- The optimizer, mangling one IR into optimized equivalent IR. This stage does all the usual optimizations like constant propagation, dead code removal, and so on
- The backend, taking IR and producing machine code optimized for a specific CPU
LLVM - Intermediate Representation (IR)
see LLVM Intermediate Representation (IR)
LLVM - Frontend Compilers
LLVM - Middle-end Compiler
TODO
LLVM - Backend Compiler
The backend supports compiling IR into many different Instruction Set Architectures