Abstract

Compilers are typically hardwired to attempt optimizations only on expressions involving particular built-in types. Ideally, an optimizing compiler can recognize a rewrite opportunity whenever the operands in an expression satisfy the (algebraic) properties that justify the rewrite. This paper applies the principles and techniques of generic programming and the planned concepts language feature of C++ to approximate this ideal. Concretely, a concept defines the signature and algebraic laws of a class of types. We attach rewrite rules to a concept, so that the rules apply to all types in the class defined by a concept. The annotation burden to a programmer is thus small---the declaration that a type models a particular concept is simultaneously taken as an annotation that enables optimizations. To increase the applicability of generic rewrite rules, we instantiate them to type-specific rules, enabling the use of data-flow information from the compiler's existing analyses, and interleave the application of rewrite rules with function inlining. Our prototype is implemented as an extension of the ConceptGCC compiler; our experiments show the approach is effective in eliminating abstraction penalties.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.