Machine-Code Generation

  • Torben Ægidius Mogensen
Part of the Undergraduate Topics in Computer Science book series (UTICS)


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.


Instruction Sequence Destination Register Target Label Register Allocation Machine Code 
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.


  1. 1.
    Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers; Principles, Techniques and Tools. Addison-Wesley, Reading (2007) Google Scholar
  2. 2.
    Appel, A.W.: Modern Compiler Implementation in ML. Cambridge University Press, Cambridge (1998) Google Scholar
  3. 3.
    Larus, J.: Assembler, linkers and the spim simulator (1998).
  4. 4.
    Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Mateo (1997) Google Scholar
  5. 5.
    Patterson, D.A., Hennessy, J.L.: Computer Organization & Design, the Hardware/Software Interface. Morgan Kaufmann, San Mateo (1998) Google Scholar

Copyright information

© Springer-Verlag London Limited 2011

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of CopenhagenCopenhagenDenmark

Personalised recommendations