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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.IR.Syntax

Contents

- Types
- Abstract syntax tree
- Definitions
- Utils

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 `Name`s, 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

- module Language.Futhark.Core
- prettyString :: Pretty a => a -> String
- prettyStringOneLine :: Pretty a => a -> String
- prettyText :: Pretty a => a -> Text
- prettyTextOneLine :: Pretty a => a -> Text
- class Pretty a
- module Futhark.IR.Rep
- module Futhark.IR.Syntax.Core
- data Uniqueness
  - = Nonunique
  - | Unique
- data NoUniqueness = NoUniqueness
- newtype Rank = Rank Int
- class (Monoid a, Eq a, Ord a) => ArrayShape a where
  - shapeRank :: a -> Int
  - subShapeOf :: a -> a -> Bool
- data Space
  - = DefaultSpace
  - | Space SpaceId
  - | ScalarSpace [SubExp] PrimType
- data TypeBase shape u
  - = Prim PrimType
  - | Acc VName Shape [Type] u
  - | Array PrimType shape u
  - | Mem Space
- data Diet
  - = Consume
  - | Observe
  - | ObservePrim
- data Ident = Ident {
  - identName :: VName
  - identType :: Type
  }
- data SubExp
  - = Constant PrimValue
  - | Var VName
- data PatElem dec = PatElem {
  - patElemName :: VName
  - patElemDec :: dec
  }
- newtype Pat dec = Pat {
  - patElems :: [PatElem dec]
  }
- data StmAux dec = StmAux {
  - stmAuxCerts :: !Certs
  - stmAuxAttrs :: Attrs
  - stmAuxLoc :: Provenance
  - stmAuxDec :: dec
  }
- data Stm rep = Let {
  - stmPat :: Pat (LetDec rep)
  - stmAux :: StmAux (ExpDec rep)
  - stmExp :: Exp rep
  }
- type Stms rep = Seq (Stm rep)
- data SubExpRes = SubExpRes {
  - resCerts :: Certs
  - resSubExp :: SubExp
  }
- type Result = [SubExpRes]
- data Body rep = Body {
  - bodyDec :: BodyDec rep
  - bodyStms :: Stms rep
  - bodyResult :: Result
  }
- data BasicOp
  - = SubExp SubExp
  - | Opaque OpaqueOp SubExp
  - | ArrayLit [SubExp] Type
  - | ArrayVal [PrimValue] PrimType
  - | UnOp UnOp SubExp
  - | BinOp BinOp SubExp SubExp
  - | CmpOp CmpOp SubExp SubExp
  - | ConvOp ConvOp SubExp
  - | Assert SubExp (ErrorMsg SubExp)
  - | Index VName (Slice SubExp)
  - | Update Safety VName (Slice SubExp) SubExp
  - | FlatIndex VName (FlatSlice SubExp)
  - | FlatUpdate VName (FlatSlice SubExp) VName
  - | Concat Int (NonEmpty VName) SubExp
  - | Manifest VName [Int]
  - | Iota SubExp SubExp SubExp IntType
  - | Replicate Shape SubExp
  - | Scratch PrimType [SubExp]
  - | Reshape VName (NewShape SubExp)
  - | Rearrange VName [Int]
  - | UpdateAcc Safety VName [SubExp] [SubExp]
- data UnOp
  - = Neg PrimType
  - | Complement IntType
  - | Abs IntType
  - | FAbs FloatType
  - | SSignum IntType
  - | USignum IntType
  - | FSignum FloatType
- data BinOp
  - = Add IntType Overflow
  - | FAdd FloatType
  - | Sub IntType Overflow
  - | FSub FloatType
  - | Mul IntType Overflow
  - | FMul FloatType
  - | UDiv IntType Safety
  - | UDivUp IntType Safety
  - | SDiv IntType Safety
  - | SDivUp IntType Safety
  - | FDiv FloatType
  - | FMod FloatType
  - | UMod IntType Safety
  - | SMod IntType Safety
  - | SQuot IntType Safety
  - | SRem IntType Safety
  - | SMin IntType
  - | UMin IntType
  - | FMin FloatType
  - | SMax IntType
  - | UMax IntType
  - | FMax FloatType
  - | Shl IntType
  - | LShr IntType
  - | AShr IntType
  - | And IntType
  - | Or IntType
  - | Xor IntType
  - | Pow IntType
  - | FPow FloatType
  - | LogAnd
  - | LogOr
- data CmpOp
  - = CmpEq PrimType
  - | CmpUlt IntType
  - | CmpUle IntType
  - | CmpSlt IntType
  - | CmpSle IntType
  - | FCmpLt FloatType
  - | FCmpLe FloatType
  - | CmpLlt
  - | CmpLle
- data ConvOp
  - = ZExt IntType IntType
  - | SExt IntType IntType
  - | FPConv FloatType FloatType
  - | FPToUI FloatType IntType
  - | FPToSI FloatType IntType
  - | UIToFP IntType FloatType
  - | SIToFP IntType FloatType
  - | FPToBits FloatType
  - | BitsToFP FloatType
  - | IToB IntType
  - | BToI IntType
  - | FToB FloatType
  - | BToF FloatType
- data OpaqueOp
  - = OpaqueNil
  - | OpaqueTrace Text
- data DimSplice d = DimSplice Int Int (ShapeBase d)
- data NewShape d = NewShape {
  - dimSplices :: [DimSplice d]
  - newShape :: ShapeBase d
  }
- type WithAccInput rep = (Shape, [VName], Maybe (Lambda rep, [SubExp]))
- data Exp rep
  - = BasicOp BasicOp
  - | Apply Name [(SubExp, Diet)] [(RetType rep, RetAls)] Safety
  - | Match [SubExp] [Case (Body rep)] (Body rep) (MatchDec (BranchType rep))
  - | Loop [(FParam rep, SubExp)] LoopForm (Body rep)
  - | WithAcc [WithAccInput rep] (Lambda rep)
  - | Op (Op rep)
- data Case body = Case {
  - casePat :: [Maybe PrimValue]
  - caseBody :: body
  }
- data LoopForm
  - = ForLoop VName IntType SubExp
  - | WhileLoop VName
- data MatchDec rt = MatchDec {
  - matchReturns :: [rt]
  - matchSort :: MatchSort
  }
- data MatchSort
  - = MatchNormal
  - | MatchFallback
  - | MatchEquiv
- data Safety
  - = Unsafe
  - | Safe
- data Lambda rep = Lambda {
  - lambdaParams :: [LParam rep]
  - lambdaReturnType :: [Type]
  - lambdaBody :: Body rep
  }
- data RetAls = RetAls {
  - paramAls :: [Int]
  - otherAls :: [Int]
  }
- data Param dec = Param {
  - paramAttrs :: Attrs
  - paramName :: VName
  - paramDec :: dec
  }
- type FParam rep = Param (FParamInfo rep)
- type LParam rep = Param (LParamInfo rep)
- data FunDef rep = FunDef {
  - funDefEntryPoint :: Maybe EntryPoint
  - funDefAttrs :: Attrs
  - funDefName :: Name
  - funDefRetType :: [(RetType rep, RetAls)]
  - funDefParams :: [FParam rep]
  - funDefBody :: Body rep
  }
- data EntryParam = EntryParam {
  - entryParamName :: Name
  - entryParamUniqueness :: Uniqueness
  - entryParamType :: EntryPointType
  }
- data EntryResult = EntryResult {
  - entryResultUniqueness :: Uniqueness
  - entryResultType :: EntryPointType
  }
- type EntryPoint = (Name, [EntryParam], [EntryResult])
- data Prog rep = Prog {
  - progTypes :: OpaqueTypes
  - progConsts :: Stms rep
  - progFuns :: [FunDef rep]
  }
- oneStm :: Stm rep -> Stms rep
- stmsFromList :: [Stm rep] -> Stms rep
- stmsToList :: Stms rep -> [Stm rep]
- stmsHead :: Stms rep -> Maybe (Stm rep, Stms rep)
- stmsLast :: Stms lore -> Maybe (Stms lore, Stm lore)
- subExpRes :: SubExp -> SubExpRes
- subExpsRes :: [SubExp] -> Result
- varRes :: VName -> SubExpRes
- varsRes :: [VName] -> Result
- subExpResVName :: SubExpRes -> Maybe VName

# Documentation

module Language.Futhark.Core

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 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 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 Methods pretty :: ArrayTransform -> Doc ann Source # prettyList :: [ArrayTransform] -> Doc ann Source #
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 Methods pretty :: MemAliases -> Doc ann Source # prettyList :: [MemAliases] -> Doc ann Source #
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 Methods pretty :: PyClassDef -> Doc ann Source # prettyList :: [PyClassDef] -> Doc ann Source #
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 Methods pretty :: ArrayContents -> Doc ann Source # prettyList :: [ArrayContents] -> Doc ann Source #
Pretty EntryPoint Source # |
Instance details Defined in Futhark.CodeGen.ImpCode Methods pretty :: EntryPoint -> Doc ann Source # prettyList :: [EntryPoint] -> Doc ann Source #
Pretty ExternalValue Source # |
Instance details Defined in Futhark.CodeGen.ImpCode Methods pretty :: ExternalValue -> Doc ann Source # prettyList :: [ExternalValue] -> Doc ann Source #
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 Methods pretty :: KernelConst -> Doc ann Source # prettyList :: [KernelConst] -> Doc ann Source #
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 Methods pretty :: ParallelTask -> Doc ann Source # prettyList :: [ParallelTask] -> Doc ann Source #
Pretty SchedulerInfo Source # |
Instance details Defined in Futhark.CodeGen.ImpCode.Multicore Methods pretty :: SchedulerInfo -> Doc ann Source # prettyList :: [SchedulerInfo] -> Doc ann Source #
Pretty Scheduling Source # |
Instance details Defined in Futhark.CodeGen.ImpCode.Multicore Methods pretty :: Scheduling -> Doc ann Source # prettyList :: [Scheduling] -> Doc ann Source #
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 Methods pretty :: Sequential -> Doc ann Source # prettyList :: [Sequential] -> Doc ann Source #
Pretty DeviceInfo Source # |
Instance details Defined in Futhark.CodeGen.OpenCL.Heuristics Methods pretty :: DeviceInfo -> Doc ann Source # prettyList :: [DeviceInfo] -> Doc ann Source #
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 Methods pretty :: KernelGrid -> Doc ann Source # prettyList :: [KernelGrid] -> Doc ann Source #
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 Methods pretty :: KernelResult -> Doc ann Source # prettyList :: [KernelResult] -> Doc ann Source #
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 Methods pretty :: EntryParam -> Doc ann Source # prettyList :: [EntryParam] -> Doc ann Source #
Pretty EntryResult Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: EntryResult -> Doc ann Source # prettyList :: [EntryResult] -> Doc ann Source #
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 Methods pretty :: Commutativity -> Doc ann Source # prettyList :: [Commutativity] -> Doc ann Source #
Pretty EntryPointType Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: EntryPointType -> Doc ann Source # prettyList :: [EntryPointType] -> Doc ann Source #
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 Methods pretty :: OpaqueType -> Doc ann Source # prettyList :: [OpaqueType] -> Doc ann Source #
Pretty OpaqueTypes Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: OpaqueTypes -> Doc ann Source # prettyList :: [OpaqueTypes] -> Doc ann Source #
Pretty Provenance Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: Provenance -> Doc ann Source # prettyList :: [Provenance] -> Doc ann Source #
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 Methods pretty :: Signedness -> Doc ann Source # prettyList :: [Signedness] -> Doc ann Source #
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 Methods pretty :: AccessSummary -> Doc ann Source # prettyList :: [AccessSummary] -> Doc ann Source #
Pretty ArrayMemBound Source # |
Instance details Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs Methods pretty :: ArrayMemBound -> Doc ann Source # prettyList :: [ArrayMemBound] -> Doc ann Source #
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 Methods pretty :: CoalescedKind -> Doc ann Source # prettyList :: [CoalescedKind] -> Doc ann Source #
Pretty CoalsEntry Source # |
Instance details Defined in Futhark.Optimise.ArrayShortCircuiting.DataStructs Methods pretty :: CoalsEntry -> Doc ann Source # prettyList :: [CoalsEntry] -> Doc ann Source #
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 Methods pretty :: ScriptValueType -> Doc ann Source # prettyList :: [ScriptValueType] -> Doc ann Source #
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 Methods pretty :: NoUniqueness -> Doc ann Source # prettyList :: [NoUniqueness] -> Doc ann Source #
Pretty Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods pretty :: Uniqueness -> Doc ann Source # prettyList :: [Uniqueness] -> Doc ann Source #
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 Methods pretty :: FloatValue -> Doc ann Source # prettyList :: [FloatValue] -> Doc ann Source #
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 Methods pretty :: Liftedness -> Doc ann Source # prettyList :: [Liftedness] -> Doc ann Source #
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 Methods pretty :: BreadCrumbs -> Doc ann Source # prettyList :: [BreadCrumbs] -> Doc ann Source #
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 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 `Doc` 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 #

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 (NonEmpty a) |
Instance details Defined in Prettyprinter.Internal Methods pretty :: NonEmpty a -> Doc ann Source # prettyList :: [NonEmpty a] -> 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 Int64) Source # |
Instance details Defined in Language.Futhark.Pretty Methods pretty :: Shape Int64 -> Doc ann Source # prettyList :: [Shape Int64] -> 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 ()) 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 (Maybe a)

Ignore `Nothing`s, 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 Methods pretty :: TypeBase ExtShape u -> Doc ann Source # prettyList :: [TypeBase ExtShape u] -> 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 #
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 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 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 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 #

module Futhark.IR.Rep

module Futhark.IR.Syntax.Core

# 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

Monoid Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods mempty :: Uniqueness Source # mappend :: Uniqueness -> Uniqueness -> Uniqueness Source # mconcat :: [Uniqueness] -> Uniqueness Source #
Semigroup Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods (<>) :: Uniqueness -> Uniqueness -> Uniqueness Source # sconcat :: NonEmpty Uniqueness -> Uniqueness Source # stimes :: Integral b => b -> Uniqueness -> Uniqueness Source #
Show Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods showsPrec :: Int -> Uniqueness -> ShowS Source # show :: Uniqueness -> String Source # showList :: [Uniqueness] -> ShowS Source #
DeclExtTyped DeclExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods declExtTypeOf :: DeclExtType -> DeclExtType Source #
DeclTyped DeclType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods declTypeOf :: DeclType -> DeclType Source #
ExtTyped DeclExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: DeclExtType -> ExtType Source #
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 Methods primRetType :: PrimType -> DeclExtType Source # applyRetType :: Typed dec => [DeclExtType] -> [Param dec] -> [(SubExp, Type)] -> Maybe [DeclExtType] Source #
ASTMappable ResRetType Source # |
Instance details Defined in Language.Futhark.Traversals Methods astMap :: Monad m => ASTMapper m -> ResRetType -> m ResRetType Source #
Eq Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods (==) :: Uniqueness -> Uniqueness -> Bool Source # (/=) :: Uniqueness -> Uniqueness -> Bool Source #
Ord Uniqueness Source # |

Instance details

Defined in Language.Futhark.Core

Methods

compare :: Uniqueness -> Uniqueness -> Ordering Source #

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

(<=) :: Uniqueness -> Uniqueness -> Bool Source #

(>) :: Uniqueness -> Uniqueness -> Bool Source #

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

max :: Uniqueness -> Uniqueness -> Uniqueness Source #

min :: Uniqueness -> Uniqueness -> Uniqueness Source #

Pretty Uniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods pretty :: Uniqueness -> Doc ann Source # prettyList :: [Uniqueness] -> Doc ann Source #
Simplifiable [FunReturns] Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => [FunReturns] -> SimpleM rep [FunReturns] Source #
ASTMappable (TypeBase Size Uniqueness) Source # |
Instance details Defined in Language.Futhark.Traversals Methods astMap :: Monad m => ASTMapper m -> TypeBase Size Uniqueness -> m (TypeBase Size Uniqueness) Source #
Substitutable (RetTypeBase Size Uniqueness) Source # |
Instance details Defined in Language.Futhark.TypeChecker.Types Methods applySubst :: TypeSubs -> RetTypeBase Size Uniqueness -> RetTypeBase Size Uniqueness Source #
Substitutable (TypeBase Size Uniqueness) Source # |
Instance details Defined in Language.Futhark.TypeChecker.Types Methods applySubst :: TypeSubs -> TypeBase Size Uniqueness -> TypeBase Size Uniqueness Source #
FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declExtTypeOf :: MemInfo ExtSize Uniqueness ret -> DeclExtType Source #
DeclTyped (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declTypeOf :: MemInfo SubExp Uniqueness ret -> DeclType Source #
FixExt ret => ExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize Uniqueness ret -> ExtType Source #
Typed (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods typeOf :: MemInfo SubExp Uniqueness ret -> Type Source #

data NoUniqueness Source #

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

Constructors

NoUniqueness |

#### Instances

Instances details

Monoid NoUniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods mempty :: NoUniqueness Source # mappend :: NoUniqueness -> NoUniqueness -> NoUniqueness Source # mconcat :: [NoUniqueness] -> NoUniqueness Source #
Semigroup NoUniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods (<>) :: NoUniqueness -> NoUniqueness -> NoUniqueness Source # sconcat :: NonEmpty NoUniqueness -> NoUniqueness Source # stimes :: Integral b => b -> NoUniqueness -> NoUniqueness Source #
Show NoUniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods showsPrec :: Int -> NoUniqueness -> ShowS Source # show :: NoUniqueness -> String Source # showList :: [NoUniqueness] -> ShowS Source #
HasLetDecMem LetDecMem Source # |
Instance details Defined in Futhark.IR.Mem Methods letDecMem :: LetDecMem -> LetDecMem Source #
ExtTyped ExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: ExtType -> ExtType 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 Methods primBodyType :: PrimType -> BodyReturns Source #
IsBodyType ExtType Source # |
Instance details Defined in Futhark.IR.RetType Methods primBodyType :: PrimType -> ExtType Source #
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 Methods applySubst :: TypeSubs -> StructType -> StructType Source #
Eq NoUniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods (==) :: NoUniqueness -> NoUniqueness -> Bool Source # (/=) :: NoUniqueness -> NoUniqueness -> Bool Source #
Ord NoUniqueness Source # |

Instance details

Defined in Language.Futhark.Core

Methods

compare :: NoUniqueness -> NoUniqueness -> Ordering Source #

(<) :: NoUniqueness -> NoUniqueness -> Bool Source #

(<=) :: NoUniqueness -> NoUniqueness -> Bool Source #

(>) :: NoUniqueness -> NoUniqueness -> Bool Source #

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

max :: NoUniqueness -> NoUniqueness -> NoUniqueness Source #

min :: NoUniqueness -> NoUniqueness -> NoUniqueness Source #

Pretty NoUniqueness Source # |
Instance details Defined in Language.Futhark.Core Methods pretty :: NoUniqueness -> Doc ann Source # prettyList :: [NoUniqueness] -> Doc ann Source #
Substitutable (Pat StructType) Source # |
Instance details Defined in Language.Futhark.TypeChecker.Types Methods applySubst :: TypeSubs -> Pat StructType -> Pat StructType Source #
Substitutable (RetTypeBase Size NoUniqueness) Source # |
Instance details Defined in Language.Futhark.TypeChecker.Types Methods applySubst :: TypeSubs -> RetTypeBase Size NoUniqueness -> RetTypeBase Size NoUniqueness Source #
FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize NoUniqueness ret -> ExtType Source #
Typed (MemInfo SubExp NoUniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods typeOf :: MemInfo SubExp NoUniqueness ret -> Type Source #
ASTMappable (PatBase Info VName StructType) Source # |
Instance details Defined in Language.Futhark.Traversals Methods astMap :: Monad m => ASTMapper m -> PatBase Info VName StructType -> m (PatBase Info VName StructType) Source #
ASTMappable (IdentBase Info VName StructType) Source # |
Instance details Defined in Language.Futhark.Traversals Methods astMap :: Monad m => ASTMapper m -> IdentBase Info VName StructType -> m (IdentBase Info VName StructType) Source #

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

Monoid Rank Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods mempty :: Rank Source # mappend :: Rank -> Rank -> Rank Source # mconcat :: [Rank] -> Rank Source #
Semigroup Rank Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (<>) :: Rank -> Rank -> Rank Source # sconcat :: NonEmpty Rank -> Rank Source # stimes :: Integral b => b -> Rank -> Rank Source #
Show Rank Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> Rank -> ShowS Source # show :: Rank -> String Source # showList :: [Rank] -> ShowS Source #
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 Methods rename :: Rank -> RenameM Rank Source #
Substitute Rank Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Rank -> Rank Source #
Eq Rank Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: Rank -> Rank -> Bool Source # (/=) :: Rank -> Rank -> Bool Source #
Ord Rank Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods compare :: Rank -> Rank -> Ordering Source # (<) :: Rank -> Rank -> Bool Source # (<=) :: Rank -> Rank -> Bool Source # (>) :: Rank -> Rank -> Bool Source # (>=) :: Rank -> Rank -> Bool Source # max :: Rank -> Rank -> Rank Source # min :: Rank -> Rank -> Rank Source #
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 Methods shapeRank :: ShapeBase ExtSize -> Int Source # subShapeOf :: ShapeBase ExtSize -> ShapeBase ExtSize -> Bool Source #
ArrayShape (ShapeBase SubExp) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods shapeRank :: ShapeBase SubExp -> Int Source # subShapeOf :: ShapeBase SubExp -> ShapeBase SubExp -> Bool Source #

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

Show Space Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> Space -> ShowS Source # show :: Space -> String Source # showList :: [Space] -> ShowS Source #
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 Methods simplify :: SimplifiableRep rep => Space -> SimpleM rep Space Source #
Eq Space Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: Space -> Space -> Bool Source # (/=) :: Space -> Space -> Bool Source #
Ord Space Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods compare :: Space -> Space -> Ordering Source # (<) :: Space -> Space -> Bool Source # (<=) :: Space -> Space -> Bool Source # (>) :: Space -> Space -> Bool Source # (>=) :: Space -> Space -> Bool Source # max :: Space -> Space -> Space Source # min :: Space -> Space -> Space Source #
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 Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> TypeBase a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> TypeBase a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> TypeBase a b -> c Source #
Bifunctor TypeBase Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods bimap :: (a -> b) -> (c -> d) -> TypeBase a c -> TypeBase b d Source # first :: (a -> b) -> TypeBase a c -> TypeBase b c Source # second :: (b -> c) -> TypeBase a b -> TypeBase a c Source #
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) Source #
DeclExtTyped DeclExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods declExtTypeOf :: DeclExtType -> DeclExtType Source #
DeclTyped DeclType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods declTypeOf :: DeclType -> DeclType Source #
ExtTyped DeclExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: DeclExtType -> ExtType Source #
ExtTyped ExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: ExtType -> ExtType Source #
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 Methods primBodyType :: PrimType -> ExtType Source #
IsRetType DeclExtType Source # |
Instance details Defined in Futhark.IR.RetType Methods primRetType :: PrimType -> DeclExtType Source # applyRetType :: Typed dec => [DeclExtType] -> [Param dec] -> [(SubExp, Type)] -> Maybe [DeclExtType] Source #
Foldable (TypeBase shape) Source # |

Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

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

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

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

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

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

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

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

toList :: TypeBase shape a -> [a] Source #

null :: TypeBase shape a -> Bool Source #

length :: TypeBase shape a -> Int Source #

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

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

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

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

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

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) Source # sequenceA :: Applicative f => TypeBase shape (f a) -> f (TypeBase shape a) Source # mapM :: Monad m => (a -> m b) -> TypeBase shape a -> m (TypeBase shape b) Source # sequence :: Monad m => TypeBase shape (m a) -> m (TypeBase shape a) Source #
Functor (TypeBase shape) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods fmap :: (a -> b) -> TypeBase shape a -> TypeBase shape b Source # (<$) :: a -> TypeBase shape b -> TypeBase shape a 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 Source # show :: TypeBase shape u -> String Source # showList :: [TypeBase shape u] -> ShowS Source #
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 #
(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 Source # (/=) :: TypeBase shape u -> TypeBase shape u -> Bool Source #
(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 Source #

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

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

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

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

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

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

Pretty u => Pretty (TypeBase ExtShape u) Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: TypeBase ExtShape u -> Doc ann Source # prettyList :: [TypeBase ExtShape u] -> 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 #
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 Source # show :: Diet -> String Source # showList :: [Diet] -> ShowS Source #
Eq Diet Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: Diet -> Diet -> Bool Source # (/=) :: Diet -> Diet -> Bool Source #
Ord Diet Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods compare :: Diet -> Diet -> Ordering Source # (<) :: Diet -> Diet -> Bool Source # (<=) :: Diet -> Diet -> Bool Source # (>) :: Diet -> Diet -> Bool Source # (>=) :: Diet -> Diet -> Bool Source # max :: Diet -> Diet -> Diet Source # min :: Diet -> Diet -> Diet Source #

# 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

- identName :: VName
- identType :: Type

#### Instances

Instances details

Show Ident Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> Ident -> ShowS Source # show :: Ident -> String Source # showList :: [Ident] -> ShowS Source #
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 Methods rename :: Ident -> RenameM Ident Source #
Substitute Ident Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> Ident -> Ident Source #
Eq Ident Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: Ident -> Ident -> Bool Source # (/=) :: Ident -> Ident -> Bool Source #
Ord Ident Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods compare :: Ident -> Ident -> Ordering Source # (<) :: Ident -> Ident -> Bool Source # (<=) :: Ident -> Ident -> Bool Source # (>) :: Ident -> Ident -> Bool Source # (>=) :: Ident -> Ident -> Bool Source # max :: Ident -> Ident -> Ident Source # min :: Ident -> Ident -> Ident Source #
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

Show SubExp Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> SubExp -> ShowS Source # show :: SubExp -> String Source # showList :: [SubExp] -> ShowS Source #
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 Methods letDecMem :: LetDecMem -> LetDecMem Source #
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 Methods declExtTypeOf :: DeclExtType -> DeclExtType Source #
DeclTyped DeclType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods declTypeOf :: DeclType -> DeclType Source #
ExtTyped DeclExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: DeclExtType -> ExtType Source #
ExtTyped ExtType Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods extTypeOf :: ExtType -> ExtType Source #
FixExt ExtSize Source # |
Instance details Defined in Futhark.IR.Prop.Types Methods fixExt :: Int -> SubExp -> ExtSize -> ExtSize Source # mapExt :: (Int -> Int) -> ExtSize -> ExtSize Source #
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 Methods primBodyType :: PrimType -> BodyReturns Source #
IsBodyType ExtType Source # |
Instance details Defined in Futhark.IR.RetType Methods primBodyType :: PrimType -> ExtType 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 Methods primRetType :: PrimType -> DeclExtType Source # applyRetType :: Typed dec => [DeclExtType] -> [Param dec] -> [(SubExp, Type)] -> Maybe [DeclExtType] Source #
Simplifiable ExtSize Source # |
Instance details Defined in Futhark.Optimise.Simplify.Engine Methods simplify :: SimplifiableRep rep => ExtSize -> SimpleM rep ExtSize Source #
Simplifiable SubExp Source # |
Instance details Defined in Futhark.Optimise.Simplify.Engine Methods simplify :: SimplifiableRep rep => SubExp -> SimpleM rep SubExp Source #
Rename ExtSize Source # |
Instance details Defined in Futhark.Transform.Rename Methods rename :: ExtSize -> RenameM ExtSize Source #
Rename SubExp Source # |
Instance details Defined in Futhark.Transform.Rename Methods rename :: SubExp -> RenameM SubExp Source #
Substitute SubExp Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> SubExp -> SubExp Source #
Eq SubExp Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: SubExp -> SubExp -> Bool Source # (/=) :: SubExp -> SubExp -> Bool Source #
Ord SubExp Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods compare :: SubExp -> SubExp -> Ordering Source # (<) :: SubExp -> SubExp -> Bool Source # (<=) :: SubExp -> SubExp -> Bool Source # (>) :: SubExp -> SubExp -> Bool Source # (>=) :: SubExp -> SubExp -> Bool Source # max :: SubExp -> SubExp -> SubExp Source # min :: SubExp -> SubExp -> SubExp Source #
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 Methods shapeRank :: ShapeBase ExtSize -> Int Source # subShapeOf :: ShapeBase ExtSize -> ShapeBase ExtSize -> Bool Source #
ArrayShape (ShapeBase SubExp) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods shapeRank :: ShapeBase SubExp -> Int Source # subShapeOf :: ShapeBase SubExp -> ShapeBase SubExp -> Bool Source #
Simplifiable [FunReturns] Source # |
Instance details Defined in Futhark.IR.Mem Methods simplify :: SimplifiableRep rep => [FunReturns] -> SimpleM rep [FunReturns] Source #
Pretty u => Pretty (TypeBase ExtShape u) Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: TypeBase ExtShape u -> Doc ann Source # prettyList :: [TypeBase ExtShape 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 #
FixExt ret => DeclExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declExtTypeOf :: MemInfo ExtSize Uniqueness ret -> DeclExtType Source #
DeclTyped (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods declTypeOf :: MemInfo SubExp Uniqueness ret -> DeclType Source #
FixExt ret => ExtTyped (MemInfo ExtSize NoUniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize NoUniqueness ret -> ExtType Source #
FixExt ret => ExtTyped (MemInfo ExtSize Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods extTypeOf :: MemInfo ExtSize Uniqueness ret -> ExtType Source #
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 Methods typeOf :: MemInfo SubExp NoUniqueness ret -> Type Source #
Typed (MemInfo SubExp Uniqueness ret) Source # |
Instance details Defined in Futhark.IR.Mem Methods typeOf :: MemInfo SubExp Uniqueness ret -> Type Source #

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

- patElemName :: VName

  The name being bound.

- patElemDec :: dec

  Pat element decoration.

#### Instances

Instances details

Foldable PatElem Source # |

Instance details

Defined in Futhark.IR.Syntax.Core

Methods

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

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

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

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

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

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

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

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

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

toList :: PatElem a -> [a] Source #

null :: PatElem a -> Bool Source #

length :: PatElem a -> Int Source #

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

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

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

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

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

Traversable PatElem Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods traverse :: Applicative f => (a -> f b) -> PatElem a -> f (PatElem b) Source # sequenceA :: Applicative f => PatElem (f a) -> f (PatElem a) Source # mapM :: Monad m => (a -> m b) -> PatElem a -> m (PatElem b) Source # sequence :: Monad m => PatElem (m a) -> m (PatElem a) Source #
Functor PatElem Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods fmap :: (a -> b) -> PatElem a -> PatElem b Source # (<$) :: a -> PatElem b -> PatElem a Source #
Show dec => Show (PatElem dec) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> PatElem dec -> ShowS Source # show :: PatElem dec -> String Source # showList :: [PatElem dec] -> ShowS Source #
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 #
Eq dec => Eq (PatElem dec) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: PatElem dec -> PatElem dec -> Bool Source # (/=) :: PatElem dec -> PatElem dec -> Bool Source #
Ord dec => Ord (PatElem dec) Source # |

Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: PatElem dec -> PatElem dec -> Ordering Source #

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

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

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

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

max :: PatElem dec -> PatElem dec -> PatElem dec Source #

min :: PatElem dec -> PatElem dec -> PatElem dec 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 #

newtype Pat dec Source #

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

Constructors

Pat |

Fields

- patElems :: [PatElem dec]

#### Instances

Instances details

Foldable Pat Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

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

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

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

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

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

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

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

toList :: Pat a -> [a] Source #

null :: Pat a -> Bool Source #

length :: Pat a -> Int Source #

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

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

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

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

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

Traversable Pat Source # |
Instance details Defined in Futhark.IR.Syntax Methods traverse :: Applicative f => (a -> f b) -> Pat a -> f (Pat b) Source # sequenceA :: Applicative f => Pat (f a) -> f (Pat a) Source # mapM :: Monad m => (a -> m b) -> Pat a -> m (Pat b) Source # sequence :: Monad m => Pat (m a) -> m (Pat a) Source #
Functor Pat Source # |
Instance details Defined in Futhark.IR.Syntax Methods fmap :: (a -> b) -> Pat a -> Pat b Source # (<$) :: a -> Pat b -> Pat a Source #
Monoid (Pat dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods mempty :: Pat dec Source # mappend :: Pat dec -> Pat dec -> Pat dec Source # mconcat :: [Pat dec] -> Pat dec Source #
Semigroup (Pat dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (<>) :: Pat dec -> Pat dec -> Pat dec Source # sconcat :: NonEmpty (Pat dec) -> Pat dec Source # stimes :: Integral b => b -> Pat dec -> Pat dec Source #
Show dec => Show (Pat dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Pat dec -> ShowS Source # show :: Pat dec -> String Source # showList :: [Pat dec] -> ShowS Source #
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 #
Eq dec => Eq (Pat dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Pat dec -> Pat dec -> Bool Source # (/=) :: Pat dec -> Pat dec -> Bool Source #
Ord dec => Ord (Pat dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: Pat dec -> Pat dec -> Ordering Source # (<) :: Pat dec -> Pat dec -> Bool Source # (<=) :: Pat dec -> Pat dec -> Bool Source # (>) :: Pat dec -> Pat dec -> Bool Source # (>=) :: Pat dec -> Pat dec -> Bool Source # max :: Pat dec -> Pat dec -> Pat dec Source # min :: Pat dec -> Pat dec -> Pat dec 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 #

data StmAux dec Source #

Auxilliary Information associated with a statement.

Constructors

StmAux |

Fields

- stmAuxCerts :: !Certs
- stmAuxAttrs :: Attrs
- stmAuxLoc :: Provenance
- stmAuxDec :: dec

#### Instances

Instances details

Foldable StmAux Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

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

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

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

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

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

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

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

toList :: StmAux a -> [a] Source #

null :: StmAux a -> Bool Source #

length :: StmAux a -> Int Source #

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

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

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

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

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

Traversable StmAux Source # |
Instance details Defined in Futhark.IR.Syntax Methods traverse :: Applicative f => (a -> f b) -> StmAux a -> f (StmAux b) Source # sequenceA :: Applicative f => StmAux (f a) -> f (StmAux a) Source # mapM :: Monad m => (a -> m b) -> StmAux a -> m (StmAux b) Source # sequence :: Monad m => StmAux (m a) -> m (StmAux a) Source #
Functor StmAux Source # |
Instance details Defined in Futhark.IR.Syntax Methods fmap :: (a -> b) -> StmAux a -> StmAux b Source # (<$) :: a -> StmAux b -> StmAux a Source #
Monoid dec => Monoid (StmAux dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods mempty :: StmAux dec Source # mappend :: StmAux dec -> StmAux dec -> StmAux dec Source # mconcat :: [StmAux dec] -> StmAux dec Source #
Semigroup dec => Semigroup (StmAux dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (<>) :: StmAux dec -> StmAux dec -> StmAux dec Source # sconcat :: NonEmpty (StmAux dec) -> StmAux dec Source # stimes :: Integral b => b -> StmAux dec -> StmAux dec Source #
Show dec => Show (StmAux dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> StmAux dec -> ShowS Source # show :: StmAux dec -> String Source # showList :: [StmAux dec] -> ShowS Source #
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 #
Eq dec => Eq (StmAux dec) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: StmAux dec -> StmAux dec -> Bool Source # (/=) :: StmAux dec -> StmAux dec -> Bool Source #
Ord dec => Ord (StmAux dec) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: StmAux dec -> StmAux dec -> Ordering Source #

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

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

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

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

max :: StmAux dec -> StmAux dec -> StmAux dec Source #

min :: StmAux dec -> StmAux dec -> StmAux dec 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 #

data Stm rep Source #

A local variable binding.

Constructors

Let |

Fields

- stmPat :: Pat (LetDec rep)

  Pat.

- stmAux :: StmAux (ExpDec rep)

  Auxiliary information statement.

- stmExp :: Exp rep

  Expression.

#### 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 #
RepTypes rep => Show (Stm rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Stm rep -> ShowS Source # show :: Stm rep -> String Source # showList :: [Stm rep] -> ShowS 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 => Eq (Stm rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Stm rep -> Stm rep -> Bool Source # (/=) :: Stm rep -> Stm rep -> Bool Source #
RepTypes rep => Ord (Stm rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: Stm rep -> Stm rep -> Ordering Source # (<) :: Stm rep -> Stm rep -> Bool Source # (<=) :: Stm rep -> Stm rep -> Bool Source # (>) :: Stm rep -> Stm rep -> Bool Source # (>=) :: Stm rep -> Stm rep -> Bool Source # max :: Stm rep -> Stm rep -> Stm rep Source # min :: Stm rep -> Stm rep -> Stm rep 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 #
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 |

Fields

- resCerts :: Certs
- resSubExp :: SubExp

#### Instances

Instances details

Show SubExpRes Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> SubExpRes -> ShowS Source # show :: SubExpRes -> String Source # showList :: [SubExpRes] -> ShowS Source #
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 Methods simplify :: SimplifiableRep rep => SubExpRes -> SimpleM rep SubExpRes Source #
Rename SubExpRes Source # |
Instance details Defined in Futhark.Transform.Rename Methods rename :: SubExpRes -> RenameM SubExpRes Source #
Substitute SubExpRes Source # |
Instance details Defined in Futhark.Transform.Substitute Methods substituteNames :: Map VName VName -> SubExpRes -> SubExpRes Source #
Eq SubExpRes Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: SubExpRes -> SubExpRes -> Bool Source # (/=) :: SubExpRes -> SubExpRes -> Bool Source #
Ord SubExpRes Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: SubExpRes -> SubExpRes -> Ordering Source #

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

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

(>) :: SubExpRes -> SubExpRes -> Bool Source #

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

max :: SubExpRes -> SubExpRes -> SubExpRes Source #

min :: SubExpRes -> SubExpRes -> SubExpRes Source #

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

- bodyDec :: BodyDec rep
- bodyStms :: Stms rep
- bodyResult :: Result

#### Instances

Instances details

RepTypes rep => Show (Body rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Body rep -> ShowS Source # show :: Body rep -> String Source # showList :: [Body rep] -> ShowS 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 (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 => Eq (Body rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Body rep -> Body rep -> Bool Source # (/=) :: Body rep -> Body rep -> Bool Source #
RepTypes rep => Ord (Body rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: Body rep -> Body rep -> Ordering Source # (<) :: Body rep -> Body rep -> Bool Source # (<=) :: Body rep -> Body rep -> Bool Source # (>) :: Body rep -> Body rep -> Bool Source # (>=) :: Body rep -> Body rep -> Bool Source # max :: Body rep -> Body rep -> Body rep Source # min :: Body rep -> Body rep -> Body rep 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 #

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 Source # show :: BasicOp -> String Source # showList :: [BasicOp] -> ShowS Source #
Eq BasicOp Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: BasicOp -> BasicOp -> Bool Source # (/=) :: BasicOp -> BasicOp -> Bool Source #
Ord BasicOp Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: BasicOp -> BasicOp -> Ordering Source # (<) :: BasicOp -> BasicOp -> Bool Source # (<=) :: BasicOp -> BasicOp -> Bool Source # (>) :: BasicOp -> BasicOp -> Bool Source # (>=) :: BasicOp -> BasicOp -> Bool Source # max :: BasicOp -> BasicOp -> BasicOp Source # min :: BasicOp -> BasicOp -> BasicOp Source #
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 Source # show :: UnOp -> String Source # showList :: [UnOp] -> ShowS Source #
Eq UnOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods (==) :: UnOp -> UnOp -> Bool Source # (/=) :: UnOp -> UnOp -> Bool Source #
Ord UnOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods compare :: UnOp -> UnOp -> Ordering Source # (<) :: UnOp -> UnOp -> Bool Source # (<=) :: UnOp -> UnOp -> Bool Source # (>) :: UnOp -> UnOp -> Bool Source # (>=) :: UnOp -> UnOp -> Bool Source # max :: UnOp -> UnOp -> UnOp Source # min :: UnOp -> UnOp -> UnOp Source #
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 Source # show :: BinOp -> String Source # showList :: [BinOp] -> ShowS Source #
Eq BinOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods (==) :: BinOp -> BinOp -> Bool Source # (/=) :: BinOp -> BinOp -> Bool Source #
Ord BinOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods compare :: BinOp -> BinOp -> Ordering Source # (<) :: BinOp -> BinOp -> Bool Source # (<=) :: BinOp -> BinOp -> Bool Source # (>) :: BinOp -> BinOp -> Bool Source # (>=) :: BinOp -> BinOp -> Bool Source # max :: BinOp -> BinOp -> BinOp Source # min :: BinOp -> BinOp -> BinOp Source #
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 `BinOp`s, 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 Source # show :: CmpOp -> String Source # showList :: [CmpOp] -> ShowS Source #
Eq CmpOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods (==) :: CmpOp -> CmpOp -> Bool Source # (/=) :: CmpOp -> CmpOp -> Bool Source #
Ord CmpOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods compare :: CmpOp -> CmpOp -> Ordering Source # (<) :: CmpOp -> CmpOp -> Bool Source # (<=) :: CmpOp -> CmpOp -> Bool Source # (>) :: CmpOp -> CmpOp -> Bool Source # (>=) :: CmpOp -> CmpOp -> Bool Source # max :: CmpOp -> CmpOp -> CmpOp Source # min :: CmpOp -> CmpOp -> CmpOp Source #
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 Source # show :: ConvOp -> String Source # showList :: [ConvOp] -> ShowS Source #
Eq ConvOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods (==) :: ConvOp -> ConvOp -> Bool Source # (/=) :: ConvOp -> ConvOp -> Bool Source #
Ord ConvOp Source # |
Instance details Defined in Language.Futhark.Primitive Methods compare :: ConvOp -> ConvOp -> Ordering Source # (<) :: ConvOp -> ConvOp -> Bool Source # (<=) :: ConvOp -> ConvOp -> Bool Source # (>) :: ConvOp -> ConvOp -> Bool Source # (>=) :: ConvOp -> ConvOp -> Bool Source # max :: ConvOp -> ConvOp -> ConvOp Source # min :: ConvOp -> ConvOp -> ConvOp Source #
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 Source # show :: OpaqueOp -> String Source # showList :: [OpaqueOp] -> ShowS Source #
Eq OpaqueOp Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: OpaqueOp -> OpaqueOp -> Bool Source # (/=) :: OpaqueOp -> OpaqueOp -> Bool Source #
Ord OpaqueOp Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: OpaqueOp -> OpaqueOp -> Ordering Source # (<) :: OpaqueOp -> OpaqueOp -> Bool Source # (<=) :: OpaqueOp -> OpaqueOp -> Bool Source # (>) :: OpaqueOp -> OpaqueOp -> Bool Source # (>=) :: OpaqueOp -> OpaqueOp -> Bool Source # max :: OpaqueOp -> OpaqueOp -> OpaqueOp Source # min :: OpaqueOp -> OpaqueOp -> OpaqueOp Source #

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

Foldable DimSplice Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

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

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

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

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

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

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

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

toList :: DimSplice a -> [a] Source #

null :: DimSplice a -> Bool Source #

length :: DimSplice a -> Int Source #

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

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

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

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

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

Traversable DimSplice Source # |
Instance details Defined in Futhark.IR.Syntax Methods traverse :: Applicative f => (a -> f b) -> DimSplice a -> f (DimSplice b) Source # sequenceA :: Applicative f => DimSplice (f a) -> f (DimSplice a) Source # mapM :: Monad m => (a -> m b) -> DimSplice a -> m (DimSplice b) Source # sequence :: Monad m => DimSplice (m a) -> m (DimSplice a) Source #
Functor DimSplice Source # |
Instance details Defined in Futhark.IR.Syntax Methods fmap :: (a -> b) -> DimSplice a -> DimSplice b Source # (<$) :: a -> DimSplice b -> DimSplice a Source #
Show d => Show (DimSplice d) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> DimSplice d -> ShowS Source # show :: DimSplice d -> String Source # showList :: [DimSplice d] -> ShowS Source #
Eq d => Eq (DimSplice d) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: DimSplice d -> DimSplice d -> Bool Source # (/=) :: DimSplice d -> DimSplice d -> Bool Source #
Ord d => Ord (DimSplice d) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: DimSplice d -> DimSplice d -> Ordering Source #

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

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

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

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

max :: DimSplice d -> DimSplice d -> DimSplice d Source #

min :: DimSplice d -> DimSplice d -> DimSplice d 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 #

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

- dimSplices :: [DimSplice d]

  The changes to perform.

- newShape :: ShapeBase d

  The resulting shape.

#### Instances

Instances details

Foldable NewShape Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

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

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

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

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

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

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

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

toList :: NewShape a -> [a] Source #

null :: NewShape a -> Bool Source #

length :: NewShape a -> Int Source #

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

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

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

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

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

Traversable NewShape Source # |
Instance details Defined in Futhark.IR.Syntax Methods traverse :: Applicative f => (a -> f b) -> NewShape a -> f (NewShape b) Source # sequenceA :: Applicative f => NewShape (f a) -> f (NewShape a) Source # mapM :: Monad m => (a -> m b) -> NewShape a -> m (NewShape b) Source # sequence :: Monad m => NewShape (m a) -> m (NewShape a) Source #
Functor NewShape Source # |
Instance details Defined in Futhark.IR.Syntax Methods fmap :: (a -> b) -> NewShape a -> NewShape b Source # (<$) :: a -> NewShape b -> NewShape a Source #
Semigroup (NewShape d) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (<>) :: NewShape d -> NewShape d -> NewShape d Source # sconcat :: NonEmpty (NewShape d) -> NewShape d Source # stimes :: Integral b => b -> NewShape d -> NewShape d Source #
Show d => Show (NewShape d) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> NewShape d -> ShowS Source # show :: NewShape d -> String Source # showList :: [NewShape d] -> ShowS Source #
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 Methods substituteNames :: Map VName VName -> NewShape d -> NewShape d Source #
Eq d => Eq (NewShape d) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: NewShape d -> NewShape d -> Bool Source # (/=) :: NewShape d -> NewShape d -> Bool Source #
Ord d => Ord (NewShape d) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: NewShape d -> NewShape d -> Ordering Source #

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

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

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

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

max :: NewShape d -> NewShape d -> NewShape d Source #

min :: NewShape d -> NewShape d -> NewShape d 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 #

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

RepTypes rep => Show (Exp rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Exp rep -> ShowS Source # show :: Exp rep -> String Source # showList :: [Exp rep] -> ShowS 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 (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 => Eq (Exp rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Exp rep -> Exp rep -> Bool Source # (/=) :: Exp rep -> Exp rep -> Bool Source #
RepTypes rep => Ord (Exp rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: Exp rep -> Exp rep -> Ordering Source # (<) :: Exp rep -> Exp rep -> Bool Source # (<=) :: Exp rep -> Exp rep -> Bool Source # (>) :: Exp rep -> Exp rep -> Bool Source # (>=) :: Exp rep -> Exp rep -> Bool Source # max :: Exp rep -> Exp rep -> Exp rep Source # min :: Exp rep -> Exp rep -> Exp rep 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 #

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

- casePat :: [Maybe PrimValue]
- caseBody :: body

#### Instances

Instances details

Foldable Case Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

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

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

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

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

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

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

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

foldr1 :: (a -> a -> a) -> Case a -> a Source #

foldl1 :: (a -> a -> a) -> Case a -> a Source #

toList :: Case a -> [a] Source #

null :: Case a -> Bool Source #

length :: Case a -> Int Source #

elem :: Eq a => a -> Case a -> Bool Source #

maximum :: Ord a => Case a -> a Source #

minimum :: Ord a => Case a -> a Source #

sum :: Num a => Case a -> a Source #

product :: Num a => Case a -> a Source #

Traversable Case Source # |
Instance details Defined in Futhark.IR.Syntax Methods traverse :: Applicative f => (a -> f b) -> Case a -> f (Case b) Source # sequenceA :: Applicative f => Case (f a) -> f (Case a) Source # mapM :: Monad m => (a -> m b) -> Case a -> m (Case b) Source # sequence :: Monad m => Case (m a) -> m (Case a) Source #
Functor Case Source # |
Instance details Defined in Futhark.IR.Syntax Methods fmap :: (a -> b) -> Case a -> Case b Source # (<$) :: a -> Case b -> Case a Source #
Show body => Show (Case body) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Case body -> ShowS Source # show :: Case body -> String Source # showList :: [Case body] -> ShowS Source #
FreeIn body => FreeIn (Case body) Source # |
Instance details Defined in Futhark.IR.Prop.Names Methods freeIn' :: Case body -> FV Source #
Eq body => Eq (Case body) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Case body -> Case body -> Bool Source # (/=) :: Case body -> Case body -> Bool Source #
Ord body => Ord (Case body) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Case body -> Case body -> Ordering Source #

(<) :: Case body -> Case body -> Bool Source #

(<=) :: Case body -> Case body -> Bool Source #

(>) :: Case body -> Case body -> Bool Source #

(>=) :: Case body -> Case body -> Bool Source #

max :: Case body -> Case body -> Case body Source #

min :: Case body -> Case body -> Case body 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 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

Show LoopForm Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> LoopForm -> ShowS Source # show :: LoopForm -> String Source # showList :: [LoopForm] -> ShowS Source #
FreeIn LoopForm Source # |
Instance details Defined in Futhark.IR.Prop.Names Methods freeIn' :: LoopForm -> FV Source #
Eq LoopForm Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: LoopForm -> LoopForm -> Bool Source # (/=) :: LoopForm -> LoopForm -> Bool Source #
Ord LoopForm Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: LoopForm -> LoopForm -> Ordering Source # (<) :: LoopForm -> LoopForm -> Bool Source # (<=) :: LoopForm -> LoopForm -> Bool Source # (>) :: LoopForm -> LoopForm -> Bool Source # (>=) :: LoopForm -> LoopForm -> Bool Source # max :: LoopForm -> LoopForm -> LoopForm Source # min :: LoopForm -> LoopForm -> LoopForm Source #

data MatchDec rt Source #

Data associated with a branch.

Constructors

MatchDec |

Fields

- matchReturns :: [rt]
- matchSort :: MatchSort

#### Instances

Instances details

Show rt => Show (MatchDec rt) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> MatchDec rt -> ShowS Source # show :: MatchDec rt -> String Source # showList :: [MatchDec rt] -> ShowS Source #
FreeIn a => FreeIn (MatchDec a) Source # |
Instance details Defined in Futhark.IR.Prop.Names Methods freeIn' :: MatchDec a -> FV Source #
Eq rt => Eq (MatchDec rt) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: MatchDec rt -> MatchDec rt -> Bool Source # (/=) :: MatchDec rt -> MatchDec rt -> Bool Source #
Ord rt => Ord (MatchDec rt) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: MatchDec rt -> MatchDec rt -> Ordering Source #

(<) :: MatchDec rt -> MatchDec rt -> Bool Source #

(<=) :: MatchDec rt -> MatchDec rt -> Bool Source #

(>) :: MatchDec rt -> MatchDec rt -> Bool Source #

(>=) :: MatchDec rt -> MatchDec rt -> Bool Source #

max :: MatchDec rt -> MatchDec rt -> MatchDec rt Source #

min :: MatchDec rt -> MatchDec rt -> MatchDec rt Source #

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 Source # show :: MatchSort -> String Source # showList :: [MatchSort] -> ShowS Source #
Eq MatchSort Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: MatchSort -> MatchSort -> Bool Source # (/=) :: MatchSort -> MatchSort -> Bool Source #
Ord MatchSort Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: MatchSort -> MatchSort -> Ordering Source #

(<) :: MatchSort -> MatchSort -> Bool Source #

(<=) :: MatchSort -> MatchSort -> Bool Source #

(>) :: MatchSort -> MatchSort -> Bool Source #

(>=) :: MatchSort -> MatchSort -> Bool Source #

max :: MatchSort -> MatchSort -> MatchSort Source #

min :: MatchSort -> MatchSort -> MatchSort Source #

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 Source # show :: Safety -> String Source # showList :: [Safety] -> ShowS Source #
Eq Safety Source # |
Instance details Defined in Language.Futhark.Primitive Methods (==) :: Safety -> Safety -> Bool Source # (/=) :: Safety -> Safety -> Bool Source #
Ord Safety Source # |
Instance details Defined in Language.Futhark.Primitive Methods compare :: Safety -> Safety -> Ordering Source # (<) :: Safety -> Safety -> Bool Source # (<=) :: Safety -> Safety -> Bool Source # (>) :: Safety -> Safety -> Bool Source # (>=) :: Safety -> Safety -> Bool Source # max :: Safety -> Safety -> Safety Source # min :: Safety -> Safety -> Safety Source #

data Lambda rep Source #

Anonymous function for use in a SOAC.

Constructors

Lambda |

Fields

- lambdaParams :: [LParam rep]
- lambdaReturnType :: [Type]
- lambdaBody :: Body rep

#### Instances

Instances details

Scoped rep (Lambda rep) Source # |
Instance details Defined in Futhark.IR.Prop.Scope Methods scopeOf :: Lambda rep -> Scope rep Source #
RepTypes rep => Show (Lambda rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> Lambda rep -> ShowS Source # show :: Lambda rep -> String Source # showList :: [Lambda rep] -> ShowS 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 => Eq (Lambda rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Lambda rep -> Lambda rep -> Bool Source # (/=) :: Lambda rep -> Lambda rep -> Bool Source #
RepTypes rep => Ord (Lambda rep) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: Lambda rep -> Lambda rep -> Ordering Source #

(<) :: Lambda rep -> Lambda rep -> Bool Source #

(<=) :: Lambda rep -> Lambda rep -> Bool Source #

(>) :: Lambda rep -> Lambda rep -> Bool Source #

(>=) :: Lambda rep -> Lambda rep -> Bool Source #

max :: Lambda rep -> Lambda rep -> Lambda rep Source #

min :: Lambda rep -> Lambda rep -> Lambda rep 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 #

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 Methods mempty :: RetAls Source # mappend :: RetAls -> RetAls -> RetAls Source # mconcat :: [RetAls] -> RetAls Source #
Semigroup RetAls Source # |
Instance details Defined in Futhark.IR.Syntax Methods (<>) :: RetAls -> RetAls -> RetAls Source # sconcat :: NonEmpty RetAls -> RetAls Source # stimes :: Integral b => b -> RetAls -> RetAls Source #
Show RetAls Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> RetAls -> ShowS Source # show :: RetAls -> String Source # showList :: [RetAls] -> ShowS Source #
Eq RetAls Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: RetAls -> RetAls -> Bool Source # (/=) :: RetAls -> RetAls -> Bool Source #
Ord RetAls Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: RetAls -> RetAls -> Ordering Source # (<) :: RetAls -> RetAls -> Bool Source # (<=) :: RetAls -> RetAls -> Bool Source # (>) :: RetAls -> RetAls -> Bool Source # (>=) :: RetAls -> RetAls -> Bool Source # max :: RetAls -> RetAls -> RetAls Source # min :: RetAls -> RetAls -> RetAls Source #

# 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

Foldable Param Source # |

Instance details

Defined in Futhark.IR.Syntax.Core

Methods

fold :: Monoid m => Param m -> m Source #

foldMap :: Monoid m => (a -> m) -> Param a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Param a -> m Source #

foldr :: (a -> b -> b) -> b -> Param a -> b Source #

foldr' :: (a -> b -> b) -> b -> Param a -> b Source #

foldl :: (b -> a -> b) -> b -> Param a -> b Source #

foldl' :: (b -> a -> b) -> b -> Param a -> b Source #

foldr1 :: (a -> a -> a) -> Param a -> a Source #

foldl1 :: (a -> a -> a) -> Param a -> a Source #

toList :: Param a -> [a] Source #

null :: Param a -> Bool Source #

length :: Param a -> Int Source #

elem :: Eq a => a -> Param a -> Bool Source #

maximum :: Ord a => Param a -> a Source #

minimum :: Ord a => Param a -> a Source #

sum :: Num a => Param a -> a Source #

product :: Num a => Param a -> a Source #

Traversable Param Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods traverse :: Applicative f => (a -> f b) -> Param a -> f (Param b) Source # sequenceA :: Applicative f => Param (f a) -> f (Param a) Source # mapM :: Monad m => (a -> m b) -> Param a -> m (Param b) Source # sequence :: Monad m => Param (m a) -> m (Param a) Source #
Functor Param Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods fmap :: (a -> b) -> Param a -> Param b Source # (<$) :: a -> Param b -> Param a Source #
Show dec => Show (Param dec) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods showsPrec :: Int -> Param dec -> ShowS Source # show :: Param dec -> String Source # showList :: [Param dec] -> ShowS Source #
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 #
Eq dec => Eq (Param dec) Source # |
Instance details Defined in Futhark.IR.Syntax.Core Methods (==) :: Param dec -> Param dec -> Bool Source # (/=) :: Param dec -> Param dec -> Bool Source #
Ord dec => Ord (Param dec) Source # |

Instance details

Defined in Futhark.IR.Syntax.Core

Methods

compare :: Param dec -> Param dec -> Ordering Source #

(<) :: Param dec -> Param dec -> Bool Source #

(<=) :: Param dec -> Param dec -> Bool Source #

(>) :: Param dec -> Param dec -> Bool Source #

(>=) :: Param dec -> Param dec -> Bool Source #

max :: Param dec -> Param dec -> Param dec Source #

min :: Param dec -> Param dec -> Param dec 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 #

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

- funDefEntryPoint :: Maybe EntryPoint

  Contains a value if this function is an entry point.

- funDefAttrs :: Attrs
- funDefName :: Name
- funDefRetType :: [(RetType rep, RetAls)]
- funDefParams :: [FParam rep]
- funDefBody :: Body rep

#### Instances

Instances details

Scoped rep (FunDef rep) Source # |
Instance details Defined in Futhark.IR.Prop.Scope Methods scopeOf :: FunDef rep -> Scope rep Source #
RepTypes rep => Show (FunDef rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> FunDef rep -> ShowS Source # show :: FunDef rep -> String Source # showList :: [FunDef rep] -> ShowS 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 => Eq (FunDef rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: FunDef rep -> FunDef rep -> Bool Source # (/=) :: FunDef rep -> FunDef rep -> Bool Source #
RepTypes rep => Ord (FunDef rep) Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: FunDef rep -> FunDef rep -> Ordering Source #

(<) :: FunDef rep -> FunDef rep -> Bool Source #

(<=) :: FunDef rep -> FunDef rep -> Bool Source #

(>) :: FunDef rep -> FunDef rep -> Bool Source #

(>=) :: FunDef rep -> FunDef rep -> Bool Source #

max :: FunDef rep -> FunDef rep -> FunDef rep Source #

min :: FunDef rep -> FunDef rep -> FunDef rep 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 #

data EntryParam Source #

An entry point parameter, comprising its name and original type.

Constructors

EntryParam |

Fields

- entryParamName :: Name
- entryParamUniqueness :: Uniqueness
- entryParamType :: EntryPointType

#### Instances

Instances details

Show EntryParam Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> EntryParam -> ShowS Source # show :: EntryParam -> String Source # showList :: [EntryParam] -> ShowS Source #
Eq EntryParam Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: EntryParam -> EntryParam -> Bool Source # (/=) :: EntryParam -> EntryParam -> Bool Source #
Ord EntryParam Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: EntryParam -> EntryParam -> Ordering Source #

(<) :: EntryParam -> EntryParam -> Bool Source #

(<=) :: EntryParam -> EntryParam -> Bool Source #

(>) :: EntryParam -> EntryParam -> Bool Source #

(>=) :: EntryParam -> EntryParam -> Bool Source #

max :: EntryParam -> EntryParam -> EntryParam Source #

min :: EntryParam -> EntryParam -> EntryParam Source #

Pretty EntryParam Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: EntryParam -> Doc ann Source # prettyList :: [EntryParam] -> Doc ann Source #

data EntryResult Source #

An entry point result type.

Constructors

EntryResult |

Fields

- entryResultUniqueness :: Uniqueness
- entryResultType :: EntryPointType

#### Instances

Instances details

Show EntryResult Source # |
Instance details Defined in Futhark.IR.Syntax Methods showsPrec :: Int -> EntryResult -> ShowS Source # show :: EntryResult -> String Source # showList :: [EntryResult] -> ShowS Source #
Eq EntryResult Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: EntryResult -> EntryResult -> Bool Source # (/=) :: EntryResult -> EntryResult -> Bool Source #
Ord EntryResult Source # |

Instance details

Defined in Futhark.IR.Syntax

Methods

compare :: EntryResult -> EntryResult -> Ordering Source #

(<) :: EntryResult -> EntryResult -> Bool Source #

(<=) :: EntryResult -> EntryResult -> Bool Source #

(>) :: EntryResult -> EntryResult -> Bool Source #

(>=) :: EntryResult -> EntryResult -> Bool Source #

max :: EntryResult -> EntryResult -> EntryResult Source #

min :: EntryResult -> EntryResult -> EntryResult Source #

Pretty EntryResult Source # |
Instance details Defined in Futhark.IR.Pretty Methods pretty :: EntryResult -> Doc ann Source # prettyList :: [EntryResult] -> Doc ann Source #

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 Source # show :: Prog rep -> String Source # showList :: [Prog rep] -> ShowS Source #
RepTypes rep => Eq (Prog rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods (==) :: Prog rep -> Prog rep -> Bool Source # (/=) :: Prog rep -> Prog rep -> Bool Source #
RepTypes rep => Ord (Prog rep) Source # |
Instance details Defined in Futhark.IR.Syntax Methods compare :: Prog rep -> Prog rep -> Ordering Source # (<) :: Prog rep -> Prog rep -> Bool Source # (<=) :: Prog rep -> Prog rep -> Bool Source # (>) :: Prog rep -> Prog rep -> Bool Source # (>=) :: Prog rep -> Prog rep -> Bool Source # max :: Prog rep -> Prog rep -> Prog rep Source # min :: Prog rep -> Prog rep -> Prog rep 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 #

# 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.