Last 10 minutes of class on Wednesday, April 29, 2026.
Everyone takes the exam at the same time.
Static Analysis, Intermediate Representations, Code Generation, Code Optimization.
You will take the exam on Brightspace. There is 10 minute time limit, or 15 minutes for those with time-and-a-half accommodations.
Do each of the following to maximize your preparation:
Were you able to check off every box?
The fact that active recall is better for acquiring long-term knowledge does not mean that outlines and concept maps are not useful. Learners should use multiple techniques—think “both and” rather than “either or.”
Static Analysis
TODO
Intermediate Representations
Why have them?
Analysis/Synthesis is inherent to translation
Break down complex problem
Retargetability
For machine independent optimizations
High-level vs. Medium-level vs. Low-level
Styles
Abstract assembly language (instructions called tuples)
Stack code
List of well-known IRs
JVM
CLR
LLVM
SIL
CIL
Tuples
Code Generation
Goals
Translation to JavaScript
Translation to Assembly Language
Naïve
Interpretive
Code generator generators
Generation of real assembly language
Address assignment
Instruction selection
Register allocation
Low-level optimization
Understanding the runtime system for block-structured languages
Stack frames
Dynamic links
Static links
Register save area
Register spilling
Code Optimization
Things we can optimize for:
Speed
Size
Power consumption
Memory usage
Why "code improvement" is a better name than "code optimization"
Degrees of optimization
None
Basic / Peephole
Within Basic Blocks
Intraprocedural
Interprocedural
Whole Program
Criteria
Safety
Profitability
When optimizations can be done
General strategies
Use more efficient instructions
Reuse results rather than recomputing
Reduce the amount of code
Reduce conditional jumps
Use hardware resources efficiently
Common optimization techniques
Constant Folding
Algebraic Simplification
Operation Reordering
Strength Reduction
Assignment Simplification
Unreachable Code Elimination
Dead Code Elimination
Copy Propagation
Common Subexpression Elimination
Conditional Jump Compression
Loop Unrolling
Loop Fusion
Loop Fission
Loop Inversion
Loop Interchange
Loop Invariant Code Motion
Jump Threading
Special Instructions
e.g., muladd, range, ...
Induction Variable Simplification
Tail Recursion Elimination
Function Inlining
This is a mini-quiz which tests for immediate understanding of topics and not your ability to work out problems over an extended duration of time. There is a strict time limit so that your immediate fluency is tested rather than your ability to search the web (or worse, ask a chatbot), since these things take time. There will be 5–10 questions, some will be multiple choice, some multi-select, and some matching. There are no free-form answers, so the exam will be autograded and you will see your score immediately after it is submitted.
All content on the assigned readings is fair game for questions, so do not neglect the readings, and by all means do the recall questions!