Abstract
When generating intermediate code in Chap. 6, we have freely used as many variables as we found convenient. In Chap. 7, we have simply translated variables in the intermediate language one-to-one into registers in the machine language. Processors, however, do not have an unlimited number of registers, so we need register allocation to handle this conflict. The purpose of register allocation is to map a large number of variables into a small(ish) number of registers. This can often be done by letting several variables share a single register, but sometimes there are simply not enough registers in the processor. In this case, some of the variables must be temporarily stored in memory. This is called spilling.
“Just in terms of allocation of time resources, religion is not very efficient. There’s a lot more I could be doing on a Sunday morning.”
Bill Gates (1955–)
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Appel, A.W.: Modern Compiler Implementation in ML. Cambridge University Press, Cambridge (1998)
Briggs, P.: Register allocation via graph coloring. Ph.D. thesis, Rice University, Center for Research on Parallel Computation (1992). Tech. rept. cpc-tr94517-s
Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Mateo (1997)
Thorup, M.: All structured programs have small tree-width and good register allocation. Inf. Comput. 142(2), 159–181 (1998)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2011 Springer-Verlag London Limited
About this chapter
Cite this chapter
Mogensen, T.Æ. (2011). Register Allocation. In: Introduction to Compiler Design. Undergraduate Topics in Computer Science. Springer, London. https://doi.org/10.1007/978-0-85729-829-4_8
Download citation
DOI: https://doi.org/10.1007/978-0-85729-829-4_8
Publisher Name: Springer, London
Print ISBN: 978-0-85729-828-7
Online ISBN: 978-0-85729-829-4
eBook Packages: Computer ScienceComputer Science (R0)