---
title: 'Compiler Basis'
tags: CS
---
## Table of Contents
[TOC]
## LLVM
> Reference: [Design decisions that shaped LLVM](http://www.aosabook.org/en/llvm.html)
### Q1:Why llvm?
LLVM provides separate front end, optimizer and back end modules. The modularization helps us easily take each output of each phase, like IR after front end works.
### Q2:Why GCC cannot do the same thing mentioned in Q1?
GCC suffers from layering problems and leaky abstractions:
the back end walks front-end ASTs to generate debug info, the front ends generate back-end data structures, and the entire compiler depends on global data structures set up by the command line interface.