Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
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
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 Futhark.IR.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 ExpT
. 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
, ExpT
, Prog
, etc) are parameterised by a
type parameter rep
. The representation specifies how to fill out
various polymorphic parts of the AST. For example, ExpT
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 PatElemT
) 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).
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
- pretty :: Pretty a => a -> String
- module Futhark.IR.Rep
- module Futhark.IR.Syntax.Core
- data Uniqueness
- data NoUniqueness = NoUniqueness
- newtype Rank = Rank Int
- class (Monoid a, Eq a, Ord a) => ArrayShape a where
- data Space
- data TypeBase shape u
- data Diet
- data Ident = Ident {}
- data SubExp
- type PatElem rep = PatElemT (LetDec rep)
- data PatElemT dec = PatElem {
- patElemName :: VName
- patElemDec :: dec
- newtype PatT dec = Pat {}
- type Pat rep = PatT (LetDec rep)
- data StmAux dec = StmAux {
- stmAuxCerts :: !Certs
- stmAuxAttrs :: Attrs
- stmAuxDec :: dec
- data Stm rep = Let {}
- type Stms rep = Seq (Stm rep)
- data SubExpRes = SubExpRes {}
- type Result = [SubExpRes]
- data BodyT rep = Body {}
- type Body = BodyT
- data BasicOp
- = SubExp SubExp
- | Opaque OpaqueOp SubExp
- | ArrayLit [SubExp] Type
- | UnOp UnOp SubExp
- | BinOp BinOp SubExp SubExp
- | CmpOp CmpOp SubExp SubExp
- | ConvOp ConvOp SubExp
- | Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc])
- | Index VName (Slice SubExp)
- | Update Safety VName (Slice SubExp) SubExp
- | FlatIndex VName (FlatSlice SubExp)
- | FlatUpdate VName (FlatSlice SubExp) VName
- | Concat Int VName [VName] SubExp
- | Copy VName
- | Manifest [Int] VName
- | Iota SubExp SubExp SubExp IntType
- | Replicate Shape SubExp
- | Scratch PrimType [SubExp]
- | Reshape (ShapeChange SubExp) VName
- | Rearrange [Int] VName
- | Rotate [SubExp] VName
- | UpdateAcc VName [SubExp] [SubExp]
- data UnOp
- 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
- data ConvOp
- data OpaqueOp
- data DimChange d
- = DimCoercion d
- | DimNew d
- type ShapeChange d = [DimChange d]
- type WithAccInput rep = (Shape, [VName], Maybe (Lambda rep, [SubExp]))
- data ExpT rep
- type Exp = ExpT
- data LoopForm rep
- data IfDec rt = IfDec {}
- data IfSort
- data Safety
- data LambdaT rep = Lambda {
- lambdaParams :: [LParam rep]
- lambdaBody :: BodyT rep
- lambdaReturnType :: [Type]
- type Lambda = LambdaT
- 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]
- funDefParams :: [FParam rep]
- funDefBody :: BodyT rep
- type EntryPoint = (Name, [EntryParam], [EntryPointType])
- data EntryParam = EntryParam {}
- data EntryPointType
- data Prog rep = Prog {
- 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)
- subExpRes :: SubExp -> SubExpRes
- subExpsRes :: [SubExp] -> Result
- varRes :: VName -> SubExpRes
- varsRes :: [VName] -> Result
Documentation
module Language.Futhark.Core
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
.
Instances
data NoUniqueness Source #
A fancier name for ()
- encodes no uniqueness information.
Instances
The size of an array type as merely the number of dimensions, with no further information.
class (Monoid a, Eq a, Ord a) => ArrayShape a where Source #
A class encompassing types containing array shape information.
shapeRank :: a -> Int Source #
Return the rank of an array with the given size.
stripDims :: Int -> a -> a Source #
stripDims n shape
strips the outer n
dimensions from
shape
.
subShapeOf :: a -> a -> Bool Source #
Check whether one shape if a subset of another shape.
Instances
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.
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. |
data TypeBase shape u Source #
The type of a value. When comparing types for equality with
==
, shapes must match.
Prim PrimType | |
Acc VName Shape [Type] u | Token, index space, element type, and uniqueness. |
Array PrimType shape u | |
Mem Space |
Instances
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]
.
Consume | Consumes this value. |
Observe | Only observes value in this position, does not consume. A result may alias this. |
ObservePrim | As |
Abstract syntax tree
An identifier consists of its name and the type of the value bound to the identifier.
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.
Instances
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.
PatElem | |
|
Instances
A pattern is conceptually just a list of names and their types.
Instances
Functor PatT Source # | |
Foldable PatT Source # | |
Defined in Futhark.IR.Syntax fold :: Monoid m => PatT m -> m # foldMap :: Monoid m => (a -> m) -> PatT a -> m # foldMap' :: Monoid m => (a -> m) -> PatT a -> m # foldr :: (a -> b -> b) -> b -> PatT a -> b # foldr' :: (a -> b -> b) -> b -> PatT a -> b # foldl :: (b -> a -> b) -> b -> PatT a -> b # foldl' :: (b -> a -> b) -> b -> PatT a -> b # foldr1 :: (a -> a -> a) -> PatT a -> a # foldl1 :: (a -> a -> a) -> PatT a -> a # elem :: Eq a => a -> PatT a -> Bool # maximum :: Ord a => PatT a -> a # | |
Traversable PatT Source # | |
Eq dec => Eq (PatT dec) Source # | |
Ord dec => Ord (PatT dec) Source # | |
Defined in Futhark.IR.Syntax | |
Show dec => Show (PatT dec) Source # | |
Semigroup (PatT dec) Source # | |
Monoid (PatT dec) Source # | |
Pretty (PatElemT dec) => Pretty (PatT dec) Source # | |
FreeIn dec => FreeIn (PatT dec) Source # | |
Substitute dec => Substitute (PatT dec) Source # | |
Defined in Futhark.Transform.Substitute | |
Rename dec => Rename (PatT dec) Source # | |
Auxilliary Information associated with a statement.
StmAux | |
|
Instances
Eq dec => Eq (StmAux dec) Source # | |
Ord dec => Ord (StmAux dec) Source # | |
Show dec => Show (StmAux dec) Source # | |
Semigroup dec => Semigroup (StmAux dec) Source # | |
FreeIn dec => FreeIn (StmAux dec) Source # | |
Substitute dec => Substitute (StmAux dec) Source # | |
Defined in Futhark.Transform.Substitute | |
Rename dec => Rename (StmAux dec) Source # | |
A local variable binding.
Instances
Scoped rep (Stm rep) Source # | |
Scoped rep (Stms rep) Source # | |
RepTypes rep => Eq (Stm rep) Source # | |
RepTypes rep => Ord (Stm rep) Source # | |
RepTypes rep => Show (Stm rep) Source # | |
PrettyRep rep => Pretty (Stms rep) Source # | |
PrettyRep rep => Pretty (Stm rep) Source # | |
FreeIn (Stm rep) => FreeIn (Stms rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Stm rep) Source # | |
Substitute (Stm rep) => Substitute (Stms rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Substitutable rep => Substitute (Stm rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Stm rep) Source # | |
A pairing of a subexpression and some certificates.
Instances
Eq SubExpRes Source # | |
Ord SubExpRes Source # | |
Defined in Futhark.IR.Syntax | |
Show SubExpRes Source # | |
Pretty SubExpRes Source # | |
FreeIn SubExpRes Source # | |
Substitute SubExpRes Source # | |
Defined in Futhark.Transform.Substitute | |
Rename SubExpRes Source # | |
Simplifiable SubExpRes Source # | |
Defined in Futhark.Optimise.Simplify.Engine |
A body consists of a number of bindings, terminating in a result (essentially a tuple literal).
Instances
RepTypes rep => Eq (BodyT rep) Source # | |
RepTypes rep => Ord (BodyT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (BodyT rep) Source # | |
PrettyRep rep => Pretty (Body rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Body rep) Source # | |
Substitutable rep => Substitute (Body rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Body rep) Source # | |
A primitive operation that returns something of known size and does not itself contain any bindings.
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., |
UnOp UnOp SubExp | Unary operation. |
BinOp BinOp SubExp SubExp | Binary operation. |
CmpOp CmpOp SubExp SubExp | Comparison - result type is always boolean. |
ConvOp ConvOp SubExp | Conversion "casting". |
Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc]) | Turn a boolean into a certificate, halting the program with the given error message if the boolean is false. |
Index VName (Slice SubExp) | The certificates for bounds-checking are part of the |
Update Safety VName (Slice SubExp) SubExp | An in-place update of the given array at the given position.
Consumes the array. If |
FlatIndex VName (FlatSlice SubExp) | |
FlatUpdate VName (FlatSlice SubExp) VName | |
Concat Int VName [VName] SubExp |
|
Copy VName | Copy the given array. The result will not alias anything. |
Manifest [Int] VName | Manifest an array with dimensions represented in the given order. The result will not alias anything. |
Iota SubExp SubExp SubExp IntType |
The |
Replicate Shape SubExp | replicate([3][2],1) = [[1,1], [1,1], [1,1]] |
Scratch PrimType [SubExp] | Create array of given type and shape, with undefined elements. |
Reshape (ShapeChange SubExp) VName | 1st arg is the new shape, 2nd arg is the input array *) |
Rearrange [Int] VName | Permute the dimensions of the input array. The list
of integers is a list of dimensions (0-indexed), which
must be a permutation of |
Rotate [SubExp] VName | Rotate the dimensions of the input array. The list of subexpressions specify how much each dimension is rotated. The length of this list must be equal to the rank of the array. |
UpdateAcc VName [SubExp] [SubExp] | Update an accumulator at the given index with the given value. Consumes the accumulator and produces a new one. |
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.
Not | E.g., |
Complement IntType | E.g., |
Abs IntType |
|
FAbs FloatType |
|
SSignum IntType | Signed sign function: |
USignum IntType | Unsigned sign function: |
FSignum FloatType | Floating-point sign function. |
Binary operators. These correspond closely to the binary operators in LLVM. Most are parametrised by their expected input and output types.
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 |
SMod IntType Safety | Signed integer modulus; the countepart to |
SQuot IntType Safety | Signed integer division. Rounds towards zero. This
corresponds to the |
SRem IntType Safety | Signed integer division. Rounds towards zero. This
corresponds to the |
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. |
Comparison operators are like BinOp
s, but they always return a
boolean value. The somewhat ugly constructor names are straight
out of LLVM.
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. |
Conversion operators try to generalise the from t0 x to t1
instructions from LLVM.
ZExt IntType IntType | Zero-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
SExt IntType IntType | Sign-extend the former integer type to the latter. If the new type is smaller, the result is a truncation. |
FPConv FloatType FloatType | Convert value of the former floating-point type to the latter. If the new type is smaller, the result is a truncation. |
FPToUI FloatType IntType | Convert a floating-point value to the nearest unsigned integer (rounding towards zero). |
FPToSI FloatType IntType | Convert a floating-point value to the nearest signed integer (rounding towards zero). |
UIToFP IntType FloatType | Convert an unsigned integer to a floating-point value. |
SIToFP IntType FloatType | Convert a signed integer to a floating-point value. |
IToB IntType | Convert an integer to a boolean value. Zero becomes false; anything else is true. |
BToI IntType | Convert a boolean to an integer. True is converted to 1 and False to 0. |
Apart from being Opaque, what else is going on here?
OpaqueNil | No special operation. |
OpaqueTrace String | Print the argument, prefixed by this string. |
The new dimension in a Reshape
-like operation. This allows us to
disambiguate "real" reshapes, that change the actual shape of the
array, from type coercions that are just present to make the types
work out. The two constructors are considered equal for purposes of Eq
.
DimCoercion d | The new dimension is guaranteed to be numerically equal to the old one. |
DimNew d | The new dimension is not necessarily numerically equal to the old one. |
Instances
type ShapeChange d = [DimChange d] Source #
A list of DimChange
s, indicating the new dimensions of an array.
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.
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
.
BasicOp BasicOp | A simple (non-recursive) operation. |
Apply Name [(SubExp, Diet)] [RetType rep] (Safety, SrcLoc, [SrcLoc]) | |
If SubExp (BodyT rep) (BodyT rep) (IfDec (BranchType rep)) | |
DoLoop [(FParam rep, SubExp)] (LoopForm rep) (BodyT rep) |
|
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. The |
Op (Op rep) |
Instances
RepTypes rep => Eq (ExpT rep) Source # | |
RepTypes rep => Ord (ExpT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (ExpT rep) Source # | |
PrettyRep rep => Pretty (Exp rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Exp rep) Source # | |
Substitutable rep => Substitute (Exp rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Exp rep) Source # | |
For-loop or while-loop?
Instances
Scoped rep (LoopForm rep) Source # | |
RepTypes rep => Eq (LoopForm rep) Source # | |
RepTypes rep => Ord (LoopForm rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (LoopForm rep) Source # | |
FreeIn (LParamInfo rep) => FreeIn (LoopForm rep) Source # | |
Data associated with a branch.
What kind of branch is this? This has no semantic meaning, but provides hints to simplifications.
IfNormal | An ordinary branch. |
IfFallback | A branch where the "true" case is what we are actually interested in, and the "false" case is only present as a fallback for when the true case cannot be safely evaluated. The compiler is permitted to optimise away the branch if the true case contains only safe statements. |
IfEquiv | 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). |
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).
Anonymous function for use in a SOAC.
Lambda | |
|
Instances
Scoped rep (Lambda rep) Source # | |
RepTypes rep => Eq (LambdaT rep) Source # | |
RepTypes rep => Ord (LambdaT rep) Source # | |
Defined in Futhark.IR.Syntax | |
RepTypes rep => Show (LambdaT rep) Source # | |
PrettyRep rep => Pretty (Lambda rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (Lambda rep) Source # | |
Substitutable rep => Substitute (Lambda rep) Source # | |
Defined in Futhark.Transform.Substitute | |
Renameable rep => Rename (Lambda rep) Source # | |
Definitions
A function or lambda parameter.
Instances
type FParam rep = Param (FParamInfo rep) Source #
A function and loop parameter.
type LParam rep = Param (LParamInfo rep) Source #
A lambda parameter.
Function Declarations
FunDef | |
|
Instances
Scoped rep (FunDef rep) Source # | |
RepTypes rep => Eq (FunDef rep) Source # | |
RepTypes rep => Ord (FunDef rep) Source # | |
RepTypes rep => Show (FunDef rep) Source # | |
PrettyRep rep => Pretty (FunDef rep) Source # | |
(FreeDec (ExpDec rep), FreeDec (BodyDec rep), FreeIn (FParamInfo rep), FreeIn (LParamInfo rep), FreeIn (LetDec rep), FreeIn (RetType rep), FreeIn (BranchType rep), FreeIn (Op rep)) => FreeIn (FunDef rep) Source # | |
Renameable rep => Rename (FunDef rep) Source # | |
type EntryPoint = (Name, [EntryParam], [EntryPointType]) Source #
Information about the inputs and outputs (return value) of an entry point.
data EntryParam Source #
An entry point parameter, comprising its name and original type.
Instances
Eq EntryParam Source # | |
Defined in Futhark.IR.Syntax (==) :: EntryParam -> EntryParam -> Bool # (/=) :: EntryParam -> EntryParam -> Bool # | |
Ord EntryParam Source # | |
Defined in Futhark.IR.Syntax compare :: EntryParam -> EntryParam -> Ordering # (<) :: EntryParam -> EntryParam -> Bool # (<=) :: EntryParam -> EntryParam -> Bool # (>) :: EntryParam -> EntryParam -> Bool # (>=) :: EntryParam -> EntryParam -> Bool # max :: EntryParam -> EntryParam -> EntryParam # min :: EntryParam -> EntryParam -> EntryParam # | |
Show EntryParam Source # | |
Defined in Futhark.IR.Syntax showsPrec :: Int -> EntryParam -> ShowS # show :: EntryParam -> String # showList :: [EntryParam] -> ShowS # | |
Pretty EntryParam Source # | |
Defined in Futhark.IR.Pretty |
data EntryPointType Source #
Every entry point argument and return value has an annotation indicating how it maps to the original source program type.
TypeUnsigned Uniqueness | Is an unsigned integer or array of unsigned integers. |
TypeOpaque Uniqueness String Int | A black box type comprising this many core values. The string is a human-readable description with no other semantics. |
TypeDirect Uniqueness | Maps directly. |
Instances
Eq EntryPointType Source # | |
Defined in Futhark.IR.Syntax (==) :: EntryPointType -> EntryPointType -> Bool # (/=) :: EntryPointType -> EntryPointType -> Bool # | |
Ord EntryPointType Source # | |
Defined in Futhark.IR.Syntax compare :: EntryPointType -> EntryPointType -> Ordering # (<) :: EntryPointType -> EntryPointType -> Bool # (<=) :: EntryPointType -> EntryPointType -> Bool # (>) :: EntryPointType -> EntryPointType -> Bool # (>=) :: EntryPointType -> EntryPointType -> Bool # max :: EntryPointType -> EntryPointType -> EntryPointType # min :: EntryPointType -> EntryPointType -> EntryPointType # | |
Show EntryPointType Source # | |
Defined in Futhark.IR.Syntax showsPrec :: Int -> EntryPointType -> ShowS # show :: EntryPointType -> String # showList :: [EntryPointType] -> ShowS # | |
Pretty EntryPointType Source # | |
Defined in Futhark.IR.Pretty ppr :: EntryPointType -> Doc # pprPrec :: Int -> EntryPointType -> Doc # pprList :: [EntryPointType] -> Doc # |
An entire Futhark program.
Prog | |
|
Utils
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.