Abstract
Using an intermediate language is a well-known, effective technique for constructing interpreters and compilers. This paper describes a retargetable, optimizing compilation system centered around the use of two intermediate languages (IL): one relatively high level, the other a low level corresponding to target machine instructions. The high-level IL (HIL) models a stack-based, hypothetical RISC machine. The low-level IL (LIL) models target machines at the instruction-set architecture level. All code improvements are applied to the LIL representation of a program. This is motivated by the observation that most optimizations are machine dependent, and the few that are truly machine independent interact with the machine-dependent ones. This paper describes several ‘machine-independent’ code improvements and shows that they are actually machine dependent. To illustrate how code improvements can be applied to a LIL, an algorithm for induction variable elimination is presented. It is demonstrated that this algorithm yields better code than traditional implementations that are applied machine-independently to a high-level representation.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Aho, A. V., Sethi, R., and Ullman, J. D., Compilers Principles, Techniques and Tools, Addison-Wesley, Reading, MA, 1986.
Benitez, M. E., and Davidson, J. W., “Code Generation for Streaming: an Access/ Execute Mechanism”, Proceedings of the Fourth International Symposium on Architectural Support for Programming Languages and Operating Systems, Santa Clara, CA, April 1991, pp. 132–141.
Chow, F. C, A Portable Machine-Independent Global Optimizer—Design and Measurements, Ph.D. Dissertation, Stanford University, 1983.
Cytron, R., Ferrante, J., Rosen, B. K., Wegman, M. N., and Zadeck, F. K., “Efficiently Computing Static Single Assignment Form and the Control Dependence Graph”, ACM Transactions on Programming Languages and Systems, 13(4), October 1991, pp. 451–490.
Davidson, J. W. and Fraser, C. W., “Register Allocation and Exhaustive Peephole Optimization”, Software-Practice and Experience, 14(9), September 1984, pp. 857–866.
Davidson, J. W. and Fraser, C. W., “Code Selection Through Peephole Optimization”, Transactions on Programming Languages and Systems, 6(4), October 1984, pp. 7–32.
Davidson, J. W., “A Retargetable Instruction Reorganizer”,Proceedings of the '86 Symposium on Compiler Construction, Palo Alto, CA, June 1986, pp. 234–241.
Davidson, J. W. and Gresh, J. V., “Cint: A RISC Interpreter for the C Programming Language”, Proceedings of the ACM SIGPLAN '87 Symposium on Interpreters and Interpretive Techniques, St. Paul, MN, June 1987, pp. 189–198.
Davidson, J. W. and Whalley, D. B., “A Design Environment for Addressing Architecture and Compiler Interactions”, Microprocessors and Microsystems, 15(9), November 1991, pp. 459–472.
Joy, William N. and McKusick, M. Kirk, “Berkeley Pascal PX Implementation Notes Version 2.0-January, 1979”, Department of Engineering and Computer Science, University of California, Berkeley, January 1979.
McFarling, S., “Procedure Merging with Instruction Caches”, Proceedings of the ACM SIGPLAN '91 Symposium on Programming Language Design and Implementation, Toronto, Ontario, June 1991, pp. 71–79.
Nelson, P. A., “A Comparison of PASCAL Intermediate Languages”, Proceedings of the SIGPLAN Symposium on Compiler Construction, Denver, CO, August 1979, pp. 208–213.
Newey, M. C., Poole, P. C., and Waite, W. M., “Abstract Machine Modelling to Produce Portable Software—A Review and Evaluation”, Software-Practice and Experience, 2, 1972, pp. 107–136.
Powell, M. L., “A Portable Optimizing Compiler for Modula-2”, Proceedings of the SIGPLAN '84 Symposium on Compiler Construction, Montreal, Canada, June 1984, pp. 310–318.
Richards, M., “The Portability of the BCPL Compiler”, Software-Practice and Experience, 1(2), April 1971, pp. 135–146.
Systems Performance Evaluation Cooperative, Waterside Associates, Fremont, CA, 1989.
Tanenbaum, A. S., Staveren, H. V., and Stevenson, J. W., “Using Peephole Optimization on Intermediate Code”, Transactions on Programming Languages and Systems, 4(1), January 1982, pp. 21–36.
Tanenbaum, A. S., Staveren, H. V., Keizer, E. G., and Stevenson, J. W., “A Practical Tool Kit for Making Portable Compilers”, Communications of the ACM, 26(9), September 1983, pp. 654–660.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1994 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Benitez, M.E., Davidson, J.W. (1994). The advantages of machine-dependent global optimization. In: Gutknecht, J. (eds) Programming Languages and System Architectures. Lecture Notes in Computer Science, vol 782. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-57840-4_27
Download citation
DOI: https://doi.org/10.1007/3-540-57840-4_27
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-57840-6
Online ISBN: 978-3-540-48356-4
eBook Packages: Springer Book Archive