A High-Level IR Transformation System

  • Herbert Jordan
  • Peter Thoman
  • Thomas Fahringer
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8374)

Abstract

The development and implementation of source-to-source code transformations based on high-level intermediate representations (IRs) is a labor-intensive, error-prone task. It tends to result in large code bases which are hard to read and maintain. Although not encountered within widely used source-to-source compiler infrastructures, transformation systems tackle this issue by utilizing declarative descriptions of unification-based term rewriting rules. However, unification lacks the ability of (arbitrarily) deep term inspection and is limited to tree nodes exhibiting a fixed arity – a property not generally satisfied by high-level IRs or programming languages.

In this paper we present a declarative tree transformation system which exceeds the expressiveness of conventional unification based systems by operating on arbitrary tree structures.We define its formal foundation, describe its implementation within the Insieme compiler project and provide real-world code examples. The latter demonstrate the expressive power, usability and intuitiveness of our solution.

Keywords

Compiler Program Transformation Term Rewriting Pattern Matching Regular Expressions 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    clang: a C language family frontend for LLVM (2012), http://clang.llvm.org/ (Online May 30, 2013)
  2. 2.
    Cordy, J.R.: The TXL source transformation language. Science of Computer Programming 61(3), 190–210 (2006)CrossRefMATHMathSciNetGoogle Scholar
  3. 3.
    Insieme Compiler and Runtime Infrastructure. University of Innsbruck, http://insieme-compiler.org
  4. 4.
    Jordan, H., et al.: INSPIRE: The Insieme Parallel Intermediate Representation. In: PACT. ACM (2013) (to be published)Google Scholar
  5. 5.
    Merrill, J.: Generic and gimple: A new tree representation for entire functions. In: GCC Developers Summit, pp. 171–179 (2003)Google Scholar
  6. 6.
    Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: Intermediate language and tools for analysis and transformation of C programs. In: Nigel Horspool, R. (ed.) CC 2002. LNCS, vol. 2304, pp. 213–228. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  7. 7.
    Quinlan, D.: ROSE: Compiler support for object-oriented frameworks. Parallel Processing Letters 10(02-03), 215–226 (2000)Google Scholar
  8. 8.
    The Program Transformation Wiki (2013), http://program-transformation.org/ (May 30, 2013)
  9. 9.
    Thoman, P., Jordan, H., Fahringer, T.: Adaptive Granularity Control in Task Parallel Programs Using Multiversioning. In: Wolf, F., Mohr, B., an Mey, D. (eds.) Euro-Par 2013. LNCS, vol. 8097, pp. 164–177. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  10. 10.
    Visser, E.: A survey of rewriting strategies in program transformation systems. ENTCS 57, 109–143 (2001)Google Scholar
  11. 11.
    Visser, E.: Program transformation with stratego/XT. In: Lengauer, C., Batory, D., Blum, A., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • Herbert Jordan
    • 1
  • Peter Thoman
    • 1
  • Thomas Fahringer
    • 1
  1. 1.Institute of Computer ScienceUniversity of InnsbruckInnsbruckAustria

Personalised recommendations