Many valuable flow analysis algorithms never make their way into the optimization phase of a compiler because they are difficult to build and maintain. A major problem is the lack of suitable high-level abstractions for implementing analyzers. This report provides such an abstraction based on the directed graph, describes a programming language based on this formalism, and shows that it makes the implementation and use of analysis algorithms easy.

The report introduces the idea of viewing a flow analyzer as a graph transformer, motivating the choice of graphs as an underlying data type. A family of powerful yet easily specified primitive graph transformations based on a pattern-match and replacement paradigm is presented, along with an algorithm for performing graph pattern-matching. Implementations of some of the most complex analysis algorithms known are presented, showing that a language based on graphs and graph transformations is sufficient for performing flow analysis. This approach successfully addresses many of the difficulties commonly encountered building and combining analyzers without affecting the asymptotic time bounds of any algorithm thus implemented.

The system, including a library of pre-programmed reusable analyzers has been incorporated into a pre-existing compiler optimizer, replacing a hand-coded analyzer. Within this experimental setting, it is demonstrated that the system greatly facilitates the implementation and use of analyzers, that different algorithms for solving the same problem can be interchanged easily without disturbing the surrounding compiler, and that multiple algorithms can coexist and interact without the need for any special interfaces.




Download Full History