Abstract
We present a novel variation on the standard technique of selecting instructions by tiling an intermediate-code tree. Typical compilers use a different set of tiles for every target machine. By analyzing a formal model of machine-level computation, we have developed a single set of tiles that is machine-independent while retaining the expressive power of machine code. Using this tileset, we reduce the number of tilers required from one per machine to one per architectural family (e.g., register architecture or stack architecture). Because the tiler is the part of the instruction selector that is most difficult to reason about, our technique makes it possible to retarget an instruction selector with significantly less effort than standard techniques. Retargeting effort is further reduced by applying an earlier result which generates the machine-dependent implementation of our tileset automatically from a declarative description of instructions' semantics. Our design has the additional benefit of enabling modular reasoning about three aspects of code generation that are not typically separated: the semantics of the compiler's intermediate representation, the semantics of the target instruction set, and the techniques needed to generate good target code.
Supplemental Material
- Alfred V. Aho, Mahadevan Ganapathi, and Steven W. K. Tjiang. 1989 (October). Code generation using tree matching and dynamic programming. ACM Transactions on Programming Languages and Systems, 11 (4):491--516. Google Scholar
Digital Library
- Andrew W. Appel. 1998. Modern Compiler Implementation. Cambridge University Press, Cambridge, UK. Available in three editions: C, Java, and ML. Google Scholar
Digital Library
- Manuel E. Benitez and Jack W. Davidson. 1988 (July). A portable global optimizer and linker. Proceedings of the ACM SIGPLAN '88 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 23(7):329--338. Google Scholar
Digital Library
- Manuel E. Benitez and Jack W. Davidson. 1994 (March). The advantages of machine-dependent global optimization. In Programming Languages and System Architectures, LNCS volume 782, pages 105--124. Springer Verlag. Google Scholar
Digital Library
- Roderic G. G. Cattell. 1980 (April). Automatic derivation of code generators from machine descriptions. ACM Transactions on Programming Languages and Systems, 2(2):173--190. Google Scholar
Digital Library
- Melvin E. Conway. 1958 (October). Proposal for an UNCOL. Communications of the ACM, 1(10):5--8. Google Scholar
Digital Library
- Jack W. Davidson and Christopher W. Fraser. 1984 (October). Code selection through object code optimization. ACM Transactions on Programming Languages and Systems, 6(4):505--526. Google Scholar
Digital Library
- João Dias and Norman Ramsey. 2006 (March). Converting intermediate code to assembly code using declarative machine descriptions. In 15th International Conference on Compiler Construction (CC 2006), LNCS volume 3923, pages 217--231. Google Scholar
Digital Library
- João Dias and Norman Ramsey. 2010 (January). Automatically generating back ends using declarative machine descriptions. In Proceedings of the 37th ACM Symposium on the Principles of Programming Languages, pages 403--416. Google Scholar
Digital Library
- Christopher W. Fraser and David R. Hanson. 1995. A Retargetable C Compiler: Design and Implementation. Benjamin/Cummings. Google Scholar
Digital Library
- Christopher W. Fraser, David R. Hanson, and Todd A. Proebsting. 1992 (September). Engineering a simple, efficient code-generator generator. ACM Letters on Programming Languages and Systems, 1(3):213--226. Google Scholar
Digital Library
- Christopher W. Fraser, Robert R. Henry, and Todd A. Proebsting. 1992 (April). BURG---fast optimal instruction selection and tree parsing. SIGPLAN Notices, 27(4):68--76. Google Scholar
Digital Library
- Jean-Yves Girard. 1986. The System F of variable types, fifteen years later. Theoretical Computer Science, 45(2):159--192. Google Scholar
Digital Library
- Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO '04: Proceedings of the International Symposium on Code Generation and Optimization, pages 75--86. Google Scholar
Digital Library
- Tim Lindholm and Frank Yellin. 1999. Java Virtual Machine Specification. Addison-Wesley, second edition. Google Scholar
Digital Library
- Robin Milner. 1978 (December). A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--375.Google Scholar
Cross Ref
- Eduardo Pelegrí-Llopart and Susan L. Graham. 1988 (January). Optimal code generation for expression trees: An application of BURS theory. In Conference Record of the 15th Annual ACM Symposium on Principles of Programming Languages, pages 294--308. Google Scholar
Digital Library
- Simon L. Peyton Jones, Norman Ramsey, and Fermin Reig. 1999 (September). C-: A portable assembly language that supports garbage collection. In International Conference on Principles and Practice of Declarative Programming, LNCS volume 1702, pages 1--28. Springer Verlag. Google Scholar
Digital Library
- Todd A. Proebsting. 1992 (June). Simple and efficient BURS table generation. Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 27 (7):331--340. Google Scholar
Digital Library
- Norman Ramsey and Cristina Cifuentes. 2003 (March). A transformational approach to binary translation of delayed branches. ACM Transactions on Programming Languages and Systems, 25(2):210--224. Google Scholar
Digital Library
- Norman Ramsey and Jack W. Davidson. 1998 (June). Machine descriptions to build tools for embedded systems. In ACM SIGPLAN Workshop on Languages, Compilers, and Tools for Embedded Systems (LCTES'98), LNCS volume 1474, pages 172--188. Springer Verlag. Google Scholar
Digital Library
- Norman Ramsey, Simon Peyton Jones, and Christian Lindig. 2005 (February). The C- language specification Version 2.0 (CVS revision 1.128). See http://www.cminusminus.org/code.html#spec.Google Scholar
- Norman Ramsey and Simon L. Peyton Jones. 2000 (May). A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN '00 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 35 (5):285--298. Google Scholar
Digital Library
- Kevin Redwine and Norman Ramsey. 2004 (April). Widening integer arithmetic. In 13th International Conference on Compiler Construction (CC 2004), LNCS volume 2985, pages 232--249.Google Scholar
Cross Ref
- J. Strong, J. H.Wegstein, A. Tritter, J. Olsztyn, Owen R.Mock, and T. Steel. 1958. The problem of programming communication with changing machines: A proposed solution (Part 2). Communications of the ACM, 1 (9):9--16. Google Scholar
Digital Library
- Henry S. Warren. 2003. Hacker's Delight. Addison-Wesley. Google Scholar
Digital Library
Index Terms
Resourceable, retargetable, modular instruction selection using a machine-independent, type-based tiling of low-level intermediate code
Recommendations
Resourceable, retargetable, modular instruction selection using a machine-independent, type-based tiling of low-level intermediate code
POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesWe present a novel variation on the standard technique of selecting instructions by tiling an intermediate-code tree. Typical compilers use a different set of tiles for every target machine. By analyzing a formal model of machine-level computation, we ...
Retargetable code optimization with SIMD instructions
CODES+ISSS '06: Proceedings of the 4th international conference on Hardware/software codesign and system synthesisRetargetable C compilers are nowadays widely used to quickly obtain compiler support for new embedded processors and to perform early processor architecture exploration. One frequent concern about retargetable compilers, though, is their lack of machine-...
Automatically generating instruction selectors using declarative machine descriptions
POPL '10Despite years of work on retargetable compilers, creating a good, reliable back end for an optimizing compiler still entails a lot of hard work. Moreover, a critical component of the back end---the instruction selector---must be written by a person who ...







Comments