futhark-0.25.15: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Futhark.Internalise.TypesValues

Synopsis

Internalising types

internaliseEntryReturnType :: [Tree (TypeBase Shape Uniqueness)] -> ResRetType -> [[(TypeBase ExtShape Uniqueness, RetAls)]] Source #

As internaliseReturnType, but returns components of a top-level tuple type piecemeal.

internalisePrimType :: PrimType -> PrimType Source #

Convert an external primitive to an internal primitive.

internalisedTypeSize :: TypeBase Size als -> Int Source #

How many core language values are needed to represent one source language value of the given type?

type Tree = Free [] Source #

A tree is just an instantiation of the free monad with a list monad.

The important thing is that we use it to represent the original structure of arrayss, as this matters for aliasing. Each Free constructor corresponds to an array dimension. Only non-arrays have a Pure at the top level. See Note [Alias Inference].

Internalising values

internalisePrimValue :: PrimValue -> PrimValue Source #

Convert an external primitive value to an internal primitive value.

For internal testing

internaliseConstructors :: Map Name [Tree (TypeBase ExtShape Uniqueness)] -> ([Tree (TypeBase ExtShape Uniqueness)], [(Name, [Int])]) Source #

Only exposed for testing purposes.