futhark-0.9.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Internalise.Monomorphise

Description

This monomorphization module converts a well-typed, polymorphic, module-free Futhark program into an equivalent monomorphic program.

This pass also does a few other simplifications to make the job of subsequent passes easier. Specifically, it does the following:

  • Turn operator sections into explicit lambdas.
  • Converts identifiers of record type into record patterns (and similarly for tuples).
  • Converts applications of intrinsic SOACs into SOAC AST nodes (Map, Reduce, etc).
  • Elide functions that are not reachable from an entry point (this is a side effect of the monomorphisation algorithm, which uses the entry points as roots).
  • Turns implicit record fields into explicit record fields.

Note that these changes are unfortunately not visible in the AST representation.

Synopsis

Documentation

transformDecs :: [Dec] -> MonoM () Source #

Monomorphize a list of top-level declarations. A module-free input program is expected, so only value declarations and type declaration are accepted.

runMonoM :: VNameSource -> MonoM a -> ((a, Seq (VName, ValBind)), VNameSource) Source #