Intro to Compilers: Code Generation - ECE59500
This course covers advanced compiler topics: generating code for functions, performing type checking to avoid bugs, performing basic compiler optimizations, and performing register allocation. We will cover the theoretical basis of many of these optimizations as well as how they are implemented in compilers. Students will extend the basic compiler constructed in ECE 595.1 to add these advanced features to their compiler that translates C code into RISC-V assembly.
Learning Objective:
After completing this course, you will be able to:
- Explain how functions work in programming languages and how to generate code for them
- Explain the purpose of type checking and how to implement it
- Explain basic local optimizations: common sub-expression elimination and dead code elimination
- Explain local and global register allocation
- Build a compiler that supports functions, type checking, and register allocation
Topics Covered:
- Code generation
- Type systems and type checking
- Compiler optimization
Prerequisites:
Comfort with programming, especially data structures and recursion. Experience with object oriented programming will also be beneficial. To enroll in this course, students must have completed the first course in this series, Introduction to Compilers: Compiler Basics
Applied / Theory:
50 / 50
Homework:
2 problem sets
Projects:
Students will extend a C-to-RiscV compiler to support function calls, type checking, and register allocation.
Exams:
1 exam
Textbooks:
There is no required text for this class. However, students may find the book Engineering a Compiler, by Cooper and Torczon (2nd edition, Morgan Kauffman, ISBN: 978-0120884780) helpful.
Computer Requirements:
A computer that can install and run the latest versions of Java and a Git client
Other Requirements:
Students will be asked to install versions of ANTLR (https://www.antlr.org) and will be required to access GitHub through a suitable Git client