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

Safe HaskellNone
LanguageHaskell2010

Futhark.Representation.AST.Syntax

Contents

Description

Futhark core language skeleton. Concrete representations further extend this skeleton by defining a "lore", which specifies concrete annotations (Futhark.Representation.AST.Annotations) and semantics.

Synopsis

Documentation

Types

data Uniqueness Source #

The uniqueness attribute of a type. This essentially indicates whether or not in-place modifications are acceptable. With respect to ordering, Unique is greater than Nonunique.

Constructors

Nonunique

May have references outside current function.

Unique

No references outside current function.

Instances
Eq Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Ord Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Show Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Semigroup Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Monoid Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: DeclType -> Type Source #

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (Param (MemInfo SubExp Uniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (ParamT DeclType) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

data NoUniqueness Source #

A fancier name for '()' - encodes no uniqueness information.

Constructors

NoUniqueness 
Instances
Eq NoUniqueness Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Ord NoUniqueness Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Show NoUniqueness Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Pretty NoUniqueness Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

SetType Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

setType :: Type -> Type -> Type Source #

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Typed Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (PatElemT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (PatElemT (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (Param (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (ParamT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ParamT Type -> Doc #

pprPrec :: Int -> ParamT Type -> Doc #

pprList :: [ParamT Type] -> Doc #

FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

newtype Rank Source #

The size of an array type as merely the number of dimensions, with no further information.

Constructors

Rank Int 
Instances
Eq Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: Rank -> Rank -> Bool #

(/=) :: Rank -> Rank -> Bool #

Ord Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: Rank -> Rank -> Ordering #

(<) :: Rank -> Rank -> Bool #

(<=) :: Rank -> Rank -> Bool #

(>) :: Rank -> Rank -> Bool #

(>=) :: Rank -> Rank -> Bool #

max :: Rank -> Rank -> Rank #

min :: Rank -> Rank -> Rank #

Show Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> Rank -> ShowS #

show :: Rank -> String #

showList :: [Rank] -> ShowS #

Semigroup Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(<>) :: Rank -> Rank -> Rank #

sconcat :: NonEmpty Rank -> Rank #

stimes :: Integral b => b -> Rank -> Rank #

Monoid Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

mempty :: Rank #

mappend :: Rank -> Rank -> Rank #

mconcat :: [Rank] -> Rank #

ArrayShape Rank Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Substitute Rank Source # 
Instance details

Defined in Futhark.Transform.Substitute

Rename Rank Source # 
Instance details

Defined in Futhark.Transform.Rename

Pretty u => Pretty (TypeBase Rank u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: TypeBase Rank u -> Doc #

pprPrec :: Int -> TypeBase Rank u -> Doc #

pprList :: [TypeBase Rank u] -> Doc #

class (Monoid a, Eq a, Ord a) => ArrayShape a where Source #

A class encompassing types containing array shape information.

Methods

shapeRank :: a -> Int Source #

Return the rank of an array with the given size.

stripDims :: Int -> a -> a Source #

stripDims n shape strips the outer n dimensions from shape.

subShapeOf :: a -> a -> Bool Source #

Check whether one shape if a subset of another shape.

data Space Source #

The memory space of a block. If DefaultSpace, this is the "default" space, whatever that is. The exact meaning of the SpaceID depends on the backend used. In GPU kernels, for example, this is used to distinguish between constant, global and shared memory spaces. In GPU-enabled host code, it is used to distinguish between host memory (DefaultSpace) and GPU space.

Constructors

DefaultSpace 
Space SpaceId 
Instances
Eq Space Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: Space -> Space -> Bool #

(/=) :: Space -> Space -> Bool #

Ord Space Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: Space -> Space -> Ordering #

(<) :: Space -> Space -> Bool #

(<=) :: Space -> Space -> Bool #

(>) :: Space -> Space -> Bool #

(>=) :: Space -> Space -> Bool #

max :: Space -> Space -> Space #

min :: Space -> Space -> Space #

Show Space Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> Space -> ShowS #

show :: Space -> String #

showList :: [Space] -> ShowS #

Pretty Space Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Space -> Doc #

pprPrec :: Int -> Space -> Doc #

pprList :: [Space] -> Doc #

data TypeBase shape u Source #

An Futhark type is either an array or an element type. When comparing types for equality with ==, shapes must match.

Constructors

Prim PrimType 
Array PrimType shape u 
Mem SubExp Space 
Instances
SetType Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

setType :: Type -> Type -> Type Source #

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: Type -> Type Source #

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

Pretty (PatElemT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (ParamT DeclType) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (ParamT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ParamT Type -> Doc #

pprPrec :: Int -> ParamT Type -> Doc #

pprList :: [ParamT Type] -> Doc #

PrettyAnnot (PatElemT (TypeBase shape u)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppAnnot :: PatElemT (TypeBase shape u) -> Maybe Doc Source #

PrettyAnnot (ParamT (TypeBase shape u)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppAnnot :: ParamT (TypeBase shape u) -> Maybe Doc Source #

(Eq shape, Eq u) => Eq (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: TypeBase shape u -> TypeBase shape u -> Bool #

(/=) :: TypeBase shape u -> TypeBase shape u -> Bool #

(Ord shape, Ord u) => Ord (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: TypeBase shape u -> TypeBase shape u -> Ordering #

(<) :: TypeBase shape u -> TypeBase shape u -> Bool #

(<=) :: TypeBase shape u -> TypeBase shape u -> Bool #

(>) :: TypeBase shape u -> TypeBase shape u -> Bool #

(>=) :: TypeBase shape u -> TypeBase shape u -> Bool #

max :: TypeBase shape u -> TypeBase shape u -> TypeBase shape u #

min :: TypeBase shape u -> TypeBase shape u -> TypeBase shape u #

(Show shape, Show u) => Show (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> TypeBase shape u -> ShowS #

show :: TypeBase shape u -> String #

showList :: [TypeBase shape u] -> ShowS #

Pretty u => Pretty (TypeBase Rank u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: TypeBase Rank u -> Doc #

pprPrec :: Int -> TypeBase Rank u -> Doc #

pprList :: [TypeBase Rank u] -> Doc #

Pretty u => Pretty (TypeBase ExtShape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty u => Pretty (TypeBase Shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: TypeBase Shape u -> Doc #

pprPrec :: Int -> TypeBase Shape u -> Doc #

pprList :: [TypeBase Shape u] -> Doc #

(FixExt shape, ArrayShape shape) => FixExt (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

fixExt :: Int -> SubExp -> TypeBase shape u -> TypeBase shape u Source #

FreeIn shape => FreeIn (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: TypeBase shape u -> Names Source #

Substitute shape => Substitute (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> TypeBase shape u -> TypeBase shape u Source #

Rename shape => Rename (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: TypeBase shape u -> RenameM (TypeBase shape u) Source #

Simplifiable shape => Simplifiable (TypeBase shape u) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Methods

simplify :: SimplifiableLore lore => TypeBase shape u -> SimpleM lore (TypeBase shape u) Source #

data Diet Source #

Information about which parts of a value/type are consumed. For example, we might say that a function taking three arguments of types ([int], *[int], [int]) has diet [Observe, Consume, Observe].

Constructors

Consume

Consumes this value.

Observe

Only observes value in this position, does not consume.

Instances
Eq Diet Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: Diet -> Diet -> Bool #

(/=) :: Diet -> Diet -> Bool #

Ord Diet Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: Diet -> Diet -> Ordering #

(<) :: Diet -> Diet -> Bool #

(<=) :: Diet -> Diet -> Bool #

(>) :: Diet -> Diet -> Bool #

(>=) :: Diet -> Diet -> Bool #

max :: Diet -> Diet -> Diet #

min :: Diet -> Diet -> Diet #

Show Diet Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> Diet -> ShowS #

show :: Diet -> String #

showList :: [Diet] -> ShowS #

Abstract syntax tree

data Ident Source #

An identifier consists of its name and the type of the value bound to the identifier.

Constructors

Ident 

Fields

Instances
Eq Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: Ident -> Ident -> Bool #

(/=) :: Ident -> Ident -> Bool #

Ord Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: Ident -> Ident -> Ordering #

(<) :: Ident -> Ident -> Bool #

(<=) :: Ident -> Ident -> Bool #

(>) :: Ident -> Ident -> Bool #

(>=) :: Ident -> Ident -> Bool #

max :: Ident -> Ident -> Ident #

min :: Ident -> Ident -> Ident #

Show Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> Ident -> ShowS #

show :: Ident -> String #

showList :: [Ident] -> ShowS #

Pretty Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Ident -> Doc #

pprPrec :: Int -> Ident -> Doc #

pprList :: [Ident] -> Doc #

Typed Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: Ident -> Type Source #

FreeIn Ident Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: Ident -> Names Source #

Substitute Ident Source # 
Instance details

Defined in Futhark.Transform.Substitute

Rename Ident Source # 
Instance details

Defined in Futhark.Transform.Rename

data SubExp Source #

A subexpression is either a scalar constant or a variable. One important property is that evaluation of a subexpression is guaranteed to complete in constant time.

Constructors

Constant PrimValue 
Var VName 
Instances
Eq SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: SubExp -> SubExp -> Bool #

(/=) :: SubExp -> SubExp -> Bool #

Ord SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Show SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Pretty SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: SubExp -> Doc #

pprPrec :: Int -> SubExp -> Doc #

pprList :: [SubExp] -> Doc #

Pretty ExtShape Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ExtShape -> Doc #

pprPrec :: Int -> ExtShape -> Doc #

pprList :: [ExtShape] -> Doc #

Pretty Shape Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Shape -> Doc #

pprPrec :: Int -> Shape -> Doc #

pprList :: [Shape] -> Doc #

FixExt ExtSize Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

fixExt :: Int -> SubExp -> ExtSize -> ExtSize Source #

SetType Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

setType :: Type -> Type -> Type Source #

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: Type -> Type Source #

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.Representation.AST.RetType

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

FreeIn SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: SubExp -> Names Source #

Substitute SubExp Source # 
Instance details

Defined in Futhark.Transform.Substitute

Rename SubExp Source # 
Instance details

Defined in Futhark.Transform.Rename

Rename ExtSize Source # 
Instance details

Defined in Futhark.Transform.Rename

RangeOf SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: SubExp -> Range Source #

ToExp SubExp Source # 
Instance details

Defined in Futhark.Construct

Methods

toExp :: MonadBinder m => SubExp -> m (Exp (Lore m)) Source #

Simplifiable SubExp Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Simplifiable ExtSize Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Pretty (PatElemT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (PatElemT (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (Param (MemInfo SubExp Uniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (Param (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (ParamT DeclType) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (ParamT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ParamT Type -> Doc #

pprPrec :: Int -> ParamT Type -> Doc #

pprList :: [ParamT Type] -> Doc #

ArrayShape (ShapeBase SubExp) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

ArrayShape (ShapeBase ExtSize) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

(Pretty u, Pretty r) => PrettyAnnot (PatElemT (MemInfo SubExp u r)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

(Pretty u, Pretty r) => PrettyAnnot (ParamT (MemInfo SubExp u r)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty u => Pretty (TypeBase ExtShape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty u => Pretty (TypeBase Shape u) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: TypeBase Shape u -> Doc #

pprPrec :: Int -> TypeBase Shape u -> Doc #

pprList :: [TypeBase Shape u] -> Doc #

FixExt ret => FixExt (MemInfo ExtSize u ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Methods

fixExt :: Int -> SubExp -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source #

FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

type PatElem lore = PatElemT (LetAttr lore) Source #

A type alias for namespace control.

data PatElemT attr Source #

An element of a pattern - consisting of a name (essentially a pair of the name and type) and an addditional parametric attribute. This attribute is what is expected to contain the type of the resulting variable.

Constructors

PatElem 

Fields

Instances
Functor PatElemT Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

fmap :: (a -> b) -> PatElemT a -> PatElemT b #

(<$) :: a -> PatElemT b -> PatElemT a #

Eq attr => Eq (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: PatElemT attr -> PatElemT attr -> Bool #

(/=) :: PatElemT attr -> PatElemT attr -> Bool #

Ord attr => Ord (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: PatElemT attr -> PatElemT attr -> Ordering #

(<) :: PatElemT attr -> PatElemT attr -> Bool #

(<=) :: PatElemT attr -> PatElemT attr -> Bool #

(>) :: PatElemT attr -> PatElemT attr -> Bool #

(>=) :: PatElemT attr -> PatElemT attr -> Bool #

max :: PatElemT attr -> PatElemT attr -> PatElemT attr #

min :: PatElemT attr -> PatElemT attr -> PatElemT attr #

Show attr => Show (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> PatElemT attr -> ShowS #

show :: PatElemT attr -> String #

showList :: [PatElemT attr] -> ShowS #

Pretty (PatElemT b) => Pretty (PatElemT (a, b)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: PatElemT (a, b) -> Doc #

pprPrec :: Int -> PatElemT (a, b) -> Doc #

pprList :: [PatElemT (a, b)] -> Doc #

Pretty (PatElemT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (PatElemT (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

SetType attr => SetType (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

setType :: PatElemT attr -> Type -> PatElemT attr Source #

Typed attr => Typed (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: PatElemT attr -> Type Source #

PrettyAnnot (PatElemT attr) => PrettyAnnot (PatElemT (Range, attr)) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

ppAnnot :: PatElemT (Range, attr) -> Maybe Doc Source #

PrettyAnnot (PatElemT attr) => PrettyAnnot (PatElemT (VarAliases, attr)) Source # 
Instance details

Defined in Futhark.Representation.Aliases

Methods

ppAnnot :: PatElemT (VarAliases, attr) -> Maybe Doc Source #

PrettyAnnot (PatElemT attr) => PrettyAnnot (PatElemT (VarWisdom, attr)) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Lore

Methods

ppAnnot :: PatElemT (VarWisdom, attr) -> Maybe Doc Source #

PrettyAnnot (PatElemT (TypeBase shape u)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppAnnot :: PatElemT (TypeBase shape u) -> Maybe Doc Source #

(Pretty u, Pretty r) => PrettyAnnot (PatElemT (MemInfo SubExp u r)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

FreeIn attr => FreeIn (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: PatElemT attr -> Names Source #

Substitute attr => Substitute (PatElemT attr) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Rename attr => Rename (PatElemT attr) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: PatElemT attr -> RenameM (PatElemT attr) Source #

AliasesOf attr => AliasesOf (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Aliases

Methods

aliasesOf :: PatElemT attr -> Names Source #

RangeOf attr => RangeOf (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: PatElemT attr -> Range Source #

data PatternT attr Source #

A pattern is conceptually just a list of names and their types.

Constructors

Pattern 

Fields

Instances
Functor PatternT Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

fmap :: (a -> b) -> PatternT a -> PatternT b #

(<$) :: a -> PatternT b -> PatternT a #

Eq attr => Eq (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: PatternT attr -> PatternT attr -> Bool #

(/=) :: PatternT attr -> PatternT attr -> Bool #

Ord attr => Ord (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: PatternT attr -> PatternT attr -> Ordering #

(<) :: PatternT attr -> PatternT attr -> Bool #

(<=) :: PatternT attr -> PatternT attr -> Bool #

(>) :: PatternT attr -> PatternT attr -> Bool #

(>=) :: PatternT attr -> PatternT attr -> Bool #

max :: PatternT attr -> PatternT attr -> PatternT attr #

min :: PatternT attr -> PatternT attr -> PatternT attr #

Show attr => Show (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> PatternT attr -> ShowS #

show :: PatternT attr -> String #

showList :: [PatternT attr] -> ShowS #

Semigroup (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(<>) :: PatternT attr -> PatternT attr -> PatternT attr #

sconcat :: NonEmpty (PatternT attr) -> PatternT attr #

stimes :: Integral b => b -> PatternT attr -> PatternT attr #

Monoid (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

mempty :: PatternT attr #

mappend :: PatternT attr -> PatternT attr -> PatternT attr #

mconcat :: [PatternT attr] -> PatternT attr #

Pretty (PatElemT attr) => Pretty (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: PatternT attr -> Doc #

pprPrec :: Int -> PatternT attr -> Doc #

pprList :: [PatternT attr] -> Doc #

FreeIn attr => FreeIn (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: PatternT attr -> Names Source #

Substitute attr => Substitute (PatternT attr) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Rename attr => Rename (PatternT attr) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: PatternT attr -> RenameM (PatternT attr) Source #

RangeOf attr => RangesOf (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangesOf :: PatternT attr -> [Range] Source #

type Pattern lore = PatternT (LetAttr lore) Source #

A type alias for namespace control.

data StmAux attr Source #

Auxilliary Information associated with a statement.

Constructors

StmAux 

Fields

Instances
Eq attr => Eq (StmAux attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: StmAux attr -> StmAux attr -> Bool #

(/=) :: StmAux attr -> StmAux attr -> Bool #

Ord attr => Ord (StmAux attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: StmAux attr -> StmAux attr -> Ordering #

(<) :: StmAux attr -> StmAux attr -> Bool #

(<=) :: StmAux attr -> StmAux attr -> Bool #

(>) :: StmAux attr -> StmAux attr -> Bool #

(>=) :: StmAux attr -> StmAux attr -> Bool #

max :: StmAux attr -> StmAux attr -> StmAux attr #

min :: StmAux attr -> StmAux attr -> StmAux attr #

Show attr => Show (StmAux attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> StmAux attr -> ShowS #

show :: StmAux attr -> String #

showList :: [StmAux attr] -> ShowS #

FreeIn attr => FreeIn (StmAux attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: StmAux attr -> Names Source #

Substitute attr => Substitute (StmAux attr) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> StmAux attr -> StmAux attr Source #

Rename attr => Rename (StmAux attr) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: StmAux attr -> RenameM (StmAux attr) Source #

data Stm lore Source #

A local variable binding.

Constructors

Let 

Fields

Instances
Scoped lore (Stm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Scope

Methods

scopeOf :: Stm lore -> Scope lore Source #

Scoped lore (Stms lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Scope

Methods

scopeOf :: Stms lore -> Scope lore Source #

Annotations lore => Eq (Stm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: Stm lore -> Stm lore -> Bool #

(/=) :: Stm lore -> Stm lore -> Bool #

Annotations lore => Ord (Stm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: Stm lore -> Stm lore -> Ordering #

(<) :: Stm lore -> Stm lore -> Bool #

(<=) :: Stm lore -> Stm lore -> Bool #

(>) :: Stm lore -> Stm lore -> Bool #

(>=) :: Stm lore -> Stm lore -> Bool #

max :: Stm lore -> Stm lore -> Stm lore #

min :: Stm lore -> Stm lore -> Stm lore #

Annotations lore => Show (Stm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> Stm lore -> ShowS #

show :: Stm lore -> String #

showList :: [Stm lore] -> ShowS #

PrettyLore lore => Pretty (Stms lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Stms lore -> Doc #

pprPrec :: Int -> Stms lore -> Doc #

pprList :: [Stms lore] -> Doc #

PrettyLore lore => Pretty (Stm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Stm lore -> Doc #

pprPrec :: Int -> Stm lore -> Doc #

pprList :: [Stm lore] -> Doc #

FreeIn (Stm lore) => FreeIn (Stms lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: Stms lore -> Names Source #

Substitute (Stm lore) => Substitute (Stms lore) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Stms lore -> Stms lore Source #

Substitutable lore => Substitute (Stm lore) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Stm lore -> Stm lore Source #

Renameable lore => Rename (Stm lore) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Stm lore -> RenameM (Stm lore) Source #

type Stms lore = Seq (Stm lore) Source #

A sequence of statements.

type Result = [SubExp] Source #

The result of a body is a sequence of subexpressions.

data BodyT lore Source #

A body consists of a number of bindings, terminating in a result (essentially a tuple literal).

Constructors

Body 

Fields

Instances
Annotations lore => Eq (BodyT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: BodyT lore -> BodyT lore -> Bool #

(/=) :: BodyT lore -> BodyT lore -> Bool #

Annotations lore => Ord (BodyT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: BodyT lore -> BodyT lore -> Ordering #

(<) :: BodyT lore -> BodyT lore -> Bool #

(<=) :: BodyT lore -> BodyT lore -> Bool #

(>) :: BodyT lore -> BodyT lore -> Bool #

(>=) :: BodyT lore -> BodyT lore -> Bool #

max :: BodyT lore -> BodyT lore -> BodyT lore #

min :: BodyT lore -> BodyT lore -> BodyT lore #

Annotations lore => Show (BodyT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> BodyT lore -> ShowS #

show :: BodyT lore -> String #

showList :: [BodyT lore] -> ShowS #

PrettyLore lore => Pretty (Body lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Body lore -> Doc #

pprPrec :: Int -> Body lore -> Doc #

pprList :: [Body lore] -> Doc #

Substitutable lore => Substitute (Body lore) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Body lore -> Body lore Source #

Renameable lore => Rename (Body lore) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Body lore -> RenameM (Body lore) Source #

Ranged lore => RangesOf (Body lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangesOf :: Body lore -> [Range] Source #

type Body = BodyT Source #

Type alias for namespace reasons.

data BasicOp lore Source #

A primitive operation that returns something of known size and does not itself contain any bindings.

Constructors

SubExp SubExp

A variable or constant.

Opaque SubExp

Semantically and operationally just identity, but is invisible/impenetrable to optimisations (hopefully). This is just a hack to avoid optimisation (so, to work around compiler limitations).

ArrayLit [SubExp] Type

Array literals, e.g., [ [1+x, 3], [2, 1+4] ]. Second arg is the element type of the rows of the array. Scalar operations

UnOp UnOp SubExp

Unary operation.

BinOp BinOp SubExp SubExp

Binary operation.

CmpOp CmpOp SubExp SubExp

Comparison - result type is always boolean.

ConvOp ConvOp SubExp

Conversion "casting".

Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc])

Turn a boolean into a certificate, halting the program with the given error message if the boolean is false.

Index VName (Slice SubExp)

The certificates for bounds-checking are part of the Stm.

Update VName (Slice SubExp) SubExp

An in-place update of the given array at the given position. Consumes the array.

Concat Int VName [VName] SubExp

concat0([1],[2, 3, 4]) = [1, 2, 3, 4]@.

Copy VName

Copy the given array. The result will not alias anything.

Manifest [Int] VName

Manifest an array with dimensions represented in the given order. The result will not alias anything.

Iota SubExp SubExp SubExp IntType

iota(n, x, s) = [x,x+s,..,x+(n-1)*s].

The IntType indicates the type of the array returned and the offset/stride arguments, but not the length argument.

Replicate Shape SubExp
replicate([3][2],1) = [[1,1], [1,1], [1,1]]
Repeat [Shape] Shape VName

Repeat each dimension of the input array some number of times, given by the corresponding shape. For an array of rank k, the list must contain k shapes. A shape may be empty (in which case the dimension is not repeated, but it is still present). The last shape indicates the amount of extra innermost dimensions. All other extra dimensions are added *before* the original dimension.

Scratch PrimType [SubExp]

Create array of given type and shape, with undefined elements.

Reshape (ShapeChange SubExp) VName

1st arg is the new shape, 2nd arg is the input array *)

Rearrange [Int] VName

Permute the dimensions of the input array. The list of integers is a list of dimensions (0-indexed), which must be a permutation of [0,n-1], where n is the number of dimensions in the input array.

Rotate [SubExp] VName

Rotate the dimensions of the input array. The list of subexpressions specify how much each dimension is rotated. The length of this list must be equal to the rank of the array.

Instances
Eq (BasicOp lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: BasicOp lore -> BasicOp lore -> Bool #

(/=) :: BasicOp lore -> BasicOp lore -> Bool #

Ord (BasicOp lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: BasicOp lore -> BasicOp lore -> Ordering #

(<) :: BasicOp lore -> BasicOp lore -> Bool #

(<=) :: BasicOp lore -> BasicOp lore -> Bool #

(>) :: BasicOp lore -> BasicOp lore -> Bool #

(>=) :: BasicOp lore -> BasicOp lore -> Bool #

max :: BasicOp lore -> BasicOp lore -> BasicOp lore #

min :: BasicOp lore -> BasicOp lore -> BasicOp lore #

Show (BasicOp lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> BasicOp lore -> ShowS #

show :: BasicOp lore -> String #

showList :: [BasicOp lore] -> ShowS #

Pretty (BasicOp lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: BasicOp lore -> Doc #

pprPrec :: Int -> BasicOp lore -> Doc #

pprList :: [BasicOp lore] -> Doc #

data UnOp Source #

Various unary operators. It is a bit ad-hoc what is a unary operator and what is a built-in function. Perhaps these should all go away eventually.

Constructors

Not

E.g., ! True == False.

Complement IntType

E.g., ~(~1) = 1.

Abs IntType

abs(-2) = 2.

FAbs FloatType

fabs(-2.0) = 2.0.

SSignum IntType

Signed sign function: ssignum(-2) = -1.

USignum IntType

Unsigned sign function: usignum(2) = 1.

Instances
Eq UnOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

(==) :: UnOp -> UnOp -> Bool #

(/=) :: UnOp -> UnOp -> Bool #

Ord UnOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

compare :: UnOp -> UnOp -> Ordering #

(<) :: UnOp -> UnOp -> Bool #

(<=) :: UnOp -> UnOp -> Bool #

(>) :: UnOp -> UnOp -> Bool #

(>=) :: UnOp -> UnOp -> Bool #

max :: UnOp -> UnOp -> UnOp #

min :: UnOp -> UnOp -> UnOp #

Show UnOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

showsPrec :: Int -> UnOp -> ShowS #

show :: UnOp -> String #

showList :: [UnOp] -> ShowS #

Pretty UnOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

ppr :: UnOp -> Doc #

pprPrec :: Int -> UnOp -> Doc #

pprList :: [UnOp] -> Doc #

data BinOp Source #

Binary operators. These correspond closely to the binary operators in LLVM. Most are parametrised by their expected input and output types.

Constructors

Add IntType

Integer addition.

FAdd FloatType

Floating-point addition.

Sub IntType

Integer subtraction.

FSub FloatType

Floating-point subtraction.

Mul IntType

Integer multiplication.

FMul FloatType

Floating-point multiplication.

UDiv IntType

Unsigned integer division. Rounds towards negativity infinity. Note: this is different from LLVM.

SDiv IntType

Signed integer division. Rounds towards negativity infinity. Note: this is different from LLVM.

FDiv FloatType

Floating-point division.

UMod IntType

Unsigned integer modulus; the countepart to UDiv.

SMod IntType

Signed integer modulus; the countepart to SDiv.

SQuot IntType

Signed integer division. Rounds towards zero. This corresponds to the sdiv instruction in LLVM.

SRem IntType

Signed integer division. Rounds towards zero. This corresponds to the srem instruction in LLVM.

SMin IntType

Returns the smallest of two signed integers.

UMin IntType

Returns the smallest of two unsigned integers.

FMin FloatType

Returns the smallest of two floating-point numbers.

SMax IntType

Returns the greatest of two signed integers.

UMax IntType

Returns the greatest of two unsigned integers.

FMax FloatType

Returns the greatest of two floating-point numbers.

Shl IntType

Left-shift.

LShr IntType

Logical right-shift, zero-extended.

AShr IntType

Arithmetic right-shift, sign-extended.

And IntType

Bitwise and.

Or IntType

Bitwise or.

Xor IntType

Bitwise exclusive-or.

Pow IntType

Integer exponentiation.

FPow FloatType

Floating-point exponentiation.

LogAnd

Boolean and - not short-circuiting.

LogOr

Boolean or - not short-circuiting.

Instances
Eq BinOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

(==) :: BinOp -> BinOp -> Bool #

(/=) :: BinOp -> BinOp -> Bool #

Ord BinOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

compare :: BinOp -> BinOp -> Ordering #

(<) :: BinOp -> BinOp -> Bool #

(<=) :: BinOp -> BinOp -> Bool #

(>) :: BinOp -> BinOp -> Bool #

(>=) :: BinOp -> BinOp -> Bool #

max :: BinOp -> BinOp -> BinOp #

min :: BinOp -> BinOp -> BinOp #

Show BinOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

showsPrec :: Int -> BinOp -> ShowS #

show :: BinOp -> String #

showList :: [BinOp] -> ShowS #

Pretty BinOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

ppr :: BinOp -> Doc #

pprPrec :: Int -> BinOp -> Doc #

pprList :: [BinOp] -> Doc #

data CmpOp Source #

Comparison operators are like BinOps, but they return PrimTypes. The somewhat ugly constructor names are straight out of LLVM.

Constructors

CmpEq PrimType

All types equality.

CmpUlt IntType

Unsigned less than.

CmpUle IntType

Unsigned less than or equal.

CmpSlt IntType

Signed less than.

CmpSle IntType

Signed less than or equal.

FCmpLt FloatType

Floating-point less than.

FCmpLe FloatType

Floating-point less than or equal.

CmpLlt

Boolean less than.

CmpLle

Boolean less than or equal.

Instances
Eq CmpOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

(==) :: CmpOp -> CmpOp -> Bool #

(/=) :: CmpOp -> CmpOp -> Bool #

Ord CmpOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

compare :: CmpOp -> CmpOp -> Ordering #

(<) :: CmpOp -> CmpOp -> Bool #

(<=) :: CmpOp -> CmpOp -> Bool #

(>) :: CmpOp -> CmpOp -> Bool #

(>=) :: CmpOp -> CmpOp -> Bool #

max :: CmpOp -> CmpOp -> CmpOp #

min :: CmpOp -> CmpOp -> CmpOp #

Show CmpOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

showsPrec :: Int -> CmpOp -> ShowS #

show :: CmpOp -> String #

showList :: [CmpOp] -> ShowS #

Pretty CmpOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

ppr :: CmpOp -> Doc #

pprPrec :: Int -> CmpOp -> Doc #

pprList :: [CmpOp] -> Doc #

data ConvOp Source #

Conversion operators try to generalise the from t0 x to t1 instructions from LLVM.

Constructors

ZExt IntType IntType

Zero-extend the former integer type to the latter. If the new type is smaller, the result is a truncation.

SExt IntType IntType

Sign-extend the former integer type to the latter. If the new type is smaller, the result is a truncation.

FPConv FloatType FloatType

Convert value of the former floating-point type to the latter. If the new type is smaller, the result is a truncation.

FPToUI FloatType IntType

Convert a floating-point value to the nearest unsigned integer (rounding towards zero).

FPToSI FloatType IntType

Convert a floating-point value to the nearest signed integer (rounding towards zero).

UIToFP IntType FloatType

Convert an unsigned integer to a floating-point value.

SIToFP IntType FloatType

Convert a signed integer to a floating-point value.

IToB IntType

Convert an integer to a boolean value. Zero becomes false; anything else is true.

BToI IntType

Convert a boolean to an integer. True is converted to 1 and False to 0.

Instances
Eq ConvOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

(==) :: ConvOp -> ConvOp -> Bool #

(/=) :: ConvOp -> ConvOp -> Bool #

Ord ConvOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Show ConvOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Pretty ConvOp Source # 
Instance details

Defined in Futhark.Representation.Primitive

Methods

ppr :: ConvOp -> Doc #

pprPrec :: Int -> ConvOp -> Doc #

pprList :: [ConvOp] -> Doc #

data DimChange d Source #

The new dimension in a Reshape-like operation. This allows us to disambiguate "real" reshapes, that change the actual shape of the array, from type coercions that are just present to make the types work out. The two constructors are considered equal for purposes of Eq.

Constructors

DimCoercion d

The new dimension is guaranteed to be numerically equal to the old one.

DimNew d

The new dimension is not necessarily numerically equal to the old one.

Instances
Functor DimChange Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

fmap :: (a -> b) -> DimChange a -> DimChange b #

(<$) :: a -> DimChange b -> DimChange a #

Foldable DimChange Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

fold :: Monoid m => DimChange m -> m #

foldMap :: Monoid m => (a -> m) -> DimChange a -> m #

foldr :: (a -> b -> b) -> b -> DimChange a -> b #

foldr' :: (a -> b -> b) -> b -> DimChange a -> b #

foldl :: (b -> a -> b) -> b -> DimChange a -> b #

foldl' :: (b -> a -> b) -> b -> DimChange a -> b #

foldr1 :: (a -> a -> a) -> DimChange a -> a #

foldl1 :: (a -> a -> a) -> DimChange a -> a #

toList :: DimChange a -> [a] #

null :: DimChange a -> Bool #

length :: DimChange a -> Int #

elem :: Eq a => a -> DimChange a -> Bool #

maximum :: Ord a => DimChange a -> a #

minimum :: Ord a => DimChange a -> a #

sum :: Num a => DimChange a -> a #

product :: Num a => DimChange a -> a #

Traversable DimChange Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> DimChange a -> f (DimChange b) #

sequenceA :: Applicative f => DimChange (f a) -> f (DimChange a) #

mapM :: Monad m => (a -> m b) -> DimChange a -> m (DimChange b) #

sequence :: Monad m => DimChange (m a) -> m (DimChange a) #

Eq d => Eq (DimChange d) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: DimChange d -> DimChange d -> Bool #

(/=) :: DimChange d -> DimChange d -> Bool #

Ord d => Ord (DimChange d) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Show d => Show (DimChange d) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Pretty d => Pretty (DimChange d) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: DimChange d -> Doc #

pprPrec :: Int -> DimChange d -> Doc #

pprList :: [DimChange d] -> Doc #

FreeIn d => FreeIn (DimChange d) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: DimChange d -> Names Source #

Substitute d => Substitute (DimChange d) Source # 
Instance details

Defined in Futhark.Transform.Substitute

type ShapeChange d = [DimChange d] Source #

A list of DimChanges, indicating the new dimensions of an array.

data ExpT lore Source #

The root Futhark expression type. The ExpT constructor contains a lore-specific operation. Do-loops, branches and function calls are special. Everything else is a simple BasicOp.

Constructors

BasicOp (BasicOp lore)

A simple (non-recursive) operation.

Apply Name [(SubExp, Diet)] [RetType lore] (Safety, SrcLoc, [SrcLoc]) 
If SubExp (BodyT lore) (BodyT lore) (IfAttr (BranchType lore)) 
DoLoop [(FParam lore, SubExp)] [(FParam lore, SubExp)] (LoopForm lore) (BodyT lore)

loop {a} = {v} (for i < n|while b) do b. The merge parameters are divided into context and value part.

Op (Op lore) 
Instances
Annotations lore => Eq (ExpT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: ExpT lore -> ExpT lore -> Bool #

(/=) :: ExpT lore -> ExpT lore -> Bool #

Annotations lore => Ord (ExpT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: ExpT lore -> ExpT lore -> Ordering #

(<) :: ExpT lore -> ExpT lore -> Bool #

(<=) :: ExpT lore -> ExpT lore -> Bool #

(>) :: ExpT lore -> ExpT lore -> Bool #

(>=) :: ExpT lore -> ExpT lore -> Bool #

max :: ExpT lore -> ExpT lore -> ExpT lore #

min :: ExpT lore -> ExpT lore -> ExpT lore #

Annotations lore => Show (ExpT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> ExpT lore -> ShowS #

show :: ExpT lore -> String #

showList :: [ExpT lore] -> ShowS #

PrettyLore lore => Pretty (Exp lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Exp lore -> Doc #

pprPrec :: Int -> Exp lore -> Doc #

pprList :: [Exp lore] -> Doc #

Substitutable lore => Substitute (Exp lore) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Exp lore -> Exp lore Source #

Renameable lore => Rename (Exp lore) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Exp lore -> RenameM (Exp lore) Source #

type Exp = ExpT Source #

A type alias for namespace control.

data LoopForm lore Source #

For-loop or while-loop?

Instances
Scoped lore (LoopForm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Scope

Methods

scopeOf :: LoopForm lore -> Scope lore Source #

Annotations lore => Eq (LoopForm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: LoopForm lore -> LoopForm lore -> Bool #

(/=) :: LoopForm lore -> LoopForm lore -> Bool #

Annotations lore => Ord (LoopForm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: LoopForm lore -> LoopForm lore -> Ordering #

(<) :: LoopForm lore -> LoopForm lore -> Bool #

(<=) :: LoopForm lore -> LoopForm lore -> Bool #

(>) :: LoopForm lore -> LoopForm lore -> Bool #

(>=) :: LoopForm lore -> LoopForm lore -> Bool #

max :: LoopForm lore -> LoopForm lore -> LoopForm lore #

min :: LoopForm lore -> LoopForm lore -> LoopForm lore #

Annotations lore => Show (LoopForm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> LoopForm lore -> ShowS #

show :: LoopForm lore -> String #

showList :: [LoopForm lore] -> ShowS #

FreeIn (LParamAttr lore) => FreeIn (LoopForm lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: LoopForm lore -> Names Source #

data IfAttr rt Source #

Data associated with a branch.

Constructors

IfAttr 

Fields

Instances
Eq rt => Eq (IfAttr rt) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: IfAttr rt -> IfAttr rt -> Bool #

(/=) :: IfAttr rt -> IfAttr rt -> Bool #

Ord rt => Ord (IfAttr rt) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: IfAttr rt -> IfAttr rt -> Ordering #

(<) :: IfAttr rt -> IfAttr rt -> Bool #

(<=) :: IfAttr rt -> IfAttr rt -> Bool #

(>) :: IfAttr rt -> IfAttr rt -> Bool #

(>=) :: IfAttr rt -> IfAttr rt -> Bool #

max :: IfAttr rt -> IfAttr rt -> IfAttr rt #

min :: IfAttr rt -> IfAttr rt -> IfAttr rt #

Show rt => Show (IfAttr rt) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> IfAttr rt -> ShowS #

show :: IfAttr rt -> String #

showList :: [IfAttr rt] -> ShowS #

FreeIn a => FreeIn (IfAttr a) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: IfAttr a -> Names Source #

data IfSort Source #

Constructors

IfNormal

An ordinary branch.

IfFallback

A branch where the "true" case is what we are actually interested in, and the "false" case is only present as a fallback for when the true case cannot be safely evaluated. the compiler is permitted to optimise away the branch if the true case contains only safe statements.

Instances
Eq IfSort Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: IfSort -> IfSort -> Bool #

(/=) :: IfSort -> IfSort -> Bool #

Ord IfSort Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Show IfSort Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

data Safety Source #

Whether something is safe or unsafe (mostly function calls, and in the context of whether operations are dynamically checked). When we inline an Unsafe function, we remove all safety checks in its body. The Ord instance picks Unsafe as being less than Safe.

Constructors

Unsafe 
Safe 
Instances
Eq Safety Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: Safety -> Safety -> Bool #

(/=) :: Safety -> Safety -> Bool #

Ord Safety Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Show Safety Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

data LambdaT lore Source #

Anonymous function for use in a SOAC.

Constructors

Lambda 

Fields

Instances
Scoped lore (Lambda lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Scope

Methods

scopeOf :: Lambda lore -> Scope lore Source #

Annotations lore => Eq (LambdaT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: LambdaT lore -> LambdaT lore -> Bool #

(/=) :: LambdaT lore -> LambdaT lore -> Bool #

Annotations lore => Ord (LambdaT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: LambdaT lore -> LambdaT lore -> Ordering #

(<) :: LambdaT lore -> LambdaT lore -> Bool #

(<=) :: LambdaT lore -> LambdaT lore -> Bool #

(>) :: LambdaT lore -> LambdaT lore -> Bool #

(>=) :: LambdaT lore -> LambdaT lore -> Bool #

max :: LambdaT lore -> LambdaT lore -> LambdaT lore #

min :: LambdaT lore -> LambdaT lore -> LambdaT lore #

Annotations lore => Show (LambdaT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> LambdaT lore -> ShowS #

show :: LambdaT lore -> String #

showList :: [LambdaT lore] -> ShowS #

PrettyLore lore => Pretty (Lambda lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Lambda lore -> Doc #

pprPrec :: Int -> Lambda lore -> Doc #

pprList :: [Lambda lore] -> Doc #

Substitutable lore => Substitute (Lambda lore) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Lambda lore -> Lambda lore Source #

Renameable lore => Rename (Lambda lore) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Lambda lore -> RenameM (Lambda lore) Source #

type Lambda = LambdaT Source #

Type alias for namespacing reasons.

Definitions

data ParamT attr Source #

A function parameter.

Constructors

Param 

Fields

Instances
Functor ParamT Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

fmap :: (a -> b) -> ParamT a -> ParamT b #

(<$) :: a -> ParamT b -> ParamT a #

Foldable ParamT Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

fold :: Monoid m => ParamT m -> m #

foldMap :: Monoid m => (a -> m) -> ParamT a -> m #

foldr :: (a -> b -> b) -> b -> ParamT a -> b #

foldr' :: (a -> b -> b) -> b -> ParamT a -> b #

foldl :: (b -> a -> b) -> b -> ParamT a -> b #

foldl' :: (b -> a -> b) -> b -> ParamT a -> b #

foldr1 :: (a -> a -> a) -> ParamT a -> a #

foldl1 :: (a -> a -> a) -> ParamT a -> a #

toList :: ParamT a -> [a] #

null :: ParamT a -> Bool #

length :: ParamT a -> Int #

elem :: Eq a => a -> ParamT a -> Bool #

maximum :: Ord a => ParamT a -> a #

minimum :: Ord a => ParamT a -> a #

sum :: Num a => ParamT a -> a #

product :: Num a => ParamT a -> a #

Traversable ParamT Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

traverse :: Applicative f => (a -> f b) -> ParamT a -> f (ParamT b) #

sequenceA :: Applicative f => ParamT (f a) -> f (ParamT a) #

mapM :: Monad m => (a -> m b) -> ParamT a -> m (ParamT b) #

sequence :: Monad m => ParamT (m a) -> m (ParamT a) #

Eq attr => Eq (ParamT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

(==) :: ParamT attr -> ParamT attr -> Bool #

(/=) :: ParamT attr -> ParamT attr -> Bool #

Ord attr => Ord (ParamT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

compare :: ParamT attr -> ParamT attr -> Ordering #

(<) :: ParamT attr -> ParamT attr -> Bool #

(<=) :: ParamT attr -> ParamT attr -> Bool #

(>) :: ParamT attr -> ParamT attr -> Bool #

(>=) :: ParamT attr -> ParamT attr -> Bool #

max :: ParamT attr -> ParamT attr -> ParamT attr #

min :: ParamT attr -> ParamT attr -> ParamT attr #

Show attr => Show (ParamT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax.Core

Methods

showsPrec :: Int -> ParamT attr -> ShowS #

show :: ParamT attr -> String #

showList :: [ParamT attr] -> ShowS #

Pretty (Param (MemInfo SubExp Uniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (Param (MemInfo SubExp NoUniqueness ret)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Pretty (ParamT b) => Pretty (ParamT (a, b)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ParamT (a, b) -> Doc #

pprPrec :: Int -> ParamT (a, b) -> Doc #

pprList :: [ParamT (a, b)] -> Doc #

Pretty (ParamT DeclType) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Pretty (ParamT Type) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: ParamT Type -> Doc #

pprPrec :: Int -> ParamT Type -> Doc #

pprList :: [ParamT Type] -> Doc #

DeclTyped attr => DeclTyped (Param attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

declTypeOf :: Param attr -> DeclType Source #

Typed attr => Typed (Param attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Types

Methods

typeOf :: Param attr -> Type Source #

PrettyAnnot (ParamT (TypeBase shape u)) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppAnnot :: ParamT (TypeBase shape u) -> Maybe Doc Source #

(Pretty u, Pretty r) => PrettyAnnot (ParamT (MemInfo SubExp u r)) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

FreeIn attr => FreeIn (ParamT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Names

Methods

freeIn :: ParamT attr -> Names Source #

Substitute attr => Substitute (ParamT attr) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> ParamT attr -> ParamT attr Source #

Rename attr => Rename (ParamT attr) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: ParamT attr -> RenameM (ParamT attr) Source #

type FParam lore = ParamT (FParamAttr lore) Source #

type LParam lore = ParamT (LParamAttr lore) Source #

data FunDefT lore Source #

Function Declarations

Constructors

FunDef 

Fields

Instances
Scoped lore (FunDef lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Scope

Methods

scopeOf :: FunDef lore -> Scope lore Source #

Annotations lore => Eq (FunDefT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: FunDefT lore -> FunDefT lore -> Bool #

(/=) :: FunDefT lore -> FunDefT lore -> Bool #

Annotations lore => Ord (FunDefT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: FunDefT lore -> FunDefT lore -> Ordering #

(<) :: FunDefT lore -> FunDefT lore -> Bool #

(<=) :: FunDefT lore -> FunDefT lore -> Bool #

(>) :: FunDefT lore -> FunDefT lore -> Bool #

(>=) :: FunDefT lore -> FunDefT lore -> Bool #

max :: FunDefT lore -> FunDefT lore -> FunDefT lore #

min :: FunDefT lore -> FunDefT lore -> FunDefT lore #

Annotations lore => Show (FunDefT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> FunDefT lore -> ShowS #

show :: FunDefT lore -> String #

showList :: [FunDefT lore] -> ShowS #

PrettyLore lore => Pretty (FunDef lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: FunDef lore -> Doc #

pprPrec :: Int -> FunDef lore -> Doc #

pprList :: [FunDef lore] -> Doc #

Renameable lore => Rename (FunDef lore) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: FunDef lore -> RenameM (FunDef lore) Source #

type FunDef = FunDefT Source #

Type alias for namespace reasons.

type EntryPoint = ([EntryPointType], [EntryPointType]) Source #

Information about the parameters and return value of an entry point. The first element is for parameters, the second for return value.

data EntryPointType Source #

Every entry point argument and return value has an annotation indicating how it maps to the original source program type.

Constructors

TypeUnsigned

Is an unsigned integer or array of unsigned integers.

TypeOpaque String Int

A black box type comprising this many core values. The string is a human-readable description with no other semantics.

TypeDirect

Maps directly.

newtype ProgT lore Source #

An entire Futhark program.

Constructors

Prog 

Fields

Instances
Annotations lore => Eq (ProgT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

(==) :: ProgT lore -> ProgT lore -> Bool #

(/=) :: ProgT lore -> ProgT lore -> Bool #

Annotations lore => Ord (ProgT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

compare :: ProgT lore -> ProgT lore -> Ordering #

(<) :: ProgT lore -> ProgT lore -> Bool #

(<=) :: ProgT lore -> ProgT lore -> Bool #

(>) :: ProgT lore -> ProgT lore -> Bool #

(>=) :: ProgT lore -> ProgT lore -> Bool #

max :: ProgT lore -> ProgT lore -> ProgT lore #

min :: ProgT lore -> ProgT lore -> ProgT lore #

Annotations lore => Show (ProgT lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Syntax

Methods

showsPrec :: Int -> ProgT lore -> ShowS #

show :: ProgT lore -> String #

showList :: [ProgT lore] -> ShowS #

PrettyLore lore => Pretty (Prog lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Pretty

Methods

ppr :: Prog lore -> Doc #

pprPrec :: Int -> Prog lore -> Doc #

pprList :: [Prog lore] -> Doc #

type Prog = ProgT Source #

Type alias for namespace reasons.

Utils

oneStm :: Stm lore -> Stms lore Source #

stmsFromList :: [Stm lore] -> Stms lore Source #

stmsToList :: Stms lore -> [Stm lore] Source #

stmsHead :: Stms lore -> Maybe (Stm lore, Stms lore) Source #