Abstract
Chaitin proved that register allocation is equivalent to graph coloring and hence NP-complete. Recently, Bouchez, Brisk, and Hack have proved independently that the interference graph of a program in static single assignment (SSA) form is chordal and therefore colorable in linear time. Can we use the result of Bouchez et al. to do register allocation in polynomial time by first transforming the program to SSA form, then performing register allocation, and finally doing the classical SSA elimination that replaces φ-functions with copy instructions? In this paper we show that the answer is no, unless P = NP: register allocation after classical SSA elimination is NP-complete. Chaitin’s proof technique does not work for programs after classical SSA elimination; instead we use a reduction from the graph coloring problem for circular arc graphs.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Appel, A.W., Palsberg, J.: Modern Compiler Implementation in Java, 2nd edn. Cambridge University Press, Cambridge (2002)
Biró, M., Hujter, M.: Precoloring extension. I: interval graphs. In: Discrete Mathematics, pp. 267–279. ACM Press, New York (1992); Special volume (part 1) to mark the centennial of Julius Petersen’s “Die theorie der regularen graphs”
Bodlaender, H., Gustedt, J., Telle, J.A.: Linear-time register allocation for a fixed number of registers. In: SIAM Symposium on Discrete Algorithms, pp. 574–583 (1998)
Bouchez, F.: Allocation de registres et vidage en mémoire. Master’s thesis, ENS Lyon (2005)
Briggs, P., Cooper, K.D., Harvey, T.J., Simpson, L.T.: Practical improvements to the construction and destruction of static single assignment form. Software Practice and Experience 28(8), 859–881 (1998)
Brisk, P., Dabiri, F., Macbeth, J., Sarrafzadeh, M.: Polynomial-time graph coloring register allocation. In: 14th International Workshop on Logic and Synthesis, ACM Press, New York (2005)
Budimlic, Z., Cooper, K.D., Harvey, T.J., Kennedy, K., Oberg, T.S., Reeves, S.W.: Fast copy coalescing and live-range identification. In: International Conference on Programming Languages Design and Implementation, pp. 25–32. ACM Press, New York (2002)
Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M.E., Markstein, P.W.: Register allocation via coloring. Computer Languages 6, 47–57 (1981)
Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1991)
de Ferriére, F., Guillon, C., Rastello, F.: Optimizing the translation out-of-SSA with renaming constraints. ST Journal of Research Processor Architecture and Compilation for Embedded Systems 1(2), 81–96 (2004)
Farach, M., Liberatore, V.: On local register allocation. In: 9th ACM-SIAM symposium on Discrete Algorithms, pp. 564–573. ACM Press, New York (1998)
Garey, M.R., Johnson, D.S., Miller, G.L., Papadimitriou, C.H.: The complexity of coloring circular arcs and chords. SIAM J. Algebraic Discrete Methods 1(2), 216–227 (1980)
Garey, M.R., Johnson, D.S., Stockmeyer, L.: Some simplified NP-complete problems. Theoretical Computer Science 1(3), 193–267 (1976)
Gavril, F.: Algorithms for minimum coloring, maximum clique, minimum covering by cliques, and maximum independent set of a chordal graph. SICOMP 1(2), 180–187 (1972)
Gavril, F.: The intersection graphs of subtrees of a tree are exactly the chordal graphs. Journal of Combinatoric B(16), 46–56 (1974)
Hack, S.: Interference graphs of programs in SSA-form. Technical Report ISSN 1432-7864, Universitat Karlsruhe (2005)
Hack, S., Grund, D., Goos, G.: Register allocation for programs in SSA-form. In: 15th International Conference on Compiler Construction, Springer, Heidelberg (2006)
Leung, A., George, L.: Static single assignment form for machine code. In: Conference on Programming Language Design and Implementation, pp. 204–214. ACM Press, New York (1999)
Marx, D.: A short proof of the NP-completeness of circular arc coloring (2003)
Pereira, F.M.Q., Palsberg, J.: Register allocation via coloring of chordal graphs. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 315–329. Springer, Heidelberg (2005)
Rosen, B.K., Zadeck, F.K., Wegman, M.N.: Global value numbers and redundant computations. In: ACM SIGPLAN-SIGACT symposium on Principles of Programming languages, pp. 12–27. ACM Press, New York (1988)
Sethi, R.: Complete register allocation problems. In: 5th annual ACM symposium on Theory of computing, pp. 182–195. ACM Press, New York (1973)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pereira, F.M.Q., Palsberg, J. (2006). Register Allocation After Classical SSA Elimination is NP-Complete. In: Aceto, L., Ingólfsdóttir, A. (eds) Foundations of Software Science and Computation Structures. FoSSaCS 2006. Lecture Notes in Computer Science, vol 3921. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11690634_6
Download citation
DOI: https://doi.org/10.1007/11690634_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-33045-5
Online ISBN: 978-3-540-33046-2
eBook Packages: Computer ScienceComputer Science (R0)