In
compiler optimization,
register allocation is the process of assigning a large number of target program
variables onto a small number of
CPU registers. Register allocation can happen over a
basic block (
local register allocation), over a whole function/procedure (
global register allocation), or across function boundaries traversed via call-graph (
interprocedural register allocation). When done per function/procedure the calling convention may require insertion of save/restore around each call-site.