Abstract
A new technique for automatic retargetable code generation is presented. This technique is based on the observation that a ‘reduced instruction set’ subset can always be found for a target machine instruction set; the rest of the instructions are seen to be equivalent to sequence of the reduced instruction set instructions. Given a target machine description, a method is presented which partitions it into two: one partition contains the reduced instruction set; the other contains the rest of the instructions, along with corresponding simulation sequences — these simulation sequences are unique with respect to the partition. In view of the above, the code generation problem, more precisely the instruction selection problem, is seen as a sequence of two phases: The first phase generates reduced instruction set code; the second phase finds opportunities for optimization through compaction of sub sequences in the generated code, to complex instructions. The full capability of the target machine can be potentially utilized due to the latter phase. Retargetability is achieved by automatically generating the above phases from the information in the partition. The phases are based on tree-pattern-matching, implemented through LR parsing. The technique has been tested for the MC 68000; simple comparisons show the generated code to be satisfactory.
Preview
Unable to display preview. Download preview PDF.
References
Aho, A.V., and Ullman, J.D. Principles of Compiler Design. Addison-Wesley, Reading, Mass., 1977.
Cattel, R.G.G. Automatic Derivation of Code Generators from Machine Descriptions. ACM Trans. Program. Lang. System 2,2 1980, 173–190.
Davidson, J.W., and Fraser, C.W. Code Selection Through Object Code Optimization. ACM Trans. Program. Lang. System 6,4 1984, 505–526.
Ganapathy, M., and Fischer, C.N. Description Driven Code Generation Using Attribute Grammars. In 9th ACM Symp. Principles of Prog. Lang. 1982.
Ganapathy M., Fischer, C.N., and Hennessy, J.L. Retargetable Compiler Code Generation. Computing Surveys 14,4 (1982), 573–592.
Glanville, R.S., and Graham, S. A new Method for Compiler Code Generation. In 5th ACM Sump. Principles of Prog. Lang. 1978.
Graham, S. Table Driven Code Generation. IEEE Computer 13,8 1980, 25–34.
Johnson, S.C. YACC — Yet Another Compiler Compiler. Computing Science TR 32, Bell Labs. 1975.
Johnson, S.C. A Portable Compiler: Theory and Practice. In 5th ACM Symp. on Principles of Prog. Lang. 1978.
Wulf, W.A. Compiler and Computer Architecture. IEEE Computer Architecture. IEEE Computer 14,7 1981, 41–48.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1986 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Kumar, S., Malhotra, V.M. (1986). Automatic retargetable code generation: A new technique. In: Nori, K.V. (eds) Foundations of Software Technology and Theoretical Computer Science. FSTTCS 1986. Lecture Notes in Computer Science, vol 241. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-17179-7_4
Download citation
DOI: https://doi.org/10.1007/3-540-17179-7_4
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-17179-9
Online ISBN: 978-3-540-47239-1
eBook Packages: Springer Book Archive