10.3 Peep-hole Optimization
This kind of optimization is done by one or more passes over the entire IR, in a linear fashion. Such methods are called peep-hole optimization because it inspects and manipulates a small portion of the IR at a time, see Fig. 10.2. A peep-hole method:
Fig. 10.2 Peep-hole Optimization
- looks for certain patterns and replaces them with simpler, or more efficient ones;
- requires only small amount of additional memory for its functioning;
- is relatively small and fast;
- works best with 3-tuple and 4-tuple IR;
- a number of individual methods are available under the umbrella of peep-hole optimization.
We should note ...