Hoopl: A Modular, Reusable Library for Dataflow Analysis and Transformation

Norman Ramsey and João Dias and Simon Peyton Jones

Dataflow analysis and transformation of control-flow graphs is pervasive in optimizing compilers, but it is typically tightly interwoven with the details of a particular compiler. We describe Hoopl, a reusable Haskell library that makes it unusually easy to define new analyses and transformations for any compiler. Hoopl's interface is modular and polymorphic, and it offers unusually strong static guarantees. The implementation encapsulates state-of-the-art algorithms (interleaved analysis and rewriting, dynamic error isolation), and it cleanly separates their tricky elements so that they can be understood independently.

This paper supersedes our previous paper about Hoopl, but if you are interested in using Hoopl, the previous paper is still worth reading because it contains more explanations and examples about how to use the library—this paper is more about the implementation.

Full paper

The paper is available as US Letter PostScript (369K), US Letter PDF (240K), and US Letter TeX DVI (186K).

Where's the code?

The Hoopl library is now part of GHC. If you wish to contribute to Hoopl, please validate patches against the current GHC HEAD.