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

Futhark.IR.Syntax

Description

Definition of the Futhark core language IR

For actually constructing ASTs, see Futhark.Construct.

Types and values

The core language type system is much more restricted than the core language. This is a theme that repeats often. The only types that are supported in the core language are various primitive types PrimType which can be combined in arrays (ignore Mem and Acc for now). Types are represented as TypeBase, which is parameterised by the shape of the array and whether we keep uniqueness information. The Type alias, which is the most commonly used, uses Shape and NoUniqueness.

This means that the records, tuples, and sum types of the source language are represented merely as collections of primitives and arrays. This is implemented in Futhark.Internalise, but the specifics are not important for writing passes on the core language. What is important is that many constructs that conceptually return tuples instead return multiple values. This is not merely syntactic sugar for a tuple: each of those values are eventually bound to distinct variables. The prettyprinter for the IR will typically print such collections of values or types in curly braces.

The system of primitive types is interesting in itself. See Language.Futhark.Primitive.

Overall AST design

Internally, the Futhark compiler core intermediate representation resembles a traditional compiler for an imperative language more than it resembles, say, a Haskell or ML compiler. All functions are monomorphic (except for sizes), first-order, and defined at the top level. Notably, the IR does not use continuation-passing style (CPS) at any time. Instead it uses Administrative Normal Form (ANF), where all subexpressions SubExp are either constants PrimValue or variables VName. Variables are represented as a human-readable Name (which doesn't matter to the compiler) as well as a numeric tag, which is what the compiler actually looks at. All variable names when prettyprinted are of the form foo_123. Function names are just Names, though.

The body of a function (FunDef) is a Body, which consists of a sequence of statements (Stms) and a Result. Execution of a Body consists of executing all of the statements, then returning the values of the variables indicated by the result.

A statement (Stm) consists of a Pat alongside an expression Exp. A pattern is a sequence of name/type pairs.

For example, the source language expression let z = x + y - 1 in z would in the core language be represented (in prettyprinted form) as something like:

let {a_12} = x_10 + y_11
let {b_13} = a_12 - 1
in {b_13}

Representations

Most AST types (Stm, Exp, Prog, etc) are parameterised by a type parameter rep. The representation specifies how to fill out various polymorphic parts of the AST. For example, Exp has a constructor Op whose payload depends on rep, via the use of a type family called Op (a kind of type-level function) which is applied to the rep. The SOACS representation (Futhark.IR.SOACS) thus uses a rep called SOACS, and defines that Op SOACS is a SOAC, while the Kernels representation (Futhark.IR.Kernels) defines Op Kernels as some kind of kernel construct. Similarly, various other decorations (e.g. what information we store in a PatElem) are also type families.

The full list of possible decorations is defined as part of the type class RepTypes (although other type families are also used elsewhere in the compiler on an ad hoc basis).

Essentially, the rep type parameter functions as a kind of proxy, saving us from having to parameterise the AST type with all the different forms of decorations that we desire (it would easily become a type with a dozen type parameters).

Some AST elements (such as Pat) do not take a rep type parameter, but instead immediately the single type of decoration that they contain. We only use the more complicated machinery when needed.

Defining a new representation (or rep) thus requires you to define an empty datatype and implement a handful of type class instances for it. See the source of Futhark.IR.Seq for what is likely the simplest example.

Synopsis

Documentation

prettyString :: Pretty a => a -> String Source #

Prettyprint a value to a String, appropriately wrapped.

prettyStringOneLine :: Pretty a => a -> String Source #

Prettyprint a value to a String on a single line.

prettyText :: Pretty a => a -> Text Source #

Prettyprint a value to a Text, appropriately wrapped.

prettyTextOneLine :: Pretty a => a -> Text Source #

Prettyprint a value to a Text on a single line.

class Pretty a Source #

Overloaded conversion to Doc.

Laws:

  1. output should be pretty. :-)

Minimal complete definition

pretty

Instances

Instances details
Pretty BodyType Source # 
Instance details

Defined in Futhark.Analysis.AccessPattern

Methods

pretty :: BodyType -> Doc ann Source #

prettyList :: [BodyType] -> Doc ann Source #

Pretty SegOpName Source # 
Instance details

Defined in Futhark.Analysis.AccessPattern

Methods

pretty :: SegOpName -> Doc ann Source #

prettyList :: [SegOpName] -> Doc ann Source #

Pretty VarType Source # 
Instance details

Defined in Futhark.Analysis.AccessPattern

Methods

pretty :: VarType -> Doc ann Source #

prettyList :: [VarType] -> Doc ann Source #

Pretty CallGraph Source # 
Instance details

Defined in Futhark.Analysis.CallGraph

Methods

pretty :: CallGraph -> Doc ann Source #

prettyList :: [CallGraph] -> Doc ann Source #

Pretty ArrayTransform Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Pretty Input Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Methods

pretty :: Input -> Doc ann Source #

prettyList :: [Input] -> Doc ann Source #

Pretty MemAliases Source # 
Instance details

Defined in Futhark.Analysis.MemAlias

Pretty PyArg Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyArg -> Doc ann Source #

prettyList :: [PyArg] -> Doc ann Source #

Pretty PyClassDef Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Pretty PyExcept Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyExcept -> Doc ann Source #

prettyList :: [PyExcept] -> Doc ann Source #

Pretty PyExp Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyExp -> Doc ann Source #

prettyList :: [PyExp] -> Doc ann Source #

Pretty PyFunDef Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyFunDef -> Doc ann Source #

prettyList :: [PyFunDef] -> Doc ann Source #

Pretty PyIdx Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyIdx -> Doc ann Source #

prettyList :: [PyIdx] -> Doc ann Source #

Pretty PyProg Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyProg -> Doc ann Source #

prettyList :: [PyProg] -> Doc ann Source #

Pretty PyStmt Source # 
Instance details

Defined in Futhark.CodeGen.Backends.GenericPython.AST

Methods

pretty :: PyStmt -> Doc ann Source #

prettyList :: [PyStmt] -> Doc ann Source #

Pretty Arg Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Arg -> Doc ann Source #

prettyList :: [Arg] -> Doc ann Source #

Pretty ArrayContents Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty EntryPoint Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty ExternalValue Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Pretty Param Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Param -> Doc ann Source #

prettyList :: [Param] -> Doc ann Source #

Pretty ValueDesc Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: ValueDesc -> Doc ann Source #

prettyList :: [ValueDesc] -> Doc ann Source #

Pretty HostOp Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: HostOp -> Doc ann Source #

prettyList :: [HostOp] -> Doc ann Source #

Pretty Kernel Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: Kernel -> Doc ann Source #

prettyList :: [Kernel] -> Doc ann Source #

Pretty KernelConst Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Pretty KernelOp Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: KernelOp -> Doc ann Source #

prettyList :: [KernelOp] -> Doc ann Source #

Pretty KernelUse Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.GPU

Methods

pretty :: KernelUse -> Doc ann Source #

prettyList :: [KernelUse] -> Doc ann Source #

Pretty Multicore Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Methods

pretty :: Multicore -> Doc ann Source #

prettyList :: [Multicore] -> Doc ann Source #

Pretty ParallelTask Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty SchedulerInfo Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty Scheduling Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Multicore

Pretty OpenCL Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.OpenCL

Methods

pretty :: OpenCL -> Doc ann Source #

prettyList :: [OpenCL] -> Doc ann Source #

Pretty Sequential Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode.Sequential

Pretty DeviceInfo Source # 
Instance details

Defined in Futhark.CodeGen.OpenCL.Heuristics

Pretty AliasDec Source # 
Instance details

Defined in Futhark.IR.Aliases

Methods

pretty :: AliasDec -> Doc ann Source #

prettyList :: [AliasDec] -> Doc ann Source #

Pretty KernelGrid Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Pretty SegLevel Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegLevel -> Doc ann Source #

prettyList :: [SegLevel] -> Doc ann Source #

Pretty SegVirt Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SegVirt -> Doc ann Source #

prettyList :: [SegVirt] -> Doc ann Source #

Pretty SizeOp Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: SizeOp -> Doc ann Source #

prettyList :: [SizeOp] -> Doc ann Source #

Pretty SizeClass Source # 
Instance details

Defined in Futhark.IR.GPU.Sizes

Methods

pretty :: SizeClass -> Doc ann Source #

prettyList :: [SizeClass] -> Doc ann Source #

Pretty MemBind Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemBind -> Doc ann Source #

prettyList :: [MemBind] -> Doc ann Source #

Pretty MemReturn Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemReturn -> Doc ann Source #

prettyList :: [MemReturn] -> Doc ann Source #

Pretty Names Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

pretty :: Names -> Doc ann Source #

prettyList :: [Names] -> Doc ann Source #

Pretty KernelResult Source # 
Instance details

Defined in Futhark.IR.SegOp

Pretty SegSpace Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegSpace -> Doc ann Source #

prettyList :: [SegSpace] -> Doc ann Source #

Pretty BasicOp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: BasicOp -> Doc ann Source #

prettyList :: [BasicOp] -> Doc ann Source #

Pretty EntryParam Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty EntryResult Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty SubExpRes Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExpRes -> Doc ann Source #

prettyList :: [SubExpRes] -> Doc ann Source #

Pretty Attr Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Attr -> Doc ann Source #

prettyList :: [Attr] -> Doc ann Source #

Pretty Attrs Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Attrs -> Doc ann Source #

prettyList :: [Attrs] -> Doc ann Source #

Pretty Certs Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Certs -> Doc ann Source #

prettyList :: [Certs] -> Doc ann Source #

Pretty Commutativity Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty EntryPointType Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Ident Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ident -> Doc ann Source #

prettyList :: [Ident] -> Doc ann Source #

Pretty OpaqueType Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty OpaqueTypes Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Provenance Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Rank Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Rank -> Doc ann Source #

prettyList :: [Rank] -> Doc ann Source #

Pretty Signedness Source # 
Instance details

Defined in Futhark.IR.Pretty

Pretty Space Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Space -> Doc ann Source #

prettyList :: [Space] -> Doc ann Source #

Pretty SubExp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExp -> Doc ann Source #

prettyList :: [SubExp] -> Doc ann Source #

Pretty ValueType Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ValueType -> Doc ann Source #

prettyList :: [ValueType] -> Doc ann Source #

Pretty AccessSummary Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty ArrayMemBound Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty Coalesced Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: Coalesced -> Doc ann Source #

prettyList :: [Coalesced] -> Doc ann Source #

Pretty CoalescedKind Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty CoalsEntry Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Pretty CoalsTab Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: CoalsTab -> Doc ann Source #

prettyList :: [CoalsTab] -> Doc ann Source #

Pretty MemRefs Source # 
Instance details

Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs

Methods

pretty :: MemRefs -> Doc ann Source #

prettyList :: [MemRefs] -> Doc ann Source #

Pretty VarWisdom Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Rep

Methods

pretty :: VarWisdom -> Doc ann Source #

prettyList :: [VarWisdom] -> Doc ann Source #

Pretty Exp Source # 
Instance details

Defined in Futhark.Script

Methods

pretty :: Exp -> Doc ann Source #

prettyList :: [Exp] -> Doc ann Source #

Pretty Func Source # 
Instance details

Defined in Futhark.Script

Methods

pretty :: Func -> Doc ann Source #

prettyList :: [Func] -> Doc ann Source #

Pretty ScriptValueType Source # 
Instance details

Defined in Futhark.Script

Pretty Name Source # 
Instance details

Defined in Language.Futhark.Core

Methods

pretty :: Name -> Doc ann Source #

prettyList :: [Name] -> Doc ann Source #

Pretty NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty VName Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: VName -> Doc ann Source #

prettyList :: [VName] -> Doc ann Source #

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

Pretty CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: CmpOp -> Doc ann Source #

prettyList :: [CmpOp] -> Doc ann Source #

Pretty ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: ConvOp -> Doc ann Source #

prettyList :: [ConvOp] -> Doc ann Source #

Pretty FloatType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: FloatType -> Doc ann Source #

prettyList :: [FloatType] -> Doc ann Source #

Pretty FloatValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Pretty IntType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: IntType -> Doc ann Source #

prettyList :: [IntType] -> Doc ann Source #

Pretty IntValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: IntValue -> Doc ann Source #

prettyList :: [IntValue] -> Doc ann Source #

Pretty PrimType Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: PrimType -> Doc ann Source #

prettyList :: [PrimType] -> Doc ann Source #

Pretty PrimValue Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: PrimValue -> Doc ann Source #

prettyList :: [PrimValue] -> Doc ann Source #

Pretty UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: UnOp -> Doc ann Source #

prettyList :: [UnOp] -> Doc ann Source #

Pretty Env Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Env -> Doc ann Source #

prettyList :: [Env] -> Doc ann Source #

Pretty MTy Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: MTy -> Doc ann Source #

prettyList :: [MTy] -> Doc ann Source #

Pretty Mod Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Mod -> Doc ann Source #

prettyList :: [Mod] -> Doc ann Source #

Pretty Namespace Source # 
Instance details

Defined in Language.Futhark.Semantic

Methods

pretty :: Namespace -> Doc ann Source #

prettyList :: [Namespace] -> Doc ann Source #

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Syntax

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

Pretty Diet Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Diet -> Doc ann Source #

prettyList :: [Diet] -> Doc ann Source #

Pretty Liftedness Source # 
Instance details

Defined in Language.Futhark.Pretty

Pretty PatLit Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PatLit -> Doc ann Source #

prettyList :: [PatLit] -> Doc ann Source #

Pretty PrimType Source # 
Instance details

Defined in Language.Futhark.Syntax

Methods

pretty :: PrimType -> Doc ann Source #

prettyList :: [PrimType] -> Doc ann Source #

Pretty PrimValue Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PrimValue -> Doc ann Source #

prettyList :: [PrimValue] -> Doc ann Source #

Pretty Notes Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Monad

Methods

pretty :: Notes -> Doc ann Source #

prettyList :: [Notes] -> Doc ann Source #

Pretty Checking Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Terms.Monad

Methods

pretty :: Checking -> Doc ann Source #

prettyList :: [Checking] -> Doc ann Source #

Pretty BreadCrumbs Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Unify

Pretty Usage Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Unify

Methods

pretty :: Usage -> Doc ann Source #

prettyList :: [Usage] -> Doc ann Source #

Pretty Value Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: Value -> Doc ann Source #

prettyList :: [Value] -> Doc ann Source #

Pretty ValueType Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: ValueType -> Doc ann Source #

prettyList :: [ValueType] -> Doc ann Source #

Pretty Void

Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.

>>> pretty ([] :: [Void])
[]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Void -> Doc ann Source #

prettyList :: [Void] -> Doc ann Source #

Pretty Int16 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int16 -> Doc ann Source #

prettyList :: [Int16] -> Doc ann Source #

Pretty Int32 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int32 -> Doc ann Source #

prettyList :: [Int32] -> Doc ann Source #

Pretty Int64 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int64 -> Doc ann Source #

prettyList :: [Int64] -> Doc ann Source #

Pretty Int8 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int8 -> Doc ann Source #

prettyList :: [Int8] -> Doc ann Source #

Pretty Word16 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word16 -> Doc ann Source #

prettyList :: [Word16] -> Doc ann Source #

Pretty Word32 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word32 -> Doc ann Source #

prettyList :: [Word32] -> Doc ann Source #

Pretty Word64 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word64 -> Doc ann Source #

prettyList :: [Word64] -> Doc ann Source #

Pretty Word8 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word8 -> Doc ann Source #

prettyList :: [Word8] -> Doc ann Source #

Pretty Half Source # 
Instance details

Defined in Futhark.Util.Pretty

Methods

pretty :: Half -> Doc ann Source #

prettyList :: [Half] -> Doc ann Source #

Pretty Text

Automatically converts all newlines to line.

>>> pretty ("hello\nworld" :: Text)
hello
world

Note that line can be undone by group:

>>> group (pretty ("hello\nworld" :: Text))
hello world

Manually use hardline if you definitely want newlines.

Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Text -> Doc ann Source #

prettyList :: [Text] -> Doc ann Source #

Pretty Text

(lazy Text instance, identical to the strict version)

Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Text -> Doc ann Source #

prettyList :: [Text] -> Doc ann Source #

Pretty Integer
>>> pretty (2^123 :: Integer)
10633823966279326983230456482242756608
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Integer -> Doc ann Source #

prettyList :: [Integer] -> Doc ann Source #

Pretty Natural 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Natural -> Doc ann Source #

prettyList :: [Natural] -> Doc ann Source #

Pretty ()
>>> pretty ()
()

The argument is not used:

>>> pretty (error "Strict?" :: ())
()
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: () -> Doc ann Source #

prettyList :: [()] -> Doc ann Source #

Pretty Bool
>>> pretty True
True
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Bool -> Doc ann Source #

prettyList :: [Bool] -> Doc ann Source #

Pretty Char

Instead of (pretty 'n'), consider using line as a more readable alternative.

>>> pretty 'f' <> pretty 'o' <> pretty 'o'
foo
>>> pretty ("string" :: String)
string
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Char -> Doc ann Source #

prettyList :: [Char] -> Doc ann Source #

Pretty Double
>>> pretty (exp 1 :: Double)
2.71828182845904...
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Double -> Doc ann Source #

prettyList :: [Double] -> Doc ann Source #

Pretty Float
>>> pretty (pi :: Float)
3.1415927
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Float -> Doc ann Source #

prettyList :: [Float] -> Doc ann Source #

Pretty Int
>>> pretty (123 :: Int)
123
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Int -> Doc ann Source #

prettyList :: [Int] -> Doc ann Source #

Pretty Word 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Word -> Doc ann Source #

prettyList :: [Word] -> Doc ann Source #

PrettyRep rep => Pretty (SOAC rep) Source # 
Instance details

Defined in Futhark.Analysis.HORep.SOAC

Methods

pretty :: SOAC rep -> Doc ann Source #

prettyList :: [SOAC rep] -> Doc ann Source #

Pretty v => Pretty (PrimExp v) Source # 
Instance details

Defined in Futhark.Analysis.PrimExp

Methods

pretty :: PrimExp v -> Doc ann Source #

prettyList :: [PrimExp v] -> Doc ann Source #

Pretty op => Pretty (Code op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Code op -> Doc ann Source #

prettyList :: [Code op] -> Doc ann Source #

Pretty op => Pretty (Constants op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Constants op -> Doc ann Source #

prettyList :: [Constants op] -> Doc ann Source #

Pretty op => Pretty (Definitions op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Definitions op -> Doc ann Source #

prettyList :: [Definitions op] -> Doc ann Source #

Pretty op => Pretty (FunctionT op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: FunctionT op -> Doc ann Source #

prettyList :: [FunctionT op] -> Doc ann Source #

Pretty op => Pretty (Functions op) Source # 
Instance details

Defined in Futhark.CodeGen.ImpCode

Methods

pretty :: Functions op -> Doc ann Source #

prettyList :: [Functions op] -> Doc ann Source #

Pretty num => Pretty (LMAD num) Source # 
Instance details

Defined in Futhark.IR.Mem.LMAD

Methods

pretty :: LMAD num -> Doc ann Source #

prettyList :: [LMAD num] -> Doc ann Source #

PrettyRep rep => Pretty (Reduce rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: Reduce rep -> Doc ann Source #

prettyList :: [Reduce rep] -> Doc ann Source #

PrettyRep rep => Pretty (SOAC rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: SOAC rep -> Doc ann Source #

prettyList :: [SOAC rep] -> Doc ann Source #

PrettyRep rep => Pretty (Scan rep) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

pretty :: Scan rep -> Doc ann Source #

prettyList :: [Scan rep] -> Doc ann Source #

PrettyRep rep => Pretty (KernelBody rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: KernelBody rep -> Doc ann Source #

prettyList :: [KernelBody rep] -> Doc ann Source #

PrettyRep rep => Pretty (SegBinOp rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegBinOp rep -> Doc ann Source #

prettyList :: [SegBinOp rep] -> Doc ann Source #

PrettyRep rep => Pretty (Body rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Body rep -> Doc ann Source #

prettyList :: [Body rep] -> Doc ann Source #

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: DimSplice d -> Doc ann Source #

prettyList :: [DimSplice d] -> Doc ann Source #

PrettyRep rep => Pretty (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Exp rep -> Doc ann Source #

prettyList :: [Exp rep] -> Doc ann Source #

PrettyRep rep => Pretty (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FunDef rep -> Doc ann Source #

prettyList :: [FunDef rep] -> Doc ann Source #

PrettyRep rep => Pretty (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Lambda rep -> Doc ann Source #

prettyList :: [Lambda rep] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: NewShape d -> Doc ann Source #

prettyList :: [NewShape d] -> Doc ann Source #

Pretty t => Pretty (Pat t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Pat t -> Doc ann Source #

prettyList :: [Pat t] -> Doc ann Source #

PrettyRep rep => Pretty (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Prog rep -> Doc ann Source #

prettyList :: [Prog rep] -> Doc ann Source #

PrettyRep rep => Pretty (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stm rep -> Doc ann Source #

prettyList :: [Stm rep] -> Doc ann Source #

Pretty dec => Pretty (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: StmAux dec -> Doc ann Source #

prettyList :: [StmAux dec] -> Doc ann Source #

PrettyRep rep => Pretty (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stms rep -> Doc ann Source #

prettyList :: [Stms rep] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: DimIndex d -> Doc ann Source #

prettyList :: [DimIndex d] -> Doc ann Source #

Pretty a => Pretty (ErrorMsg a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: ErrorMsg a -> Doc ann Source #

prettyList :: [ErrorMsg a] -> Doc ann Source #

Pretty a => Pretty (Ext a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ext a -> Doc ann Source #

prettyList :: [Ext a] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: FlatDimIndex d -> Doc ann Source #

prettyList :: [FlatDimIndex d] -> Doc ann Source #

Pretty a => Pretty (FlatSlice a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FlatSlice a -> Doc ann Source #

prettyList :: [FlatSlice a] -> Doc ann Source #

Pretty t => Pretty (Param t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Param t -> Doc ann Source #

prettyList :: [Param t] -> Doc ann Source #

Pretty t => Pretty (PatElem t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: PatElem t -> Doc ann Source #

prettyList :: [PatElem t] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: ShapeBase d -> Doc ann Source #

prettyList :: [ShapeBase d] -> Doc ann Source #

Pretty a => Pretty (Slice a) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Slice a -> Doc ann Source #

prettyList :: [Slice a] -> Doc ann Source #

Pretty v => Pretty (Compound v) Source # 
Instance details

Defined in Futhark.Test.Values

Methods

pretty :: Compound v -> Doc ann Source #

prettyList :: [Compound v] -> Doc ann Source #

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

Defined in Language.Futhark.Interpreter.Values

Methods

pretty :: Shape d -> Doc ann Source #

prettyList :: [Shape d] -> Doc ann Source #

IsName vn => Pretty (QualName vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: QualName vn -> Doc ann Source #

prettyList :: [QualName vn] -> Doc ann Source #

Pretty (Shape Size) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Size -> Doc ann Source #

prettyList :: [Shape Size] -> Doc ann Source #

Pretty (Shape Int64) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Int64 -> Doc ann Source #

prettyList :: [Shape Int64] -> Doc ann Source #

Pretty (Shape ()) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape () -> Doc ann Source #

prettyList :: [Shape ()] -> Doc ann Source #

Pretty (Shape Bool) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: Shape Bool -> Doc ann Source #

prettyList :: [Shape Bool] -> Doc ann Source #

IsName vn => Pretty (SizeBinder vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: SizeBinder vn -> Doc ann Source #

prettyList :: [SizeBinder vn] -> Doc ann Source #

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

Defined in Language.Futhark.Pretty

Methods

pretty :: SizeExp d -> Doc ann Source #

prettyList :: [SizeExp d] -> Doc ann Source #

Pretty (TypeArg Size) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeArg Size -> Doc ann Source #

prettyList :: [TypeArg Size] -> Doc ann Source #

IsName vn => Pretty (TypeParamBase vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeParamBase vn -> Doc ann Source #

prettyList :: [TypeParamBase vn] -> Doc ann Source #

Pretty (Match t) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Match

Methods

pretty :: Match t -> Doc ann Source #

prettyList :: [Match t] -> Doc ann Source #

Pretty t => Pretty (Subst t) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Methods

pretty :: Subst t -> Doc ann Source #

prettyList :: [Subst t] -> Doc ann Source #

Pretty a => Pretty (NonEmpty a) 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: NonEmpty a -> Doc ann Source #

prettyList :: [NonEmpty a] -> Doc ann Source #

Pretty a => Pretty (Identity a)
>>> pretty (Identity 1)
1
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Identity a -> Doc ann Source #

prettyList :: [Identity a] -> Doc ann Source #

Pretty a => Pretty (Maybe a)

Ignore Nothings, print Just contents.

>>> pretty (Just True)
True
>>> braces (pretty (Nothing :: Maybe Bool))
{}
>>> pretty [Just 1, Nothing, Just 3, Nothing]
[1, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Maybe a -> Doc ann Source #

prettyList :: [Maybe a] -> Doc ann Source #

Pretty a => Pretty [a]
>>> pretty [1,2,3]
[1, 2, 3]
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: [a] -> Doc ann Source #

prettyList :: [[a]] -> Doc ann Source #

Pretty (DimAccess rep) Source # 
Instance details

Defined in Futhark.Analysis.AccessPattern

Methods

pretty :: DimAccess rep -> Doc ann Source #

prettyList :: [DimAccess rep] -> Doc ann Source #

Pretty (IndexTable rep) Source # 
Instance details

Defined in Futhark.Analysis.AccessPattern

Methods

pretty :: IndexTable rep -> Doc ann Source #

prettyList :: [IndexTable rep] -> Doc ann Source #

(PrettyRep rep, Pretty (op rep)) => Pretty (HostOp op rep) Source # 
Instance details

Defined in Futhark.IR.GPU.Op

Methods

pretty :: HostOp op rep -> Doc ann Source #

prettyList :: [HostOp op rep] -> Doc ann Source #

(PrettyRep rep, Pretty (op rep)) => Pretty (MCOp op rep) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

pretty :: MCOp op rep -> Doc ann Source #

prettyList :: [MCOp op rep] -> Doc ann Source #

Pretty (inner rep) => Pretty (MemOp inner rep) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemOp inner rep -> Doc ann Source #

prettyList :: [MemOp inner rep] -> Doc ann Source #

Pretty (NoOp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: NoOp rep -> Doc ann Source #

prettyList :: [NoOp rep] -> Doc ann Source #

(PrettyRep rep, Pretty lvl) => Pretty (SegOp lvl rep) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

pretty :: SegOp lvl rep -> Doc ann Source #

prettyList :: [SegOp lvl rep] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (AppExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AppExpBase f vn -> Doc ann Source #

prettyList :: [AppExpBase f vn] -> Doc ann Source #

IsName vn => Pretty (AttrAtom vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AttrAtom vn -> Doc ann Source #

prettyList :: [AttrAtom vn] -> Doc ann Source #

IsName vn => Pretty (AttrInfo vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: AttrInfo vn -> Doc ann Source #

prettyList :: [AttrInfo vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (CaseBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: CaseBase f vn -> Doc ann Source #

prettyList :: [CaseBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (DecBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: DecBase f vn -> Doc ann Source #

prettyList :: [DecBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (DimIndexBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: DimIndexBase f vn -> Doc ann Source #

prettyList :: [DimIndexBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ExpBase f vn -> Doc ann Source #

prettyList :: [ExpBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (FieldBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: FieldBase f vn -> Doc ann Source #

prettyList :: [FieldBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (LoopFormBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: LoopFormBase f vn -> Doc ann Source #

prettyList :: [LoopFormBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (LoopInitBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: LoopInitBase f vn -> Doc ann Source #

prettyList :: [LoopInitBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ModBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModBindBase f vn -> Doc ann Source #

prettyList :: [ModBindBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ModExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModExpBase f vn -> Doc ann Source #

prettyList :: [ModExpBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ModParamBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModParamBase f vn -> Doc ann Source #

prettyList :: [ModParamBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ModTypeBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModTypeBindBase f vn -> Doc ann Source #

prettyList :: [ModTypeBindBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ModTypeExpBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ModTypeExpBase f vn -> Doc ann Source #

prettyList :: [ModTypeExpBase f vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ProgBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ProgBase f vn -> Doc ann Source #

prettyList :: [ProgBase f vn] -> Doc ann Source #

(Pretty (Shape dim), Pretty u) => Pretty (RetTypeBase dim u) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: RetTypeBase dim u -> Doc ann Source #

prettyList :: [RetTypeBase dim u] -> Doc ann Source #

(Pretty (Shape dim), Pretty u) => Pretty (ScalarTypeBase dim u) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ScalarTypeBase dim u -> Doc ann Source #

prettyList :: [ScalarTypeBase dim u] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (SpecBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: SpecBase f vn -> Doc ann Source #

prettyList :: [SpecBase f vn] -> Doc ann Source #

(Pretty d, IsName vn) => Pretty (TypeArgExp d vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeArgExp d vn -> Doc ann Source #

prettyList :: [TypeArgExp d vn] -> Doc ann Source #

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

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeBase dim u -> Doc ann Source #

prettyList :: [TypeBase dim u] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (TypeBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeBindBase f vn -> Doc ann Source #

prettyList :: [TypeBindBase f vn] -> Doc ann Source #

(IsName vn, Pretty d) => Pretty (TypeExp d vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: TypeExp d vn -> Doc ann Source #

prettyList :: [TypeExp d vn] -> Doc ann Source #

(IsName vn, Annot f) => Pretty (ValBindBase f vn) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: ValBindBase f vn -> Doc ann Source #

prettyList :: [ValBindBase f vn] -> Doc ann Source #

(Pretty a1, Pretty a2) => Pretty (a1, a2)
>>> pretty (123, "hello")
(123, hello)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: (a1, a2) -> Doc ann Source #

prettyList :: [(a1, a2)] -> Doc ann Source #

Pretty v => Pretty (TPrimExp t v) Source # 
Instance details

Defined in Futhark.Analysis.PrimExp

Methods

pretty :: TPrimExp t v -> Doc ann Source #

prettyList :: [TPrimExp t v] -> Doc ann Source #

Pretty e => Pretty (Count u e) Source # 
Instance details

Defined in Futhark.IR.GPU.Sizes

Methods

pretty :: Count u e -> Doc ann Source #

prettyList :: [Count u e] -> Doc ann Source #

(Pretty (ShapeBase d), Pretty (TypeBase (ShapeBase d) u), Pretty d, Pretty u, Pretty ret) => Pretty (MemInfo d u ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

pretty :: MemInfo d u ret -> Doc ann Source #

prettyList :: [MemInfo d u ret] -> Doc ann Source #

(IsName vn, Annot f, Pretty t) => Pretty (PatBase f vn t) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: PatBase f vn t -> Doc ann Source #

prettyList :: [PatBase f vn t] -> Doc ann Source #

Pretty a => Pretty (Const a b) 
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Const a b -> Doc ann Source #

prettyList :: [Const a b] -> Doc ann Source #

(Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3)
>>> pretty (123, "hello", False)
(123, hello, False)
Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: (a1, a2, a3) -> Doc ann Source #

prettyList :: [(a1, a2, a3)] -> Doc ann Source #

IsName vn => Pretty (IdentBase f vn t) Source # 
Instance details

Defined in Language.Futhark.Pretty

Methods

pretty :: IdentBase f vn t -> Doc ann Source #

prettyList :: [IdentBase f vn t] -> Doc ann Source #

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

Instances details
DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

primRetType :: PrimType -> FunReturns Source #

applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source #

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

ASTMappable ResRetType Source # 
Instance details

Defined in Language.Futhark.Traversals

Methods

astMap :: Monad m => ASTMapper m -> ResRetType -> m ResRetType Source #

Monoid Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Semigroup Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Methods

(<>) :: Uniqueness -> Uniqueness -> Uniqueness #

sconcat :: NonEmpty Uniqueness -> Uniqueness

stimes :: Integral b => b -> Uniqueness -> Uniqueness

Show Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Methods

showsPrec :: Int -> Uniqueness -> ShowS

show :: Uniqueness -> String

showList :: [Uniqueness] -> ShowS

Eq Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Methods

(==) :: Uniqueness -> Uniqueness -> Bool

(/=) :: Uniqueness -> Uniqueness -> Bool

Ord Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty Uniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.IR.Mem

ASTMappable (TypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.Traversals

Substitutable (RetTypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Substitutable (TypeBase Size Uniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

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

Defined in Futhark.IR.Mem

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

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

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

data NoUniqueness Source #

A fancier name for () - encodes no uniqueness information. Also has a different prettyprinting instance.

Constructors

NoUniqueness 

Instances

Instances details
HasLetDecMem LetDecMem Source # 
Instance details

Defined in Futhark.IR.Mem

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

ASTMappable StructType Source # 
Instance details

Defined in Language.Futhark.Traversals

Methods

astMap :: Monad m => ASTMapper m -> StructType -> m StructType Source #

Substitutable StructType Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Monoid NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Semigroup NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Show NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Methods

showsPrec :: Int -> NoUniqueness -> ShowS

show :: NoUniqueness -> String

showList :: [NoUniqueness] -> ShowS

Eq NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Methods

(==) :: NoUniqueness -> NoUniqueness -> Bool

(/=) :: NoUniqueness -> NoUniqueness -> Bool

Ord NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Pretty NoUniqueness Source # 
Instance details

Defined in Language.Futhark.Core

Substitutable (Pat StructType) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Substitutable (RetTypeBase Size NoUniqueness) Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

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

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

ASTMappable (PatBase Info VName StructType) Source # 
Instance details

Defined in Language.Futhark.Traversals

ASTMappable (IdentBase Info VName StructType) Source # 
Instance details

Defined in Language.Futhark.Traversals

newtype Rank Source #

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

Constructors

Rank Int 

Instances

Instances details
ArrayShape Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

shapeRank :: Rank -> Int Source #

subShapeOf :: Rank -> Rank -> Bool Source #

Rename Rank Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute Rank Source # 
Instance details

Defined in Futhark.Transform.Substitute

Monoid Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

mempty :: Rank

mappend :: Rank -> Rank -> Rank

mconcat :: [Rank] -> Rank

Semigroup Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

sconcat :: NonEmpty Rank -> Rank

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

Show Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Rank -> ShowS

show :: Rank -> String

showList :: [Rank] -> ShowS

Eq Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

Ord Rank Source # 
Instance details

Defined in Futhark.IR.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

Pretty Rank Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Rank -> Doc ann Source #

prettyList :: [Rank] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

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.

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

Check whether one shape if a subset of another shape.

Instances

Instances details
ArrayShape Rank Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

shapeRank :: Rank -> Int Source #

subShapeOf :: Rank -> Rank -> Bool Source #

ArrayShape (ShapeBase ExtSize) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ArrayShape (ShapeBase SubExp) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

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 
ScalarSpace [SubExp] PrimType

A special kind of memory that is a statically sized array of some primitive type. Used for private memory on GPUs.

Instances

Instances details
FreeIn Space Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Space -> FV Source #

Simplifiable Space Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Show Space Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Space -> ShowS

show :: Space -> String

showList :: [Space] -> ShowS

Eq Space Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

Ord Space Source # 
Instance details

Defined in Futhark.IR.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

Pretty Space Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Space -> Doc ann Source #

prettyList :: [Space] -> Doc ann Source #

data TypeBase shape u Source #

The type of a value. When comparing types for equality with ==, shapes must match.

Constructors

Prim PrimType 
Acc VName Shape [Type] u

Token, index space, element type, and uniqueness.

Array PrimType shape u 
Mem Space 

Instances

Instances details
Bifoldable TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bifold :: Monoid m => TypeBase m m -> m

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TypeBase a b -> m

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TypeBase a b -> c

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TypeBase a b -> c

Bifunctor TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bimap :: (a -> b) -> (c -> d) -> TypeBase a c -> TypeBase b d #

first :: (a -> b) -> TypeBase a c -> TypeBase b c

second :: (b -> c) -> TypeBase a b -> TypeBase a c

Bitraversable TypeBase Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> TypeBase a b -> f (TypeBase c d)

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

Functor (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> TypeBase shape a -> TypeBase shape b

(<$) :: a -> TypeBase shape b -> TypeBase shape a

Foldable (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => TypeBase shape m -> m

foldMap :: Monoid m => (a -> m) -> TypeBase shape a -> m

foldMap' :: Monoid m => (a -> m) -> TypeBase shape a -> m

foldr :: (a -> b -> b) -> b -> TypeBase shape a -> b

foldr' :: (a -> b -> b) -> b -> TypeBase shape a -> b

foldl :: (b -> a -> b) -> b -> TypeBase shape a -> b

foldl' :: (b -> a -> b) -> b -> TypeBase shape a -> b

foldr1 :: (a -> a -> a) -> TypeBase shape a -> a

foldl1 :: (a -> a -> a) -> TypeBase shape a -> a

toList :: TypeBase shape a -> [a]

null :: TypeBase shape a -> Bool

length :: TypeBase shape a -> Int

elem :: Eq a => a -> TypeBase shape a -> Bool

maximum :: Ord a => TypeBase shape a -> a

minimum :: Ord a => TypeBase shape a -> a

sum :: Num a => TypeBase shape a -> a

product :: Num a => TypeBase shape a -> a

Traversable (TypeBase shape) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

sequenceA :: Applicative f => TypeBase shape (f a) -> f (TypeBase shape a)

mapM :: Monad m => (a -> m b) -> TypeBase shape a -> m (TypeBase shape b)

sequence :: Monad m => TypeBase shape (m a) -> m (TypeBase shape a)

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

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: TypeBase shape u -> FV Source #

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

Defined in Futhark.IR.Prop.Types

Methods

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

mapExt :: (Int -> Int) -> TypeBase shape u -> TypeBase shape u Source #

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

Defined in Futhark.Optimise.Simplify.Engine

Methods

simplify :: SimplifiableRep rep => TypeBase shape u -> SimpleM rep (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 #

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 #

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

Defined in Futhark.IR.Syntax.Core

Methods

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

show :: TypeBase shape u -> String

showList :: [TypeBase shape u] -> ShowS

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

Defined in Futhark.IR.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.IR.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

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

Defined in Futhark.IR.Pretty

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Rank u -> Doc ann Source #

prettyList :: [TypeBase Rank u] -> Doc ann Source #

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann 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. A result may alias this.

ObservePrim

As Observe, but the result will not alias, because the parameter does not carry aliases.

Instances

Instances details
Show Diet Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Diet -> ShowS

show :: Diet -> String

showList :: [Diet] -> ShowS

Eq Diet Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

Ord Diet Source # 
Instance details

Defined in Futhark.IR.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

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

Instances details
FreeIn Ident Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Ident -> FV Source #

Typed Ident Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Ident -> Type Source #

Rename Ident Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute Ident Source # 
Instance details

Defined in Futhark.Transform.Substitute

Show Ident Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Ident -> ShowS

show :: Ident -> String

showList :: [Ident] -> ShowS

Eq Ident Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

Ord Ident Source # 
Instance details

Defined in Futhark.IR.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

Pretty Ident Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Ident -> Doc ann Source #

prettyList :: [Ident] -> Doc ann Source #

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

Instances details
ToExp SubExp Source # 
Instance details

Defined in Futhark.CodeGen.ImpGen

Methods

toExp :: SubExp -> ImpM rep r op Exp Source #

toExp' :: PrimType -> SubExp -> Exp Source #

ToExp SubExp Source # 
Instance details

Defined in Futhark.Construct

Methods

toExp :: MonadBuilder m => SubExp -> m (Exp (Rep m)) Source #

HasLetDecMem LetDecMem Source # 
Instance details

Defined in Futhark.IR.Mem

FreeIn SubExp Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: SubExp -> FV Source #

DeclExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

DeclTyped DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped DeclExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

ExtTyped ExtType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

FixExt ExtSize Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Typed DeclType Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: DeclType -> Type Source #

Typed Type Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Type -> Type Source #

IsBodyType BodyReturns Source # 
Instance details

Defined in Futhark.IR.Mem

IsBodyType ExtType Source # 
Instance details

Defined in Futhark.IR.RetType

IsRetType FunReturns Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

primRetType :: PrimType -> FunReturns Source #

applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source #

IsRetType DeclExtType Source # 
Instance details

Defined in Futhark.IR.RetType

Simplifiable ExtSize Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Simplifiable SubExp Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Rename ExtSize Source # 
Instance details

Defined in Futhark.Transform.Rename

Rename SubExp Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute SubExp Source # 
Instance details

Defined in Futhark.Transform.Substitute

Show SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> SubExp -> ShowS

show :: SubExp -> String

showList :: [SubExp] -> ShowS

Eq SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

Ord SubExp Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: SubExp -> SubExp -> Ordering

(<) :: SubExp -> SubExp -> Bool

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

(>) :: SubExp -> SubExp -> Bool

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

max :: SubExp -> SubExp -> SubExp

min :: SubExp -> SubExp -> SubExp

ToExp SubExp Source # 
Instance details

Defined in Futhark.CodeGen.Backends.SimpleRep

Methods

toExp :: SubExp -> SrcLoc -> Exp Source #

Pretty SubExp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExp -> Doc ann Source #

prettyList :: [SubExp] -> Doc ann Source #

ArrayShape (ShapeBase ExtSize) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

ArrayShape (ShapeBase SubExp) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Simplifiable [FunReturns] Source # 
Instance details

Defined in Futhark.IR.Mem

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

Defined in Futhark.IR.Pretty

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

Defined in Futhark.IR.Pretty

Methods

pretty :: TypeBase Shape u -> Doc ann Source #

prettyList :: [TypeBase Shape u] -> Doc ann Source #

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

Defined in Futhark.IR.Mem

DeclTyped (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

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

Defined in Futhark.IR.Mem

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

Defined in Futhark.IR.Mem

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

Defined in Futhark.IR.Mem

Methods

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

mapExt :: (Int -> Int) -> MemInfo ExtSize u ret -> MemInfo ExtSize u ret Source #

Typed (MemInfo SubExp NoUniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

Typed (MemInfo SubExp Uniqueness ret) Source # 
Instance details

Defined in Futhark.IR.Mem

data PatElem dec Source #

An element of a pattern - consisting of a name and an addditional parametric decoration. This decoration is what is expected to contain the type of the resulting variable.

Constructors

PatElem 

Fields

Instances

Instances details
Functor PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> PatElem a -> PatElem b

(<$) :: a -> PatElem b -> PatElem a

Foldable PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => PatElem m -> m

foldMap :: Monoid m => (a -> m) -> PatElem a -> m

foldMap' :: Monoid m => (a -> m) -> PatElem a -> m

foldr :: (a -> b -> b) -> b -> PatElem a -> b

foldr' :: (a -> b -> b) -> b -> PatElem a -> b

foldl :: (b -> a -> b) -> b -> PatElem a -> b

foldl' :: (b -> a -> b) -> b -> PatElem a -> b

foldr1 :: (a -> a -> a) -> PatElem a -> a

foldl1 :: (a -> a -> a) -> PatElem a -> a

toList :: PatElem a -> [a]

null :: PatElem a -> Bool

length :: PatElem a -> Int

elem :: Eq a => a -> PatElem a -> Bool

maximum :: Ord a => PatElem a -> a

minimum :: Ord a => PatElem a -> a

sum :: Num a => PatElem a -> a

product :: Num a => PatElem a -> a

Traversable PatElem Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

sequenceA :: Applicative f => PatElem (f a) -> f (PatElem a)

mapM :: Monad m => (a -> m b) -> PatElem a -> m (PatElem b)

sequence :: Monad m => PatElem (m a) -> m (PatElem a)

AliasesOf dec => AliasesOf (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Aliases

Methods

aliasesOf :: PatElem dec -> Names Source #

FreeIn dec => FreeIn (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: PatElem dec -> FV Source #

Typed dec => Typed (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: PatElem dec -> Type Source #

Rename dec => Rename (PatElem dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: PatElem dec -> RenameM (PatElem dec) Source #

Substitute dec => Substitute (PatElem dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> PatElem dec -> PatElem dec Source #

Show dec => Show (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> PatElem dec -> ShowS

show :: PatElem dec -> String

showList :: [PatElem dec] -> ShowS

Eq dec => Eq (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: PatElem dec -> PatElem dec -> Bool

(/=) :: PatElem dec -> PatElem dec -> Bool

Ord dec => Ord (PatElem dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: PatElem dec -> PatElem dec -> Ordering

(<) :: PatElem dec -> PatElem dec -> Bool

(<=) :: PatElem dec -> PatElem dec -> Bool

(>) :: PatElem dec -> PatElem dec -> Bool

(>=) :: PatElem dec -> PatElem dec -> Bool

max :: PatElem dec -> PatElem dec -> PatElem dec

min :: PatElem dec -> PatElem dec -> PatElem dec

Pretty t => Pretty (PatElem t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: PatElem t -> Doc ann Source #

prettyList :: [PatElem t] -> Doc ann Source #

newtype Pat dec Source #

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

Constructors

Pat 

Fields

Instances

Instances details
Functor Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> Pat a -> Pat b

(<$) :: a -> Pat b -> Pat a

Foldable Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => Pat m -> m

foldMap :: Monoid m => (a -> m) -> Pat a -> m

foldMap' :: Monoid m => (a -> m) -> Pat a -> m

foldr :: (a -> b -> b) -> b -> Pat a -> b

foldr' :: (a -> b -> b) -> b -> Pat a -> b

foldl :: (b -> a -> b) -> b -> Pat a -> b

foldl' :: (b -> a -> b) -> b -> Pat a -> b

foldr1 :: (a -> a -> a) -> Pat a -> a

foldl1 :: (a -> a -> a) -> Pat a -> a

toList :: Pat a -> [a]

null :: Pat a -> Bool

length :: Pat a -> Int

elem :: Eq a => a -> Pat a -> Bool

maximum :: Ord a => Pat a -> a

minimum :: Ord a => Pat a -> a

sum :: Num a => Pat a -> a

product :: Num a => Pat a -> a

Traversable Pat Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

sequenceA :: Applicative f => Pat (f a) -> f (Pat a)

mapM :: Monad m => (a -> m b) -> Pat a -> m (Pat b)

sequence :: Monad m => Pat (m a) -> m (Pat a)

FreeIn dec => FreeIn (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Pat dec -> FV Source #

Rename dec => Rename (Pat dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Pat dec -> RenameM (Pat dec) Source #

Substitute dec => Substitute (Pat dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Pat dec -> Pat dec Source #

Monoid (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

mempty :: Pat dec

mappend :: Pat dec -> Pat dec -> Pat dec

mconcat :: [Pat dec] -> Pat dec

Semigroup (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: Pat dec -> Pat dec -> Pat dec #

sconcat :: NonEmpty (Pat dec) -> Pat dec

stimes :: Integral b => b -> Pat dec -> Pat dec

Show dec => Show (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Pat dec -> ShowS

show :: Pat dec -> String

showList :: [Pat dec] -> ShowS

Eq dec => Eq (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Pat dec -> Pat dec -> Bool

(/=) :: Pat dec -> Pat dec -> Bool

Ord dec => Ord (Pat dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Pat dec -> Pat dec -> Ordering

(<) :: Pat dec -> Pat dec -> Bool

(<=) :: Pat dec -> Pat dec -> Bool

(>) :: Pat dec -> Pat dec -> Bool

(>=) :: Pat dec -> Pat dec -> Bool

max :: Pat dec -> Pat dec -> Pat dec

min :: Pat dec -> Pat dec -> Pat dec

Pretty t => Pretty (Pat t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Pat t -> Doc ann Source #

prettyList :: [Pat t] -> Doc ann Source #

data StmAux dec Source #

Auxilliary Information associated with a statement.

Constructors

StmAux 

Instances

Instances details
Functor StmAux Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> StmAux a -> StmAux b

(<$) :: a -> StmAux b -> StmAux a

Foldable StmAux Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => StmAux m -> m

foldMap :: Monoid m => (a -> m) -> StmAux a -> m

foldMap' :: Monoid m => (a -> m) -> StmAux a -> m

foldr :: (a -> b -> b) -> b -> StmAux a -> b

foldr' :: (a -> b -> b) -> b -> StmAux a -> b

foldl :: (b -> a -> b) -> b -> StmAux a -> b

foldl' :: (b -> a -> b) -> b -> StmAux a -> b

foldr1 :: (a -> a -> a) -> StmAux a -> a

foldl1 :: (a -> a -> a) -> StmAux a -> a

toList :: StmAux a -> [a]

null :: StmAux a -> Bool

length :: StmAux a -> Int

elem :: Eq a => a -> StmAux a -> Bool

maximum :: Ord a => StmAux a -> a

minimum :: Ord a => StmAux a -> a

sum :: Num a => StmAux a -> a

product :: Num a => StmAux a -> a

Traversable StmAux Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

sequenceA :: Applicative f => StmAux (f a) -> f (StmAux a)

mapM :: Monad m => (a -> m b) -> StmAux a -> m (StmAux b)

sequence :: Monad m => StmAux (m a) -> m (StmAux a)

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

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: StmAux dec -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

Monoid dec => Monoid (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

mempty :: StmAux dec

mappend :: StmAux dec -> StmAux dec -> StmAux dec

mconcat :: [StmAux dec] -> StmAux dec

Semigroup dec => Semigroup (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: StmAux dec -> StmAux dec -> StmAux dec #

sconcat :: NonEmpty (StmAux dec) -> StmAux dec

stimes :: Integral b => b -> StmAux dec -> StmAux dec

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

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> StmAux dec -> ShowS

show :: StmAux dec -> String

showList :: [StmAux dec] -> ShowS

Eq dec => Eq (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: StmAux dec -> StmAux dec -> Bool

(/=) :: StmAux dec -> StmAux dec -> Bool

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

Defined in Futhark.IR.Syntax

Methods

compare :: StmAux dec -> StmAux dec -> Ordering

(<) :: StmAux dec -> StmAux dec -> Bool

(<=) :: StmAux dec -> StmAux dec -> Bool

(>) :: StmAux dec -> StmAux dec -> Bool

(>=) :: StmAux dec -> StmAux dec -> Bool

max :: StmAux dec -> StmAux dec -> StmAux dec

min :: StmAux dec -> StmAux dec -> StmAux dec

Pretty dec => Pretty (StmAux dec) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: StmAux dec -> Doc ann Source #

prettyList :: [StmAux dec] -> Doc ann Source #

data Stm rep Source #

A local variable binding.

Constructors

Let 

Fields

Instances

Instances details
Scoped rep (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Stm rep -> Scope rep Source #

Scoped rep (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Stms rep -> Scope rep Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Stm rep -> FV Source #

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

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Stms rep -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

RepTypes rep => Show (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Stm rep -> ShowS

show :: Stm rep -> String

showList :: [Stm rep] -> ShowS

RepTypes rep => Eq (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Stm rep -> Stm rep -> Bool

(/=) :: Stm rep -> Stm rep -> Bool

RepTypes rep => Ord (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Stm rep -> Stm rep -> Ordering

(<) :: Stm rep -> Stm rep -> Bool

(<=) :: Stm rep -> Stm rep -> Bool

(>) :: Stm rep -> Stm rep -> Bool

(>=) :: Stm rep -> Stm rep -> Bool

max :: Stm rep -> Stm rep -> Stm rep

min :: Stm rep -> Stm rep -> Stm rep

PrettyRep rep => Pretty (Stm rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stm rep -> Doc ann Source #

prettyList :: [Stm rep] -> Doc ann Source #

PrettyRep rep => Pretty (Stms rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Stms rep -> Doc ann Source #

prettyList :: [Stms rep] -> Doc ann Source #

type Stms rep = Seq (Stm rep) Source #

A sequence of statements.

data SubExpRes Source #

A pairing of a subexpression and some certificates.

Constructors

SubExpRes 

Instances

Instances details
FreeIn SubExpRes Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: SubExpRes -> FV Source #

Simplifiable SubExpRes Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Engine

Rename SubExpRes Source # 
Instance details

Defined in Futhark.Transform.Rename

Substitute SubExpRes Source # 
Instance details

Defined in Futhark.Transform.Substitute

Show SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> SubExpRes -> ShowS

show :: SubExpRes -> String

showList :: [SubExpRes] -> ShowS

Eq SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: SubExpRes -> SubExpRes -> Bool

(/=) :: SubExpRes -> SubExpRes -> Bool

Ord SubExpRes Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: SubExpRes -> SubExpRes -> Ordering

(<) :: SubExpRes -> SubExpRes -> Bool

(<=) :: SubExpRes -> SubExpRes -> Bool

(>) :: SubExpRes -> SubExpRes -> Bool

(>=) :: SubExpRes -> SubExpRes -> Bool

max :: SubExpRes -> SubExpRes -> SubExpRes

min :: SubExpRes -> SubExpRes -> SubExpRes

Pretty SubExpRes Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: SubExpRes -> Doc ann Source #

prettyList :: [SubExpRes] -> Doc ann Source #

type Result = [SubExpRes] Source #

The result of a body is a sequence of subexpressions.

data Body rep Source #

A body consists of a sequence of statements, terminating in a list of result values.

Constructors

Body 

Fields

Instances

Instances details
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Body rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Body rep -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

RepTypes rep => Show (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Body rep -> ShowS

show :: Body rep -> String

showList :: [Body rep] -> ShowS

RepTypes rep => Eq (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Body rep -> Body rep -> Bool

(/=) :: Body rep -> Body rep -> Bool

RepTypes rep => Ord (Body rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Body rep -> Body rep -> Ordering

(<) :: Body rep -> Body rep -> Bool

(<=) :: Body rep -> Body rep -> Bool

(>) :: Body rep -> Body rep -> Bool

(>=) :: Body rep -> Body rep -> Bool

max :: Body rep -> Body rep -> Body rep

min :: Body rep -> Body rep -> Body rep

PrettyRep rep => Pretty (Body rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Body rep -> Doc ann Source #

prettyList :: [Body rep] -> Doc ann Source #

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

data BasicOp 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 OpaqueOp SubExp

Semantically and operationally just identity, but is invisible/impenetrable to optimisations (hopefully). This partially a hack to avoid optimisation (so, to work around compiler limitations), but is also used to implement tracing and other operations that are semantically invisible, but have some sort of effect (brrr).

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.

ArrayVal [PrimValue] PrimType

A one-dimensional array literal that contains only constants. This is a fast-path for representing very large array literals that show up in some programs. The key rule for processing this in compiler passes is that you should never need to look at the individual elements. Has exactly the same semantics as an ArrayLit.

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)

Turn a boolean into a certificate, halting the program with the given error message if the boolean is false. The error location comes from the provenance of the statement.

Index VName (Slice SubExp)

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

Update Safety VName (Slice SubExp) SubExp

An in-place update of the given array at the given position. Consumes the array. If Safe, perform a run-time bounds check and ignore the write if out of bounds (like Scatter).

FlatIndex VName (FlatSlice SubExp) 
FlatUpdate VName (FlatSlice SubExp) VName 
Concat Int (NonEmpty VName) SubExp
concat(0, [1] :| [[2, 3, 4], [5, 6]], 6) = [1, 2, 3, 4, 5, 6]

Concatenates the non-empty list of VName resulting in an array of length SubExp. The Int argument is used to specify the dimension along which the arrays are concatenated. For instance:

concat(1, [[1,2], [3, 4]] :| [[[5,6]], [[7, 8]]], 4) = [[1, 2, 5, 6], [3, 4, 7, 8]]
Manifest VName [Int]

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]]. The result has no aliases. Copy a value by passing an empty shape.

Scratch PrimType [SubExp]

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

Reshape VName (NewShape SubExp)

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

Rearrange VName [Int]

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.

UpdateAcc Safety VName [SubExp] [SubExp]

Update an accumulator at the given index with the given value. Consumes the accumulator and produces a new one. If Safe, perform a run-time bounds check and ignore the write if out of bounds (like Scatter).

Instances

Instances details
Show BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> BasicOp -> ShowS

show :: BasicOp -> String

showList :: [BasicOp] -> ShowS

Eq BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

Ord BasicOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: BasicOp -> BasicOp -> Ordering

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

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

(>) :: BasicOp -> BasicOp -> Bool

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

max :: BasicOp -> BasicOp -> BasicOp

min :: BasicOp -> BasicOp -> BasicOp

Pretty BasicOp Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: BasicOp -> Doc ann Source #

prettyList :: [BasicOp] -> Doc ann Source #

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

Neg PrimType

Flip sign. Logical negation for booleans.

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.

FSignum FloatType

Floating-point sign function.

Instances

Instances details
Show UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

showsPrec :: Int -> UnOp -> ShowS

show :: UnOp -> String

showList :: [UnOp] -> ShowS

Eq UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

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

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

Ord UnOp Source # 
Instance details

Defined in Language.Futhark.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

Pretty UnOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: UnOp -> Doc ann Source #

prettyList :: [UnOp] -> Doc ann Source #

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 Overflow

Integer addition.

FAdd FloatType

Floating-point addition.

Sub IntType Overflow

Integer subtraction.

FSub FloatType

Floating-point subtraction.

Mul IntType Overflow

Integer multiplication.

FMul FloatType

Floating-point multiplication.

UDiv IntType Safety

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

UDivUp IntType Safety

Unsigned integer division. Rounds towards positive infinity.

SDiv IntType Safety

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

SDivUp IntType Safety

Signed integer division. Rounds towards positive infinity.

FDiv FloatType

Floating-point division.

FMod FloatType

Floating-point modulus.

UMod IntType Safety

Unsigned integer modulus; the countepart to UDiv.

SMod IntType Safety

Signed integer modulus; the countepart to SDiv.

SQuot IntType Safety

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

SRem IntType Safety

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

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

Instances details
Show BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

showsPrec :: Int -> BinOp -> ShowS

show :: BinOp -> String

showList :: [BinOp] -> ShowS

Eq BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

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

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

Ord BinOp Source # 
Instance details

Defined in Language.Futhark.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

Pretty BinOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: BinOp -> Doc ann Source #

prettyList :: [BinOp] -> Doc ann Source #

data CmpOp Source #

Comparison operators are like BinOps, but they always return a boolean value. 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

Instances details
Show CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

showsPrec :: Int -> CmpOp -> ShowS

show :: CmpOp -> String

showList :: [CmpOp] -> ShowS

Eq CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

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

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

Ord CmpOp Source # 
Instance details

Defined in Language.Futhark.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

Pretty CmpOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: CmpOp -> Doc ann Source #

prettyList :: [CmpOp] -> Doc ann Source #

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.

FPToBits FloatType

Convert floating point number to its bitwise representation.

BitsToFP FloatType

Convert bitwise representation to a floating point number.

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.

FToB FloatType

Convert a float to a boolean value. Zero becomes false; | anything else is true.

BToF FloatType

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

Instances

Instances details
Show ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

showsPrec :: Int -> ConvOp -> ShowS

show :: ConvOp -> String

showList :: [ConvOp] -> ShowS

Eq ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

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

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

Ord ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

compare :: ConvOp -> ConvOp -> Ordering

(<) :: ConvOp -> ConvOp -> Bool

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

(>) :: ConvOp -> ConvOp -> Bool

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

max :: ConvOp -> ConvOp -> ConvOp

min :: ConvOp -> ConvOp -> ConvOp

Pretty ConvOp Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

pretty :: ConvOp -> Doc ann Source #

prettyList :: [ConvOp] -> Doc ann Source #

data OpaqueOp Source #

Apart from being Opaque, what else is going on here?

Constructors

OpaqueNil

No special operation.

OpaqueTrace Text

Print the argument, prefixed by this string.

Instances

Instances details
Show OpaqueOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> OpaqueOp -> ShowS

show :: OpaqueOp -> String

showList :: [OpaqueOp] -> ShowS

Eq OpaqueOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: OpaqueOp -> OpaqueOp -> Bool

(/=) :: OpaqueOp -> OpaqueOp -> Bool

Ord OpaqueOp Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: OpaqueOp -> OpaqueOp -> Ordering

(<) :: OpaqueOp -> OpaqueOp -> Bool

(<=) :: OpaqueOp -> OpaqueOp -> Bool

(>) :: OpaqueOp -> OpaqueOp -> Bool

(>=) :: OpaqueOp -> OpaqueOp -> Bool

max :: OpaqueOp -> OpaqueOp -> OpaqueOp

min :: OpaqueOp -> OpaqueOp -> OpaqueOp

data DimSplice d Source #

Split or join a range of dimensions. A reshaping operation consists of a sequence of these. The purpose is to maintain information about the original operations (flatten/unflatten), which can then be used for algebraic optimisations.

Constructors

DimSplice Int Int (ShapeBase d)

DimSplice i k s modifies dimensions i to i+k-1 to instead have shape s.

If k is 1 and the rank of s is greater than 1, then this is equivalent to unflattening a dimension.

If k is greater than 1 and the rank of s is 1, then this is equivalent to flattening adjacent dimensions.

If k is 1 and the rank of s is 1, then it is a coercion - a change that only affects the type, but does not have any semantic effect.

Other cases can do arbitrary changes, but are harder for the compiler to analyse.

Instances

Instances details
Functor DimSplice Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> DimSplice a -> DimSplice b

(<$) :: a -> DimSplice b -> DimSplice a

Foldable DimSplice Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => DimSplice m -> m

foldMap :: Monoid m => (a -> m) -> DimSplice a -> m

foldMap' :: Monoid m => (a -> m) -> DimSplice a -> m

foldr :: (a -> b -> b) -> b -> DimSplice a -> b

foldr' :: (a -> b -> b) -> b -> DimSplice a -> b

foldl :: (b -> a -> b) -> b -> DimSplice a -> b

foldl' :: (b -> a -> b) -> b -> DimSplice a -> b

foldr1 :: (a -> a -> a) -> DimSplice a -> a

foldl1 :: (a -> a -> a) -> DimSplice a -> a

toList :: DimSplice a -> [a]

null :: DimSplice a -> Bool

length :: DimSplice a -> Int

elem :: Eq a => a -> DimSplice a -> Bool

maximum :: Ord a => DimSplice a -> a

minimum :: Ord a => DimSplice a -> a

sum :: Num a => DimSplice a -> a

product :: Num a => DimSplice a -> a

Traversable DimSplice Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

sequenceA :: Applicative f => DimSplice (f a) -> f (DimSplice a)

mapM :: Monad m => (a -> m b) -> DimSplice a -> m (DimSplice b)

sequence :: Monad m => DimSplice (m a) -> m (DimSplice a)

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

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> DimSplice d -> ShowS

show :: DimSplice d -> String

showList :: [DimSplice d] -> ShowS

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

Defined in Futhark.IR.Syntax

Methods

(==) :: DimSplice d -> DimSplice d -> Bool

(/=) :: DimSplice d -> DimSplice d -> Bool

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

Defined in Futhark.IR.Syntax

Methods

compare :: DimSplice d -> DimSplice d -> Ordering

(<) :: DimSplice d -> DimSplice d -> Bool

(<=) :: DimSplice d -> DimSplice d -> Bool

(>) :: DimSplice d -> DimSplice d -> Bool

(>=) :: DimSplice d -> DimSplice d -> Bool

max :: DimSplice d -> DimSplice d -> DimSplice d

min :: DimSplice d -> DimSplice d -> DimSplice d

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

Defined in Futhark.IR.Pretty

Methods

pretty :: DimSplice d -> Doc ann Source #

prettyList :: [DimSplice d] -> Doc ann Source #

data NewShape d Source #

A reshaping operation consists of a sequence of splices, as well as an annotation indicating the final shape.

Constructors

NewShape 

Fields

Instances

Instances details
Functor NewShape Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> NewShape a -> NewShape b

(<$) :: a -> NewShape b -> NewShape a

Foldable NewShape Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => NewShape m -> m

foldMap :: Monoid m => (a -> m) -> NewShape a -> m

foldMap' :: Monoid m => (a -> m) -> NewShape a -> m

foldr :: (a -> b -> b) -> b -> NewShape a -> b

foldr' :: (a -> b -> b) -> b -> NewShape a -> b

foldl :: (b -> a -> b) -> b -> NewShape a -> b

foldl' :: (b -> a -> b) -> b -> NewShape a -> b

foldr1 :: (a -> a -> a) -> NewShape a -> a

foldl1 :: (a -> a -> a) -> NewShape a -> a

toList :: NewShape a -> [a]

null :: NewShape a -> Bool

length :: NewShape a -> Int

elem :: Eq a => a -> NewShape a -> Bool

maximum :: Ord a => NewShape a -> a

minimum :: Ord a => NewShape a -> a

sum :: Num a => NewShape a -> a

product :: Num a => NewShape a -> a

Traversable NewShape Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

sequenceA :: Applicative f => NewShape (f a) -> f (NewShape a)

mapM :: Monad m => (a -> m b) -> NewShape a -> m (NewShape b)

sequence :: Monad m => NewShape (m a) -> m (NewShape a)

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

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: NewShape d -> FV Source #

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

Defined in Futhark.Transform.Substitute

Semigroup (NewShape d) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: NewShape d -> NewShape d -> NewShape d #

sconcat :: NonEmpty (NewShape d) -> NewShape d

stimes :: Integral b => b -> NewShape d -> NewShape d

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

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> NewShape d -> ShowS

show :: NewShape d -> String

showList :: [NewShape d] -> ShowS

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

Defined in Futhark.IR.Syntax

Methods

(==) :: NewShape d -> NewShape d -> Bool

(/=) :: NewShape d -> NewShape d -> Bool

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

Defined in Futhark.IR.Syntax

Methods

compare :: NewShape d -> NewShape d -> Ordering

(<) :: NewShape d -> NewShape d -> Bool

(<=) :: NewShape d -> NewShape d -> Bool

(>) :: NewShape d -> NewShape d -> Bool

(>=) :: NewShape d -> NewShape d -> Bool

max :: NewShape d -> NewShape d -> NewShape d

min :: NewShape d -> NewShape d -> NewShape d

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

Defined in Futhark.IR.Pretty

Methods

pretty :: NewShape d -> Doc ann Source #

prettyList :: [NewShape d] -> Doc ann Source #

type WithAccInput rep = (Shape, [VName], Maybe (Lambda rep, [SubExp])) Source #

The input to a WithAcc construct. Comprises the index space of the accumulator, the underlying arrays, and possibly a combining function.

data Exp rep Source #

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

Constructors

BasicOp BasicOp

A simple (non-recursive) operation.

Apply Name [(SubExp, Diet)] [(RetType rep, RetAls)] Safety 
Match [SubExp] [Case (Body rep)] (Body rep) (MatchDec (BranchType rep))

A match statement picks a branch by comparing the given subexpressions (called the scrutinee) with the pattern in each of the cases. If none of the cases match, the /default body/ is picked.

Loop [(FParam rep, SubExp)] LoopForm (Body rep)

loop {a} = {v} (for i < n|while b) do b.

WithAcc [WithAccInput rep] (Lambda rep)

Create accumulators backed by the given arrays (which are consumed) and pass them to the lambda, which must return the updated accumulators and possibly some extra values. The accumulators are turned back into arrays. In the lambda, the result accumulators come first, and are ordered in a manner consistent with that of the input (accumulator) arguments. The Shape is the write index space. The corresponding arrays must all have this shape outermost. This construct is not part of BasicOp because we need the rep parameter.

Op (Op rep) 

Instances

Instances details
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Exp rep -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

RepTypes rep => Show (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Exp rep -> ShowS

show :: Exp rep -> String

showList :: [Exp rep] -> ShowS

RepTypes rep => Eq (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Exp rep -> Exp rep -> Bool

(/=) :: Exp rep -> Exp rep -> Bool

RepTypes rep => Ord (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Exp rep -> Exp rep -> Ordering

(<) :: Exp rep -> Exp rep -> Bool

(<=) :: Exp rep -> Exp rep -> Bool

(>) :: Exp rep -> Exp rep -> Bool

(>=) :: Exp rep -> Exp rep -> Bool

max :: Exp rep -> Exp rep -> Exp rep

min :: Exp rep -> Exp rep -> Exp rep

PrettyRep rep => Pretty (Exp rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Exp rep -> Doc ann Source #

prettyList :: [Exp rep] -> Doc ann Source #

data Case body Source #

A non-default case in a Match statement. The number of elements in the pattern must match the number of scrutinees. A Nothing value indicates that we don't care about it (i.e. a wildcard).

Constructors

Case 

Fields

Instances

Instances details
Functor Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fmap :: (a -> b) -> Case a -> Case b

(<$) :: a -> Case b -> Case a

Foldable Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

fold :: Monoid m => Case m -> m

foldMap :: Monoid m => (a -> m) -> Case a -> m

foldMap' :: Monoid m => (a -> m) -> Case a -> m

foldr :: (a -> b -> b) -> b -> Case a -> b

foldr' :: (a -> b -> b) -> b -> Case a -> b

foldl :: (b -> a -> b) -> b -> Case a -> b

foldl' :: (b -> a -> b) -> b -> Case a -> b

foldr1 :: (a -> a -> a) -> Case a -> a

foldl1 :: (a -> a -> a) -> Case a -> a

toList :: Case a -> [a]

null :: Case a -> Bool

length :: Case a -> Int

elem :: Eq a => a -> Case a -> Bool

maximum :: Ord a => Case a -> a

minimum :: Ord a => Case a -> a

sum :: Num a => Case a -> a

product :: Num a => Case a -> a

Traversable Case Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

sequenceA :: Applicative f => Case (f a) -> f (Case a)

mapM :: Monad m => (a -> m b) -> Case a -> m (Case b)

sequence :: Monad m => Case (m a) -> m (Case a)

FreeIn body => FreeIn (Case body) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Case body -> FV Source #

Show body => Show (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Case body -> ShowS

show :: Case body -> String

showList :: [Case body] -> ShowS

Eq body => Eq (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Case body -> Case body -> Bool

(/=) :: Case body -> Case body -> Bool

Ord body => Ord (Case body) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Case body -> Case body -> Ordering

(<) :: Case body -> Case body -> Bool

(<=) :: Case body -> Case body -> Bool

(>) :: Case body -> Case body -> Bool

(>=) :: Case body -> Case body -> Bool

max :: Case body -> Case body -> Case body

min :: Case body -> Case body -> Case body

PrettyRep rep => Pretty (Case (Body rep)) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Case (Body rep) -> Doc ann Source #

prettyList :: [Case (Body rep)] -> Doc ann Source #

data LoopForm Source #

For-loop or while-loop?

Constructors

ForLoop 

Fields

  • VName

    The loop iterator var

  • IntType

    The type of the loop iterator var

  • SubExp

    The number of iterations.

WhileLoop VName 

Instances

Instances details
FreeIn LoopForm Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: LoopForm -> FV Source #

Show LoopForm Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> LoopForm -> ShowS

show :: LoopForm -> String

showList :: [LoopForm] -> ShowS

Eq LoopForm Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

Ord LoopForm Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: LoopForm -> LoopForm -> Ordering

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

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

(>) :: LoopForm -> LoopForm -> Bool

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

max :: LoopForm -> LoopForm -> LoopForm

min :: LoopForm -> LoopForm -> LoopForm

data MatchDec rt Source #

Data associated with a branch.

Constructors

MatchDec 

Fields

Instances

Instances details
FreeIn a => FreeIn (MatchDec a) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: MatchDec a -> FV Source #

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

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> MatchDec rt -> ShowS

show :: MatchDec rt -> String

showList :: [MatchDec rt] -> ShowS

Eq rt => Eq (MatchDec rt) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: MatchDec rt -> MatchDec rt -> Bool

(/=) :: MatchDec rt -> MatchDec rt -> Bool

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

Defined in Futhark.IR.Syntax

Methods

compare :: MatchDec rt -> MatchDec rt -> Ordering

(<) :: MatchDec rt -> MatchDec rt -> Bool

(<=) :: MatchDec rt -> MatchDec rt -> Bool

(>) :: MatchDec rt -> MatchDec rt -> Bool

(>=) :: MatchDec rt -> MatchDec rt -> Bool

max :: MatchDec rt -> MatchDec rt -> MatchDec rt

min :: MatchDec rt -> MatchDec rt -> MatchDec rt

data MatchSort Source #

What kind of branch is this? This has no semantic meaning, but provides hints to simplifications.

Constructors

MatchNormal

An ordinary branch.

MatchFallback

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.

MatchEquiv

Both of these branches are semantically equivalent, and it is fine to eliminate one if it turns out to have problems (e.g. contain things we cannot generate code for).

Instances

Instances details
Show MatchSort Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> MatchSort -> ShowS

show :: MatchSort -> String

showList :: [MatchSort] -> ShowS

Eq MatchSort Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: MatchSort -> MatchSort -> Bool

(/=) :: MatchSort -> MatchSort -> Bool

Ord MatchSort Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: MatchSort -> MatchSort -> Ordering

(<) :: MatchSort -> MatchSort -> Bool

(<=) :: MatchSort -> MatchSort -> Bool

(>) :: MatchSort -> MatchSort -> Bool

(>=) :: MatchSort -> MatchSort -> Bool

max :: MatchSort -> MatchSort -> MatchSort

min :: MatchSort -> MatchSort -> MatchSort

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.

For operations like integer division, a safe division will not explode the computer in case of division by zero, but instead return some unspecified value. This always involves a run-time check, so generally the unsafe variant is what the compiler will insert, but guarded by an explicit assertion elsewhere. Safe operations are useful when the optimiser wants to move e.g. a division to a location where the divisor may be zero, but where the result will only be used when it is non-zero (so it doesn't matter what result is provided with a zero divisor, as long as the program keeps running).

Constructors

Unsafe 
Safe 

Instances

Instances details
Show Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

showsPrec :: Int -> Safety -> ShowS

show :: Safety -> String

showList :: [Safety] -> ShowS

Eq Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

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

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

Ord Safety Source # 
Instance details

Defined in Language.Futhark.Primitive

Methods

compare :: Safety -> Safety -> Ordering

(<) :: Safety -> Safety -> Bool

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

(>) :: Safety -> Safety -> Bool

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

max :: Safety -> Safety -> Safety

min :: Safety -> Safety -> Safety

data Lambda rep Source #

Anonymous function for use in a SOAC.

Constructors

Lambda 

Fields

Instances

Instances details
Scoped rep (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: Lambda rep -> Scope rep Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Lambda rep -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

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

Defined in Futhark.Transform.Substitute

Methods

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

RepTypes rep => Show (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Lambda rep -> ShowS

show :: Lambda rep -> String

showList :: [Lambda rep] -> ShowS

RepTypes rep => Eq (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Lambda rep -> Lambda rep -> Bool

(/=) :: Lambda rep -> Lambda rep -> Bool

RepTypes rep => Ord (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Lambda rep -> Lambda rep -> Ordering

(<) :: Lambda rep -> Lambda rep -> Bool

(<=) :: Lambda rep -> Lambda rep -> Bool

(>) :: Lambda rep -> Lambda rep -> Bool

(>=) :: Lambda rep -> Lambda rep -> Bool

max :: Lambda rep -> Lambda rep -> Lambda rep

min :: Lambda rep -> Lambda rep -> Lambda rep

PrettyRep rep => Pretty (Lambda rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Lambda rep -> Doc ann Source #

prettyList :: [Lambda rep] -> Doc ann Source #

data RetAls Source #

Information about the possible aliases of a function result.

Constructors

RetAls 

Fields

  • paramAls :: [Int]

    Which of the parameters may be aliased, numbered from zero. Must be sorted in increasing order.

  • otherAls :: [Int]

    Which of the other results may be aliased, numbered from zero. This must be a reflexive relation. Must be sorted in increasing order.

Instances

Instances details
Monoid RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Semigroup RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(<>) :: RetAls -> RetAls -> RetAls #

sconcat :: NonEmpty RetAls -> RetAls

stimes :: Integral b => b -> RetAls -> RetAls

Show RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> RetAls -> ShowS

show :: RetAls -> String

showList :: [RetAls] -> ShowS

Eq RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: RetAls -> RetAls -> Bool

(/=) :: RetAls -> RetAls -> Bool

Ord RetAls Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: RetAls -> RetAls -> Ordering

(<) :: RetAls -> RetAls -> Bool

(<=) :: RetAls -> RetAls -> Bool

(>) :: RetAls -> RetAls -> Bool

(>=) :: RetAls -> RetAls -> Bool

max :: RetAls -> RetAls -> RetAls

min :: RetAls -> RetAls -> RetAls

Definitions

data Param dec Source #

A function or lambda parameter.

Constructors

Param 

Fields

  • paramAttrs :: Attrs

    Attributes of the parameter. When constructing a parameter, feel free to just pass mempty.

  • paramName :: VName

    Name of the parameter.

  • paramDec :: dec

    Function parameter decoration.

Instances

Instances details
Functor Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fmap :: (a -> b) -> Param a -> Param b

(<$) :: a -> Param b -> Param a

Foldable Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => Param m -> m

foldMap :: Monoid m => (a -> m) -> Param a -> m

foldMap' :: Monoid m => (a -> m) -> Param a -> m

foldr :: (a -> b -> b) -> b -> Param a -> b

foldr' :: (a -> b -> b) -> b -> Param a -> b

foldl :: (b -> a -> b) -> b -> Param a -> b

foldl' :: (b -> a -> b) -> b -> Param a -> b

foldr1 :: (a -> a -> a) -> Param a -> a

foldl1 :: (a -> a -> a) -> Param a -> a

toList :: Param a -> [a]

null :: Param a -> Bool

length :: Param a -> Int

elem :: Eq a => a -> Param a -> Bool

maximum :: Ord a => Param a -> a

minimum :: Ord a => Param a -> a

sum :: Num a => Param a -> a

product :: Num a => Param a -> a

Traversable Param Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

sequenceA :: Applicative f => Param (f a) -> f (Param a)

mapM :: Monad m => (a -> m b) -> Param a -> m (Param b)

sequence :: Monad m => Param (m a) -> m (Param a)

FreeIn dec => FreeIn (Param dec) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: Param dec -> FV Source #

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

Defined in Futhark.IR.Prop.Types

Methods

declTypeOf :: Param dec -> DeclType Source #

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

Defined in Futhark.IR.Prop.Types

Methods

typeOf :: Param dec -> Type Source #

Rename dec => Rename (Param dec) Source # 
Instance details

Defined in Futhark.Transform.Rename

Methods

rename :: Param dec -> RenameM (Param dec) Source #

Substitute dec => Substitute (Param dec) Source # 
Instance details

Defined in Futhark.Transform.Substitute

Methods

substituteNames :: Map VName VName -> Param dec -> Param dec Source #

Show dec => Show (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

showsPrec :: Int -> Param dec -> ShowS

show :: Param dec -> String

showList :: [Param dec] -> ShowS

Eq dec => Eq (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

(==) :: Param dec -> Param dec -> Bool

(/=) :: Param dec -> Param dec -> Bool

Ord dec => Ord (Param dec) Source # 
Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: Param dec -> Param dec -> Ordering

(<) :: Param dec -> Param dec -> Bool

(<=) :: Param dec -> Param dec -> Bool

(>) :: Param dec -> Param dec -> Bool

(>=) :: Param dec -> Param dec -> Bool

max :: Param dec -> Param dec -> Param dec

min :: Param dec -> Param dec -> Param dec

Pretty t => Pretty (Param t) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Param t -> Doc ann Source #

prettyList :: [Param t] -> Doc ann Source #

type FParam rep = Param (FParamInfo rep) Source #

A function and loop parameter.

type LParam rep = Param (LParamInfo rep) Source #

A lambda parameter.

data FunDef rep Source #

Function definitions.

Constructors

FunDef 

Fields

Instances

Instances details
Scoped rep (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Scope

Methods

scopeOf :: FunDef rep -> Scope rep Source #

(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Prop.Names

Methods

freeIn' :: FunDef rep -> FV Source #

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

Defined in Futhark.Transform.Rename

Methods

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

RepTypes rep => Show (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> FunDef rep -> ShowS

show :: FunDef rep -> String

showList :: [FunDef rep] -> ShowS

RepTypes rep => Eq (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: FunDef rep -> FunDef rep -> Bool

(/=) :: FunDef rep -> FunDef rep -> Bool

RepTypes rep => Ord (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: FunDef rep -> FunDef rep -> Ordering

(<) :: FunDef rep -> FunDef rep -> Bool

(<=) :: FunDef rep -> FunDef rep -> Bool

(>) :: FunDef rep -> FunDef rep -> Bool

(>=) :: FunDef rep -> FunDef rep -> Bool

max :: FunDef rep -> FunDef rep -> FunDef rep

min :: FunDef rep -> FunDef rep -> FunDef rep

PrettyRep rep => Pretty (FunDef rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: FunDef rep -> Doc ann Source #

prettyList :: [FunDef rep] -> Doc ann Source #

data EntryParam Source #

An entry point parameter, comprising its name and original type.

Instances

Instances details
Show EntryParam Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> EntryParam -> ShowS

show :: EntryParam -> String

showList :: [EntryParam] -> ShowS

Eq EntryParam Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: EntryParam -> EntryParam -> Bool

(/=) :: EntryParam -> EntryParam -> Bool

Ord EntryParam Source # 
Instance details

Defined in Futhark.IR.Syntax

Pretty EntryParam Source # 
Instance details

Defined in Futhark.IR.Pretty

data EntryResult Source #

An entry point result type.

Instances

Instances details
Show EntryResult Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> EntryResult -> ShowS

show :: EntryResult -> String

showList :: [EntryResult] -> ShowS

Eq EntryResult Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: EntryResult -> EntryResult -> Bool

(/=) :: EntryResult -> EntryResult -> Bool

Ord EntryResult Source # 
Instance details

Defined in Futhark.IR.Syntax

Pretty EntryResult Source # 
Instance details

Defined in Futhark.IR.Pretty

type EntryPoint = (Name, [EntryParam], [EntryResult]) Source #

Information about the inputs and outputs (return value) of an entry point.

data Prog rep Source #

An entire Futhark program.

Constructors

Prog 

Fields

  • progTypes :: OpaqueTypes

    The opaque types used in entry points. This information is used to generate extra API functions for construction and deconstruction of values of these types.

  • progConsts :: Stms rep

    Top-level constants that are computed at program startup, and which are in scope inside all functions.

  • progFuns :: [FunDef rep]

    The functions comprising the program. All functions are also available in scope in the definitions of the constants, so be careful not to introduce circular dependencies (not currently checked).

Instances

Instances details
RepTypes rep => Show (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

showsPrec :: Int -> Prog rep -> ShowS

show :: Prog rep -> String

showList :: [Prog rep] -> ShowS

RepTypes rep => Eq (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

(==) :: Prog rep -> Prog rep -> Bool

(/=) :: Prog rep -> Prog rep -> Bool

RepTypes rep => Ord (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Prog rep -> Prog rep -> Ordering

(<) :: Prog rep -> Prog rep -> Bool

(<=) :: Prog rep -> Prog rep -> Bool

(>) :: Prog rep -> Prog rep -> Bool

(>=) :: Prog rep -> Prog rep -> Bool

max :: Prog rep -> Prog rep -> Prog rep

min :: Prog rep -> Prog rep -> Prog rep

PrettyRep rep => Pretty (Prog rep) Source # 
Instance details

Defined in Futhark.IR.Pretty

Methods

pretty :: Prog rep -> Doc ann Source #

prettyList :: [Prog rep] -> Doc ann Source #

Utils

oneStm :: Stm rep -> Stms rep Source #

A single statement.

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

Convert a statement list to a statement sequence.

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

Convert a statement sequence to a statement list.

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

The first statement in the sequence, if any.

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

The last statement in the sequence, if any.

subExpRes :: SubExp -> SubExpRes Source #

Construct a SubExpRes with no certificates.

subExpsRes :: [SubExp] -> Result Source #

Construct a Result from subexpressions.

varRes :: VName -> SubExpRes Source #

Construct a SubExpRes from a variable name.

varsRes :: [VName] -> Result Source #

Construct a Result from variable names.

subExpResVName :: SubExpRes -> Maybe VName Source #

The VName of a SubExpRes, if it exists.