Skip to main content

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

  • 5195 Accesses

Abstract

The intermediate language we have used in Chap. 6 is quite low-level and similar to the type of machine code you can find on modern RISC processors, with a few exceptions: We have used an unbounded number of variables, where a processor will have a bounded number of registers, we have used high-level instructions for function definitions, calls and return, we have assumed that any constant can be an operand to an arithmetic instruction. Typically, RISC processors allow only small constants as operands, and in the intermediate language, the IF-THEN-ELSE instruction has two target labels, where, on most processors, the conditional jump instruction has only one target label, and simply falls through to the next instruction when the condition is false. The problem of mapping a large set of variables to a small number of registers is handled by register allocation, as explained in Chap. 8. Functions are treated in Chap. 9. We will look at the remaining two problems in this chapter.

“The machine does not isolate man from the great problems of nature but plunges him more deeply into them.”

Antoine de Saint-Exupéry (1900–1944)

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

Notes

  1. 1.

    This is, strictly speaking, not entirely true, as superfluous labels might inhibit later optimisations.

References

  1. Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers; Principles, Techniques and Tools. Addison-Wesley, Reading (2007)

    Google Scholar 

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

    Google Scholar 

  3. Larus, J.: Assembler, linkers and the spim simulator (1998). http://pages.cs.wisc.edu/~larus/HP_AppA.pdf

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

    Google Scholar 

  5. Patterson, D.A., Hennessy, J.L.: Computer Organization & Design, the Hardware/Software Interface. Morgan Kaufmann, San Mateo (1998)

    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). Machine-Code Generation. In: Introduction to Compiler Design. Undergraduate Topics in Computer Science. Springer, London. https://doi.org/10.1007/978-0-85729-829-4_7

Download citation

  • DOI: https://doi.org/10.1007/978-0-85729-829-4_7

  • 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