Skip to main content

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 5114 Accesses

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–)

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 29.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Appel, A.W.: Modern Compiler Implementation in ML. Cambridge University Press, Cambridge (1998)

    Google Scholar 

  2. Briggs, P.: Register allocation via graph coloring. Ph.D. thesis, Rice University, Center for Research on Parallel Computation (1992). Tech. rept. cpc-tr94517-s

    Google Scholar 

  3. Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Mateo (1997)

    Google Scholar 

  4. Thorup, M.: All structured programs have small tree-width and good register allocation. Inf. Comput. 142(2), 159–181 (1998)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Torben Ægidius Mogensen .

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics