Design Issues of RISC                                                                                                                                   Print this page
<< Previous |  First |  Last |  Next >>       

Compiler based Register Optimization

A small number of registers (e.g. 16-32) is available on the target RISC machine and the concept of registers window can not be used. In this case, optimized register usage is the responsibility of the compiler.

A program written is a high level language has no explicit references to registers. The objective of the compiler is to keep the operands for as many computations as possible in registers rather than main memory, and to minimize load and store operations.

To optimize the use of registers, the approach taken is as follows:

  • Each program quantity that is a candidate for residing in a register is assigned to a symbolic or virtual register.
  • The compiler then maps the unlimited number of symbolic registers into a fixed number of real registers.
  • Symbolic registers whose usage does not overlap can share the same real register.
  • If in a particular portion of the program, there are more quantities to deal with than real registers, then some of the quantities are assigned to the memory location.

The task of optimization is to decide which quantities are to be assigned to registers at any given point of time in the program. The technique most commonly used in RISC compiler is known as graph coloring.

<< Previous |  First |  Last |  Next >>