O'Reilly logo

Compilers: Principles and Practice by Himanshu B. Dave, Parag H. Dave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

 

Peep-hole Optimization

 

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required