- Title
- Design automation of a machine-independent code generator
- Creator
- Clayton, Peter Graham
- ThesisAdvisor
- Terry, Patrick D.
- Subject
- Compilers (Computer programs)
- Subject
- Programming languages (Electronic computers)
- Date
- 1984
- Date
- 2013-01-22
- Type
- Thesis
- Type
- Masters
- Type
- MSc
- Identifier
- vital:4676
- Identifier
- http://hdl.handle.net/10962/d1006699
- Identifier
- Compilers (Computer programs)
- Identifier
- Programming languages (Electronic computers)
- Description
- As both computer languages and architectures continue to proliferate, there is a continuing need for new compilers. Researchers have attempted to ease the work of producing compilers by developing methods to automate compiler writing. While much work has been done (and considerable success achieved) in writing parsers which can handle a variety of source languages (using mainly table-driven analysis methods), less progress has been made in formalizing the code generation end of the compiler. Nevertheless, some of the more recent publications in code generation stress portability or retargetability of the resulting compiler. A number of code generator synthesisers have been developed, some of which produce code that can be compared in quality with that produced by a conventional code generator. However, because of the complexity of generalizing the mapping from source language to target machine, and the need for efficiency of various kinds, code generator synthesisers are large, complicated programs. Consequently, the person who develops a code generator using one of these tools invariably needs to be a code generation specialist himself. Many compilers follow a pattern of having a front end which generates intermediate code, and a back end which converts intermediate code to machine code. The intermediate code is effectively machine independent, or can be designed that way. With these points in mind, we have set out to write a system of programs which -- 1. will allow the generation of such a back end in a reasonably short time, for a general intermediate code, and for a general machine code, and -- 2. can be used by anyone who has a sound knowledge of the target machine's architecture and associated assembler language, but is not necessarily a specialist compiler writer. The system consists of a series of friendly, interactive programs by means of which the user sets up tables defining the architecture and assembly level instructions for the target machine, and the code templates onto which intermediate codes produced by a parser have been mapped. A general notation has been developed to represent machine instructions using the same format as the target assembler. Thus the code generator writer is able to write code sequences to perform the effects of the intermediate codes, using assembly mnemonics familiar to him. The resultant table-driven code generator simply replaces a sequence of intermediate codes by their respective code templates, relocating them in memory and filling in addresses known only at code-generation time. This thesis describes the use and implementation details of this generalized code generation system. As an example, the implementation of a code generator for a CLANG [23] parser on an 8080 processor is described. The discussion also includes guide-lines on how to implement a loader and associated run-time routines for use in executing the object code. The results of a number of bench-marks have shown, as expected, that code produced by a code generator developed in this manner is larger and slower than that from a special purpose optimizing code generator, but is still several times faster than interpreting the intermediate code. The major benefit to be gained from using this system lies in the shorter development time by a less skilled person.
- Description
- KMBT_223
- Description
- Adobe Acrobat 9.53 Paper Capture Plug-in
- Format
- 150 p., pdf
- Publisher
- Rhodes University, Faculty of Science, Computer Science
- Language
- English
- Rights
- Clayton, Peter Graham
- Hits: 677
- Visitors: 736
- Downloads: 67
Thumbnail | File | Description | Size | Format | |||
---|---|---|---|---|---|---|---|
View Details Download | SOURCEPDF | 12 MB | Adobe Acrobat PDF | View Details Download |