Optimizations vs Dataflow Analysis
Optimizations
- Transform the program
- Informed by analyses
- Not much math Dataflow Analyses
- Do not change the program
- Provides information
- Lots of math Dataflow analyses inform our optimizations
In math, optimization is defined mathematically and compilers are an empirical engineering discipline.
ECE 351 optimization
Almost any question small enough to put on an exam can be done in your head, without any equations through intuition. This is good because we know what answer our equations should be producing. These optimizations are performed at compile time.
Stages of Progression for Dataflow Analysis
- By intuition
- Just how I would try to make my code DRY when refactoring. Doing this also intuitively puts things into Three Address Code
- With equations (without loops or branches)
- We solve these equations using substitution
- With equations (with loops and/or branches)
- Substitution no longer works, we need to solve these using fixed-point iteration
Optimization Step-By-Step:
- Convert the AST to Three Address Code
- Dataflow Analysis (different types)
- Actually transform the AST
Related