Optimal Register Allocation in Polynomial Time [chapter]

Philipp Klaus Krause
2013 Lecture Notes in Computer Science  
A graph-coloring register allocator that optimally allocates registers for structured programs in polynomial time is presented. It can handle register aliasing. The assignment of registers is optimal with respect to spill and rematerialization costs, register preferences and coalescing. The register allocator is not restricted to programs in SSA form or chordal interference graphs. It assumes the number of registers is to be fixed and requires the input program to be structured, which is
more » ... ically true for many programming languages and for others, such as C, is equivalent to a bound on the number of goto labels per function. Non-structured programs can be handled at the cost of either a loss of optimality or an increase in runtime. This is the first optimal approach that has polynomial runtime and works for such a huge class of programs. An implementation is already the default register allocator in most backends of a mainstream cross-compiler for embedded systems.
doi:10.1007/978-3-642-37051-9_1 fatcat:56uuf76ys5dqtoepojz7lo4rxa