>#CE5A6A>10.0 Introduction

This chapter uses the material of the last two chapters to describe program improvements. We divide optimizations into three categories: (i) local optimizations, (ii) global optimizations and (iii) loop optimizations. Chapter 11 discusses another way to improve programs by allocating registers creatively. The last program improvement, peephole optimization, which is performed after code is selected, is also discussed in Chapter 11.

We also include two examples, one which optimizes on the control flow graph and one which optimizes at a higher level on the abstract syntax tree.

We show much of the intermediate representation in this chapter as quadruples; they are much easier to read than abstract syntax trees. This method suffers from the Heisenberg Uncertainty Principle (which the reader may remember from chemistry or physics); it affects the very code we are trying to improve. Quadruples introduce many temporary variables which we will eliminate when possible. Otherwise, the same information can be discovered in trees as in three-address code. Throughout this chapter, we use the term optimization, knowing that we really mean improvement.

Send questions and comments to: Karen Lemone