futhark
Safe HaskellNone
LanguageGHC2021

Futhark.Internalise.TypesValues

Synopsis

Internalising types

internaliseReturnType :: [Tree (TypeBase Shape Diet)] -> ResRetType -> [(TypeBase ExtShape NoMode, RetAls)] Source #

The mode of the source-level return type is used to compute the RetAls, and then discarded: an IR return type says nothing about aliasing on its own.

internaliseEntryReturnType :: [Tree (TypeBase Shape Diet)] -> ResRetType -> [[(TypeBase ExtShape Freshness, 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 o -> 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 o)] -> ([Tree (TypeBase ExtShape o)], [(Name, [Int])]) Source #

Only exposed for testing purposes.