Title
Register allocation: what does the NP-completeness proof of Chaitin et al. really prove? or revisiting register allocation: why and how
Abstract
Register allocation is one of the most studied problems in compilation. It is considered NP-complete since Chaitin et al., in 1981, modeled the problem of assigning temporary variables to k machine registers as the problem of coloring, with k colors, the interference graph associated to the variables. The fact that this graph can be arbitrary proves the NP-completeness of this formulation. However, this original proof does not really show where the complexity of register allocation comes from. Recently, the re-discovery that interference graphs of SSA programs can be colored in polynomial time raised the question: Can we use SSA to do register allocation in polynomial time, without contradicting Chaitin et al's NP-completeness result? To address this question and, more generally, the complexity of register allocation, we revisit Chaitin et al's proof to identify the interactions between spilling (load/store insertion), coalescing/splitting (removal/ insertion of register moves), critical edges (property of the control flow), and coloring (assignment to registers). In particular, we show that, in general, it is easy to decide if temporary variables can be assigned to k registers or if some spilling is necessary. In other words, the real complexity does not come from the coloring itself (as a misinterpretation Chaitin et al's proof may suggest) but comes from critical edges and from the optimizations of spilling and coalescing.
Year
DOI
Venue
2006
10.1007/978-3-540-72521-3_21
LCPC
Keywords
Field
DocType
k color,k register,k machine register,critical edge,register allocation,interference graph,temporary variable,polynomial time,original proof,revisiting register allocation,np-completeness proof,register move,col,control flow
Colored,Interval graph,Register allocation,Computer science,Control flow,Parallel computing,Basic block,Theoretical computer science,Interference (wave propagation),Time complexity,Completeness (statistics)
Conference
Volume
ISSN
Citations 
4382
0302-9743
20
PageRank 
References 
Authors
0.71
18
4
Name
Order
Citations
PageRank
Florent Bouchez1904.37
Alain Darte288856.40
Christophe Guillon3846.07
Fabrice Rastello448238.30