Reusable, generic program analyses and transformations

  • Authors:
  • Jeremiah James Willcock;Andrew Lumsdaine;Daniel J. Quinlan

  • Affiliations:
  • Indiana University, Bloomington, IN, USA;Indiana University, Bloomington, IN, USA;Lawrence Livermore National Laboratory, Livermore, CA, USA

  • Venue:
  • GPCE '09 Proceedings of the eighth international conference on Generative programming and component engineering
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

The optimizations in modern compilers are constructed for a predetermined set of primitive types. As a result, programmers are unable to exploit optimizations for user-defined types where these optimizations would be correct and beneficial. Moreover, because the set of optimizations is also fixed, programmers are unable to incorporate new optimizations into the compiler. To address these limitations, we apply the reuse methodologies from generic programming to compiler analyses and optimizations. To enable compilers to apply optimizations to classes of types rather than particular types, we define optimizations in terms of generic interface descriptions (similar to C++ concepts or Haskell type classes). By extending these interface descriptions to include associated program analysis and transformation fragments, we enable compilers to incorporate user-defined transformations and analyses. Since these transformations are explicitly associated with interface descriptions, they can be applied in generic fashion by the compiler. We demonstrate that classical compiler optimizations, when generalized using this framework, can apply to a broad range of types, both built-in and user-defined. Finally, we present an initial implementation, the principles of which are generalizable to other compilers.