11.1 Preparation for Code Generation

11.2 Generation of Directives

11.3 Simple Code Generation from AST's

11.4 Standard Code Generation Strategies

11.5 Code Generator Generators

11.6 Register Allocation

11.7 A Better Code Generation Algorithm from AST's

11.8 Code Generation from DAG's

11.9 Retargetable Code Generation

11.10 Peephole Optimization

11.11 Summary

Web References

Exercises

Code Generation

11.0 Introduction

The code generation phase translates the intermediate representation into "code". In these modules, the final code is assembly language code which is then assembled, linked and executed. Another options is object code which is output by many production-quality compilers. Still another method is to interpret the intermediate representation to execute the program directly.

The preparation for code generation phase decides how to allocate registers and memory. Thhe code generation phase translates the intermediate representation to assembly language using these registers and memory assignments.