This document contains a list of all the major tasks that need to be done before we consider assignment 5 complete. These tasks have been broken down into a few categories based on their importance.
- Anf Optimizations
- Constant folding and propagation
- Constant folding is literally just in cases like a binop if the left and right are constants we can just compute the result
- Constant propagation is just checking the immediate linked by a bind is a constant and if so replace the immediate
- NOTE: These need to be implemented together because constant folding creates new constants that can then be propagated
- Unused variable and function detection
- Check if a variable is ever consumed, if not remove it
- Check if a function is ever called, if not remove it
- NOTE: These passes iterate blocks and modules in reverse
- Constant folding and propagation