Chapter 14: Program Optimization


This book has so far discussed the analysis and synthesis required to translate a programming language into interpretable or executable code. The analysis is concerned with making sure that the source program conforms to the definition of the programming language in which the program is written. After the compiler has verified that the source program conforms, synthesis takes over to translate the program. The target of this translation is typically an interpretable or executable instruction set. Thus, code generation consists of translating a portion of a program into a sequence of instructions that preserves the program's meaning.

As is true for most languages, there are multiple ways to say the same thing. In Chapter 13, instruction selection is presented as a mechanism for choosing an efficient sequence of instructions for the target machine. In this chapter, we examine more aggressive techniques for improving a program's performance. Much of the chapter is dedicated to covering data flow analysis—a technique for determining useful properties of a program at compile-time.