A flow chart shows the stages of the compiler, including a new optimization stage.
1. The lexer turns program.c into a token list.
2. The parser turns the token list into an abstract syntax tree.
3. Semantic analysis turns the AST into a transformed AST. It has three steps:
a. Identifier resolution
b. Type checking
c. Loop Labeling
4. TACKY Generation turns the transformed AST into TACKY.
5. Optimization (a new stage) turns TACKY into optimized TACKY. It has four steps:
a. Constant Folding
b. Unreachable Code Elimination
c. Copy Propagation
d. Dead Store Elimination
An arrow leads from each step to the next. Another arrow leads from dead store elimination back to constant folding.
6. Assembly generation turns optimized TACKY into assembly. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access