Register allocation is the process of assigning a large number of target program variables onto a small number of CPU registers. Since not all variables are used at the same time, multiple values can be assigned to the same register (AS LONG AS THEY ARE NOT USED AT THE SAME TIME). Variables that are not stored in a register are kept in RAM. Accessing RAM is slower, so having to fetch the variables from RAM will slow down execution time.
Register Pressure
This occurs when there are fewer hardware registers than optimal. Higher pressure means more spills and reloads are required.
Software Illusion
Unbounded space in a finite machine:
This is an NP complete problem. We have a bunch of local variables that we pack into available registers. The main approach for this is graph colouring which is another well-known NP complete problem. There are polynomial approximations for this that are fine.
The first step here is Variable Liveness analysis.