free-compiler-0.3.0.0: A Haskell to Coq compiler.

Safe HaskellNone
LanguageHaskell2010

FreeC.Pass.DependencyAnalysisPass

Description

This module contains a compiler pass that computes the strongly connected components of either the function or type dependency graph and transforms the strongly connected components using the given child passes.

Example

If pass1, pass2 and pass3 are DependencyAwarePasses for function declarations, then dependencyAnalysisPass [pass1, pass2, pass3] builds a compiler pass that computes the strongly connected components of the given modules function dependency graph. Each strongly connected component is first transformed with pass1. The result is further processed by pass2 and its result is passed to pass3. After all three passes have been applied to the first strongly connected component, the subsequent components are processed.

Specification

Preconditions

The preconditions of all child passes that are not already guaranteed by preceding child passes should hold.

Translation

The transformations of the child passes are applied. Due to the computation of strongly connected components, the order of declarations is changed. They are rearranged into reverse topological order.

Postconditions

The postconditions of all child passes that are not broken by subsequent child passes hold.

Error cases

The messages reported by the child passes are reported.

Synopsis

Documentation

type DependencyAwarePass decl = Pass (DependencyComponent decl) (DependencyComponent decl) Source #

Type of a compiler Pass that does not operate on entire modules but on individual strongly connected components of the dependency graph for declarations of type decl.

dependencyAnalysisPass :: DependencyAnalysisPass decl => DependencyAwarePass decl -> Module -> Converter Module Source #

Applies the given child passes to the strongly connected components of the dependency graph for declarations of type decl of the given module.