2015 · 12 citations · 15 references
ComputingComputer ScienceCompilersProgramming LanguagesTheory Of ComputationAbstract Syntax TreesControl-flow AnalysisFunctional ProgrammingIntermediate RepresentationContinuation-passing StyleHigher-order FunctionsIntermediate Representation DesignLoop UnrollingProgram TransformationRecursionTransformations
Many modern programming languages support both imperative and functional idioms. However, state-of-the-art imperative intermediate representations (IRs) cannot natively represent crucial functional concepts (like higher-order functions). On the other hand, functional IRs employ an explicit scope nesting, which is cumbersome to maintain across certain transformations. In this paper we present Thorin: a higher-order, functional IR based on continuation-passing style that abandons explicit scope nesting in favor of a dependency graph. This makes Thorin an attractive IR for both imperative as well as functional languages. Furthermore, we present a novel program transformation to eliminate the overhead caused by higher-order functions. The main component of this transformation is lambda mangling: an important transformation primitive in Thorin. We demonstrate that lambda mangling subsumes many classic program transformations like tail-recursion elimination, loop unrolling or (partial) inlining. In our experiments we show that higher-order programs translated with Thorin are consistently as fast as C programs.
15
Notions of computation and monads
Eugenio Moggi · Information and Computation · 1991 · 1.7K citations
The essence of compiling with continuations
Cormac Flanagan, Amr Sabry, Bruce F. Duba et al. · 1993 · 533 citations
Global value numbers and redundant computations
Barry K. Rosen, Mark N. Wegman, F. K. Zadeck · 1988 · 483 citations
ORBIT: an optimizing compiler for scheme
Norman I. Adams, David Kranz, Richard Kelsey et al. · 1986 · 209 citations