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

Safe Haskell | None
Language | GHC2021

Futhark.Internalise.TypesValues

Contents

- Internalising types
- Internalising values
- For internal testing

Synopsis

- internaliseReturnType :: [Tree (TypeBase Shape Uniqueness)] -> ResRetType -> [TypeBase shape u] -> [(TypeBase ExtShape Uniqueness, RetAls)]
- internaliseCoerceType :: StructType -> [TypeBase shape u] -> [TypeBase ExtShape Uniqueness]
- internaliseLambdaReturnType :: ResType -> [TypeBase shape u] -> InternaliseM [TypeBase Shape NoUniqueness]
- internaliseEntryReturnType :: [Tree (TypeBase Shape Uniqueness)] -> ResRetType -> [[(TypeBase ExtShape Uniqueness, RetAls)]]
- internaliseType :: TypeBase Size NoUniqueness -> [Tree (TypeBase ExtShape Uniqueness)]
- internaliseParamTypes :: [ParamType] -> InternaliseM [[Tree (TypeBase Shape Uniqueness)]]
- internaliseLoopParamType :: ParamType -> [TypeBase shape u] -> InternaliseM [TypeBase Shape Uniqueness]
- internalisePrimType :: PrimType -> PrimType
- internalisedTypeSize :: TypeBase Size als -> Int
- internaliseSumTypeRep :: Map Name [StructType] -> ([TypeBase ExtShape Uniqueness], [(Name, [Int])])
- internaliseSumType :: Map Name [StructType] -> InternaliseM ([TypeBase ExtShape Uniqueness], [(Name, [Int])])
- type Tree = Free []
- internalisePrimValue :: PrimValue -> PrimValue
- inferAliases :: [Tree (TypeBase Shape Uniqueness)] -> [Tree (TypeBase ExtShape Uniqueness)] -> [[(TypeBase ExtShape Uniqueness, RetAls)]]
- internaliseConstructors :: Map Name [Tree (TypeBase ExtShape Uniqueness)] -> ([Tree (TypeBase ExtShape Uniqueness)], [(Name, [Int])])

# Internalising types

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

internaliseCoerceType :: StructType -> [TypeBase shape u] -> [TypeBase ExtShape Uniqueness] Source #

internaliseLambdaReturnType :: ResType -> [TypeBase shape u] -> InternaliseM [TypeBase Shape NoUniqueness] Source #

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

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

internaliseType :: TypeBase Size NoUniqueness -> [Tree (TypeBase ExtShape Uniqueness)] Source #

internaliseParamTypes :: [ParamType] -> InternaliseM [[Tree (TypeBase Shape Uniqueness)]] Source #

internaliseLoopParamType :: ParamType -> [TypeBase shape u] -> InternaliseM [TypeBase Shape Uniqueness] Source #

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?

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

internaliseSumType :: Map Name [StructType] -> InternaliseM ([TypeBase ExtShape Uniqueness], [(Name, [Int])]) Source #

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

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

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

Only exposed for testing purposes.