
Chapter 7
Register Allocation
7.1 Introduction
Register allocation is the process of assigning as many local variables and temporaries to
physical registers as possible. The more values that we can keep in registers instead of in
memory, the faster our programs will run. This makes register allocation the most effective
optimization technique that we have.
With respect to our LIR discussed in Chapter 6, we wish to assign physical registers
to each of the virtual registers that serve as operands to instructions. The problem is that
there are often many fewer physical registers than there are virtual registers. Sometimes,
as program execution progresses, ...