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)
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This is, strictly speaking, not entirely true, as superfluous labels might inhibit later optimisations.
References
Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers; Principles, Techniques and Tools. Addison-Wesley, Reading (2007)
Appel, A.W.: Modern Compiler Implementation in ML. Cambridge University Press, Cambridge (1998)
Larus, J.: Assembler, linkers and the spim simulator (1998). http://pages.cs.wisc.edu/~larus/HP_AppA.pdf
Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Mateo (1997)
Patterson, D.A., Hennessy, J.L.: Computer Organization & Design, the Hardware/Software Interface. Morgan Kaufmann, San Mateo (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). 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)