{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, StandaloneDeriving #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}
module Futhark.Representation.AST.Syntax
(
module Language.Futhark.Core
, module Futhark.Representation.AST.Annotations
, module Futhark.Representation.AST.Syntax.Core
, Uniqueness(..)
, NoUniqueness(..)
, Rank(..)
, ArrayShape(..)
, Space (..)
, TypeBase(..)
, Diet(..)
, Ident (..)
, SubExp(..)
, PatElem
, PatElemT (..)
, PatternT (..)
, Pattern
, StmAux(..)
, Stm(..)
, Stms
, Result
, BodyT(..)
, Body
, BasicOp (..)
, UnOp (..)
, BinOp (..)
, CmpOp (..)
, ConvOp (..)
, DimChange (..)
, ShapeChange
, ExpT(..)
, Exp
, LoopForm (..)
, IfAttr (..)
, IfSort (..)
, Safety (..)
, LambdaT(..)
, Lambda
, Param (..)
, FParam
, LParam
, FunDef (..)
, EntryPoint
, EntryPointType(..)
, Prog(..)
, oneStm
, stmsFromList
, stmsToList
, stmsHead
)
where
import Data.Foldable
import Data.Loc
import qualified Data.Sequence as Seq
import Language.Futhark.Core
import Futhark.Representation.AST.Annotations
import Futhark.Representation.AST.Syntax.Core
type PatElem lore = PatElemT (LetAttr lore)
data PatternT attr =
Pattern { PatternT attr -> [PatElemT attr]
patternContextElements :: [PatElemT attr]
, PatternT attr -> [PatElemT attr]
patternValueElements :: [PatElemT attr]
}
deriving (Eq (PatternT attr)
Eq (PatternT attr)
-> (PatternT attr -> PatternT attr -> Ordering)
-> (PatternT attr -> PatternT attr -> Bool)
-> (PatternT attr -> PatternT attr -> Bool)
-> (PatternT attr -> PatternT attr -> Bool)
-> (PatternT attr -> PatternT attr -> Bool)
-> (PatternT attr -> PatternT attr -> PatternT attr)
-> (PatternT attr -> PatternT attr -> PatternT attr)
-> Ord (PatternT attr)
PatternT attr -> PatternT attr -> Bool
PatternT attr -> PatternT attr -> Ordering
PatternT attr -> PatternT attr -> PatternT attr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall attr. Ord attr => Eq (PatternT attr)
forall attr. Ord attr => PatternT attr -> PatternT attr -> Bool
forall attr. Ord attr => PatternT attr -> PatternT attr -> Ordering
forall attr.
Ord attr =>
PatternT attr -> PatternT attr -> PatternT attr
min :: PatternT attr -> PatternT attr -> PatternT attr
$cmin :: forall attr.
Ord attr =>
PatternT attr -> PatternT attr -> PatternT attr
max :: PatternT attr -> PatternT attr -> PatternT attr
$cmax :: forall attr.
Ord attr =>
PatternT attr -> PatternT attr -> PatternT attr
>= :: PatternT attr -> PatternT attr -> Bool
$c>= :: forall attr. Ord attr => PatternT attr -> PatternT attr -> Bool
> :: PatternT attr -> PatternT attr -> Bool
$c> :: forall attr. Ord attr => PatternT attr -> PatternT attr -> Bool
<= :: PatternT attr -> PatternT attr -> Bool
$c<= :: forall attr. Ord attr => PatternT attr -> PatternT attr -> Bool
< :: PatternT attr -> PatternT attr -> Bool
$c< :: forall attr. Ord attr => PatternT attr -> PatternT attr -> Bool
compare :: PatternT attr -> PatternT attr -> Ordering
$ccompare :: forall attr. Ord attr => PatternT attr -> PatternT attr -> Ordering
$cp1Ord :: forall attr. Ord attr => Eq (PatternT attr)
Ord, Int -> PatternT attr -> ShowS
[PatternT attr] -> ShowS
PatternT attr -> String
(Int -> PatternT attr -> ShowS)
-> (PatternT attr -> String)
-> ([PatternT attr] -> ShowS)
-> Show (PatternT attr)
forall attr. Show attr => Int -> PatternT attr -> ShowS
forall attr. Show attr => [PatternT attr] -> ShowS
forall attr. Show attr => PatternT attr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatternT attr] -> ShowS
$cshowList :: forall attr. Show attr => [PatternT attr] -> ShowS
show :: PatternT attr -> String
$cshow :: forall attr. Show attr => PatternT attr -> String
showsPrec :: Int -> PatternT attr -> ShowS
$cshowsPrec :: forall attr. Show attr => Int -> PatternT attr -> ShowS
Show, PatternT attr -> PatternT attr -> Bool
(PatternT attr -> PatternT attr -> Bool)
-> (PatternT attr -> PatternT attr -> Bool) -> Eq (PatternT attr)
forall attr. Eq attr => PatternT attr -> PatternT attr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatternT attr -> PatternT attr -> Bool
$c/= :: forall attr. Eq attr => PatternT attr -> PatternT attr -> Bool
== :: PatternT attr -> PatternT attr -> Bool
$c== :: forall attr. Eq attr => PatternT attr -> PatternT attr -> Bool
Eq)
instance Functor PatternT where
fmap :: (a -> b) -> PatternT a -> PatternT b
fmap a -> b
f (Pattern [PatElemT a]
ctx [PatElemT a]
val) = [PatElemT b] -> [PatElemT b] -> PatternT b
forall attr. [PatElemT attr] -> [PatElemT attr] -> PatternT attr
Pattern ((PatElemT a -> PatElemT b) -> [PatElemT a] -> [PatElemT b]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> b) -> PatElemT a -> PatElemT b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) [PatElemT a]
ctx) ((PatElemT a -> PatElemT b) -> [PatElemT a] -> [PatElemT b]
forall a b. (a -> b) -> [a] -> [b]
map ((a -> b) -> PatElemT a -> PatElemT b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f) [PatElemT a]
val)
instance Semigroup (PatternT attr) where
Pattern [PatElemT attr]
cs1 [PatElemT attr]
vs1 <> :: PatternT attr -> PatternT attr -> PatternT attr
<> Pattern [PatElemT attr]
cs2 [PatElemT attr]
vs2 = [PatElemT attr] -> [PatElemT attr] -> PatternT attr
forall attr. [PatElemT attr] -> [PatElemT attr] -> PatternT attr
Pattern ([PatElemT attr]
cs1[PatElemT attr] -> [PatElemT attr] -> [PatElemT attr]
forall a. [a] -> [a] -> [a]
++[PatElemT attr]
cs2) ([PatElemT attr]
vs1[PatElemT attr] -> [PatElemT attr] -> [PatElemT attr]
forall a. [a] -> [a] -> [a]
++[PatElemT attr]
vs2)
instance Monoid (PatternT attr) where
mempty :: PatternT attr
mempty = [PatElemT attr] -> [PatElemT attr] -> PatternT attr
forall attr. [PatElemT attr] -> [PatElemT attr] -> PatternT attr
Pattern [] []
type Pattern lore = PatternT (LetAttr lore)
data StmAux attr = StmAux { StmAux attr -> Certificates
stmAuxCerts :: !Certificates
, StmAux attr -> attr
stmAuxAttr :: attr
}
deriving (Eq (StmAux attr)
Eq (StmAux attr)
-> (StmAux attr -> StmAux attr -> Ordering)
-> (StmAux attr -> StmAux attr -> Bool)
-> (StmAux attr -> StmAux attr -> Bool)
-> (StmAux attr -> StmAux attr -> Bool)
-> (StmAux attr -> StmAux attr -> Bool)
-> (StmAux attr -> StmAux attr -> StmAux attr)
-> (StmAux attr -> StmAux attr -> StmAux attr)
-> Ord (StmAux attr)
StmAux attr -> StmAux attr -> Bool
StmAux attr -> StmAux attr -> Ordering
StmAux attr -> StmAux attr -> StmAux attr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall attr. Ord attr => Eq (StmAux attr)
forall attr. Ord attr => StmAux attr -> StmAux attr -> Bool
forall attr. Ord attr => StmAux attr -> StmAux attr -> Ordering
forall attr. Ord attr => StmAux attr -> StmAux attr -> StmAux attr
min :: StmAux attr -> StmAux attr -> StmAux attr
$cmin :: forall attr. Ord attr => StmAux attr -> StmAux attr -> StmAux attr
max :: StmAux attr -> StmAux attr -> StmAux attr
$cmax :: forall attr. Ord attr => StmAux attr -> StmAux attr -> StmAux attr
>= :: StmAux attr -> StmAux attr -> Bool
$c>= :: forall attr. Ord attr => StmAux attr -> StmAux attr -> Bool
> :: StmAux attr -> StmAux attr -> Bool
$c> :: forall attr. Ord attr => StmAux attr -> StmAux attr -> Bool
<= :: StmAux attr -> StmAux attr -> Bool
$c<= :: forall attr. Ord attr => StmAux attr -> StmAux attr -> Bool
< :: StmAux attr -> StmAux attr -> Bool
$c< :: forall attr. Ord attr => StmAux attr -> StmAux attr -> Bool
compare :: StmAux attr -> StmAux attr -> Ordering
$ccompare :: forall attr. Ord attr => StmAux attr -> StmAux attr -> Ordering
$cp1Ord :: forall attr. Ord attr => Eq (StmAux attr)
Ord, Int -> StmAux attr -> ShowS
[StmAux attr] -> ShowS
StmAux attr -> String
(Int -> StmAux attr -> ShowS)
-> (StmAux attr -> String)
-> ([StmAux attr] -> ShowS)
-> Show (StmAux attr)
forall attr. Show attr => Int -> StmAux attr -> ShowS
forall attr. Show attr => [StmAux attr] -> ShowS
forall attr. Show attr => StmAux attr -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StmAux attr] -> ShowS
$cshowList :: forall attr. Show attr => [StmAux attr] -> ShowS
show :: StmAux attr -> String
$cshow :: forall attr. Show attr => StmAux attr -> String
showsPrec :: Int -> StmAux attr -> ShowS
$cshowsPrec :: forall attr. Show attr => Int -> StmAux attr -> ShowS
Show, StmAux attr -> StmAux attr -> Bool
(StmAux attr -> StmAux attr -> Bool)
-> (StmAux attr -> StmAux attr -> Bool) -> Eq (StmAux attr)
forall attr. Eq attr => StmAux attr -> StmAux attr -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StmAux attr -> StmAux attr -> Bool
$c/= :: forall attr. Eq attr => StmAux attr -> StmAux attr -> Bool
== :: StmAux attr -> StmAux attr -> Bool
$c== :: forall attr. Eq attr => StmAux attr -> StmAux attr -> Bool
Eq)
data Stm lore = Let { Stm lore -> Pattern lore
stmPattern :: Pattern lore
, Stm lore -> StmAux (ExpAttr lore)
stmAux :: StmAux (ExpAttr lore)
, Stm lore -> Exp lore
stmExp :: Exp lore
}
deriving instance Annotations lore => Ord (Stm lore)
deriving instance Annotations lore => Show (Stm lore)
deriving instance Annotations lore => Eq (Stm lore)
type Stms lore = Seq.Seq (Stm lore)
oneStm :: Stm lore -> Stms lore
oneStm :: Stm lore -> Stms lore
oneStm = Stm lore -> Stms lore
forall a. a -> Seq a
Seq.singleton
stmsFromList :: [Stm lore] -> Stms lore
stmsFromList :: [Stm lore] -> Stms lore
stmsFromList = [Stm lore] -> Stms lore
forall a. [a] -> Seq a
Seq.fromList
stmsToList :: Stms lore -> [Stm lore]
stmsToList :: Stms lore -> [Stm lore]
stmsToList = Stms lore -> [Stm lore]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList
stmsHead :: Stms lore -> Maybe (Stm lore, Stms lore)
stmsHead :: Stms lore -> Maybe (Stm lore, Stms lore)
stmsHead Stms lore
stms = case Stms lore -> ViewL (Stm lore)
forall a. Seq a -> ViewL a
Seq.viewl Stms lore
stms of Stm lore
stm Seq.:< Stms lore
stms' -> (Stm lore, Stms lore) -> Maybe (Stm lore, Stms lore)
forall a. a -> Maybe a
Just (Stm lore
stm, Stms lore
stms')
ViewL (Stm lore)
Seq.EmptyL -> Maybe (Stm lore, Stms lore)
forall a. Maybe a
Nothing
type Result = [SubExp]
data BodyT lore = Body { BodyT lore -> BodyAttr lore
bodyAttr :: BodyAttr lore
, BodyT lore -> Stms lore
bodyStms :: Stms lore
, BodyT lore -> Result
bodyResult :: Result
}
deriving instance Annotations lore => Ord (BodyT lore)
deriving instance Annotations lore => Show (BodyT lore)
deriving instance Annotations lore => Eq (BodyT lore)
type Body = BodyT
data DimChange d = DimCoercion d
| DimNew d
deriving (Eq (DimChange d)
Eq (DimChange d)
-> (DimChange d -> DimChange d -> Ordering)
-> (DimChange d -> DimChange d -> Bool)
-> (DimChange d -> DimChange d -> Bool)
-> (DimChange d -> DimChange d -> Bool)
-> (DimChange d -> DimChange d -> Bool)
-> (DimChange d -> DimChange d -> DimChange d)
-> (DimChange d -> DimChange d -> DimChange d)
-> Ord (DimChange d)
DimChange d -> DimChange d -> Bool
DimChange d -> DimChange d -> Ordering
DimChange d -> DimChange d -> DimChange d
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall d. Ord d => Eq (DimChange d)
forall d. Ord d => DimChange d -> DimChange d -> Bool
forall d. Ord d => DimChange d -> DimChange d -> Ordering
forall d. Ord d => DimChange d -> DimChange d -> DimChange d
min :: DimChange d -> DimChange d -> DimChange d
$cmin :: forall d. Ord d => DimChange d -> DimChange d -> DimChange d
max :: DimChange d -> DimChange d -> DimChange d
$cmax :: forall d. Ord d => DimChange d -> DimChange d -> DimChange d
>= :: DimChange d -> DimChange d -> Bool
$c>= :: forall d. Ord d => DimChange d -> DimChange d -> Bool
> :: DimChange d -> DimChange d -> Bool
$c> :: forall d. Ord d => DimChange d -> DimChange d -> Bool
<= :: DimChange d -> DimChange d -> Bool
$c<= :: forall d. Ord d => DimChange d -> DimChange d -> Bool
< :: DimChange d -> DimChange d -> Bool
$c< :: forall d. Ord d => DimChange d -> DimChange d -> Bool
compare :: DimChange d -> DimChange d -> Ordering
$ccompare :: forall d. Ord d => DimChange d -> DimChange d -> Ordering
$cp1Ord :: forall d. Ord d => Eq (DimChange d)
Ord, Int -> DimChange d -> ShowS
[DimChange d] -> ShowS
DimChange d -> String
(Int -> DimChange d -> ShowS)
-> (DimChange d -> String)
-> ([DimChange d] -> ShowS)
-> Show (DimChange d)
forall d. Show d => Int -> DimChange d -> ShowS
forall d. Show d => [DimChange d] -> ShowS
forall d. Show d => DimChange d -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimChange d] -> ShowS
$cshowList :: forall d. Show d => [DimChange d] -> ShowS
show :: DimChange d -> String
$cshow :: forall d. Show d => DimChange d -> String
showsPrec :: Int -> DimChange d -> ShowS
$cshowsPrec :: forall d. Show d => Int -> DimChange d -> ShowS
Show)
instance Eq d => Eq (DimChange d) where
DimCoercion d
x == :: DimChange d -> DimChange d -> Bool
== DimNew d
y = d
x d -> d -> Bool
forall a. Eq a => a -> a -> Bool
== d
y
DimCoercion d
x == DimCoercion d
y = d
x d -> d -> Bool
forall a. Eq a => a -> a -> Bool
== d
y
DimNew d
x == DimCoercion d
y = d
x d -> d -> Bool
forall a. Eq a => a -> a -> Bool
== d
y
DimNew d
x == DimNew d
y = d
x d -> d -> Bool
forall a. Eq a => a -> a -> Bool
== d
y
instance Functor DimChange where
fmap :: (a -> b) -> DimChange a -> DimChange b
fmap a -> b
f (DimCoercion a
d) = b -> DimChange b
forall d. d -> DimChange d
DimCoercion (b -> DimChange b) -> b -> DimChange b
forall a b. (a -> b) -> a -> b
$ a -> b
f a
d
fmap a -> b
f (DimNew a
d) = b -> DimChange b
forall d. d -> DimChange d
DimNew (b -> DimChange b) -> b -> DimChange b
forall a b. (a -> b) -> a -> b
$ a -> b
f a
d
instance Foldable DimChange where
foldMap :: (a -> m) -> DimChange a -> m
foldMap a -> m
f (DimCoercion a
d) = a -> m
f a
d
foldMap a -> m
f (DimNew a
d) = a -> m
f a
d
instance Traversable DimChange where
traverse :: (a -> f b) -> DimChange a -> f (DimChange b)
traverse a -> f b
f (DimCoercion a
d) = b -> DimChange b
forall d. d -> DimChange d
DimCoercion (b -> DimChange b) -> f b -> f (DimChange b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
d
traverse a -> f b
f (DimNew a
d) = b -> DimChange b
forall d. d -> DimChange d
DimNew (b -> DimChange b) -> f b -> f (DimChange b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
d
type ShapeChange d = [DimChange d]
data BasicOp lore
= SubExp SubExp
| Opaque 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 VName (Slice SubExp) SubExp
| Concat Int VName [VName] SubExp
| Copy VName
| Manifest [Int] VName
| Iota SubExp SubExp SubExp IntType
| Replicate Shape SubExp
| Repeat [Shape] Shape VName
| Scratch PrimType [SubExp]
| Reshape (ShapeChange SubExp) VName
| Rearrange [Int] VName
| Rotate [SubExp] VName
deriving (BasicOp lore -> BasicOp lore -> Bool
(BasicOp lore -> BasicOp lore -> Bool)
-> (BasicOp lore -> BasicOp lore -> Bool) -> Eq (BasicOp lore)
forall lore. BasicOp lore -> BasicOp lore -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BasicOp lore -> BasicOp lore -> Bool
$c/= :: forall lore. BasicOp lore -> BasicOp lore -> Bool
== :: BasicOp lore -> BasicOp lore -> Bool
$c== :: forall lore. BasicOp lore -> BasicOp lore -> Bool
Eq, Eq (BasicOp lore)
Eq (BasicOp lore)
-> (BasicOp lore -> BasicOp lore -> Ordering)
-> (BasicOp lore -> BasicOp lore -> Bool)
-> (BasicOp lore -> BasicOp lore -> Bool)
-> (BasicOp lore -> BasicOp lore -> Bool)
-> (BasicOp lore -> BasicOp lore -> Bool)
-> (BasicOp lore -> BasicOp lore -> BasicOp lore)
-> (BasicOp lore -> BasicOp lore -> BasicOp lore)
-> Ord (BasicOp lore)
BasicOp lore -> BasicOp lore -> Bool
BasicOp lore -> BasicOp lore -> Ordering
BasicOp lore -> BasicOp lore -> BasicOp lore
forall lore. Eq (BasicOp lore)
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall lore. BasicOp lore -> BasicOp lore -> Bool
forall lore. BasicOp lore -> BasicOp lore -> Ordering
forall lore. BasicOp lore -> BasicOp lore -> BasicOp lore
min :: BasicOp lore -> BasicOp lore -> BasicOp lore
$cmin :: forall lore. BasicOp lore -> BasicOp lore -> BasicOp lore
max :: BasicOp lore -> BasicOp lore -> BasicOp lore
$cmax :: forall lore. BasicOp lore -> BasicOp lore -> BasicOp lore
>= :: BasicOp lore -> BasicOp lore -> Bool
$c>= :: forall lore. BasicOp lore -> BasicOp lore -> Bool
> :: BasicOp lore -> BasicOp lore -> Bool
$c> :: forall lore. BasicOp lore -> BasicOp lore -> Bool
<= :: BasicOp lore -> BasicOp lore -> Bool
$c<= :: forall lore. BasicOp lore -> BasicOp lore -> Bool
< :: BasicOp lore -> BasicOp lore -> Bool
$c< :: forall lore. BasicOp lore -> BasicOp lore -> Bool
compare :: BasicOp lore -> BasicOp lore -> Ordering
$ccompare :: forall lore. BasicOp lore -> BasicOp lore -> Ordering
$cp1Ord :: forall lore. Eq (BasicOp lore)
Ord, Int -> BasicOp lore -> ShowS
[BasicOp lore] -> ShowS
BasicOp lore -> String
(Int -> BasicOp lore -> ShowS)
-> (BasicOp lore -> String)
-> ([BasicOp lore] -> ShowS)
-> Show (BasicOp lore)
forall lore. Int -> BasicOp lore -> ShowS
forall lore. [BasicOp lore] -> ShowS
forall lore. BasicOp lore -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BasicOp lore] -> ShowS
$cshowList :: forall lore. [BasicOp lore] -> ShowS
show :: BasicOp lore -> String
$cshow :: forall lore. BasicOp lore -> String
showsPrec :: Int -> BasicOp lore -> ShowS
$cshowsPrec :: forall lore. Int -> BasicOp lore -> ShowS
Show)
data ExpT lore
= BasicOp (BasicOp lore)
| Apply Name [(SubExp, Diet)] [RetType lore] (Safety, SrcLoc, [SrcLoc])
| If SubExp (BodyT lore) (BodyT lore) (IfAttr (BranchType lore))
| DoLoop [(FParam lore, SubExp)] [(FParam lore, SubExp)] (LoopForm lore) (BodyT lore)
| Op (Op lore)
deriving instance Annotations lore => Eq (ExpT lore)
deriving instance Annotations lore => Show (ExpT lore)
deriving instance Annotations lore => Ord (ExpT lore)
data Safety = Unsafe | Safe deriving (Safety -> Safety -> Bool
(Safety -> Safety -> Bool)
-> (Safety -> Safety -> Bool) -> Eq Safety
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Safety -> Safety -> Bool
$c/= :: Safety -> Safety -> Bool
== :: Safety -> Safety -> Bool
$c== :: Safety -> Safety -> Bool
Eq, Eq Safety
Eq Safety
-> (Safety -> Safety -> Ordering)
-> (Safety -> Safety -> Bool)
-> (Safety -> Safety -> Bool)
-> (Safety -> Safety -> Bool)
-> (Safety -> Safety -> Bool)
-> (Safety -> Safety -> Safety)
-> (Safety -> Safety -> Safety)
-> Ord Safety
Safety -> Safety -> Bool
Safety -> Safety -> Ordering
Safety -> Safety -> Safety
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Safety -> Safety -> Safety
$cmin :: Safety -> Safety -> Safety
max :: Safety -> Safety -> Safety
$cmax :: Safety -> Safety -> Safety
>= :: Safety -> Safety -> Bool
$c>= :: Safety -> Safety -> Bool
> :: Safety -> Safety -> Bool
$c> :: Safety -> Safety -> Bool
<= :: Safety -> Safety -> Bool
$c<= :: Safety -> Safety -> Bool
< :: Safety -> Safety -> Bool
$c< :: Safety -> Safety -> Bool
compare :: Safety -> Safety -> Ordering
$ccompare :: Safety -> Safety -> Ordering
$cp1Ord :: Eq Safety
Ord, Int -> Safety -> ShowS
[Safety] -> ShowS
Safety -> String
(Int -> Safety -> ShowS)
-> (Safety -> String) -> ([Safety] -> ShowS) -> Show Safety
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Safety] -> ShowS
$cshowList :: [Safety] -> ShowS
show :: Safety -> String
$cshow :: Safety -> String
showsPrec :: Int -> Safety -> ShowS
$cshowsPrec :: Int -> Safety -> ShowS
Show)
data LoopForm lore = ForLoop VName IntType SubExp [(LParam lore,VName)]
| WhileLoop VName
deriving instance Annotations lore => Eq (LoopForm lore)
deriving instance Annotations lore => Show (LoopForm lore)
deriving instance Annotations lore => Ord (LoopForm lore)
data IfAttr rt = IfAttr { IfAttr rt -> [rt]
ifReturns :: [rt]
, IfAttr rt -> IfSort
ifSort :: IfSort
}
deriving (IfAttr rt -> IfAttr rt -> Bool
(IfAttr rt -> IfAttr rt -> Bool)
-> (IfAttr rt -> IfAttr rt -> Bool) -> Eq (IfAttr rt)
forall rt. Eq rt => IfAttr rt -> IfAttr rt -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IfAttr rt -> IfAttr rt -> Bool
$c/= :: forall rt. Eq rt => IfAttr rt -> IfAttr rt -> Bool
== :: IfAttr rt -> IfAttr rt -> Bool
$c== :: forall rt. Eq rt => IfAttr rt -> IfAttr rt -> Bool
Eq, Int -> IfAttr rt -> ShowS
[IfAttr rt] -> ShowS
IfAttr rt -> String
(Int -> IfAttr rt -> ShowS)
-> (IfAttr rt -> String)
-> ([IfAttr rt] -> ShowS)
-> Show (IfAttr rt)
forall rt. Show rt => Int -> IfAttr rt -> ShowS
forall rt. Show rt => [IfAttr rt] -> ShowS
forall rt. Show rt => IfAttr rt -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IfAttr rt] -> ShowS
$cshowList :: forall rt. Show rt => [IfAttr rt] -> ShowS
show :: IfAttr rt -> String
$cshow :: forall rt. Show rt => IfAttr rt -> String
showsPrec :: Int -> IfAttr rt -> ShowS
$cshowsPrec :: forall rt. Show rt => Int -> IfAttr rt -> ShowS
Show, Eq (IfAttr rt)
Eq (IfAttr rt)
-> (IfAttr rt -> IfAttr rt -> Ordering)
-> (IfAttr rt -> IfAttr rt -> Bool)
-> (IfAttr rt -> IfAttr rt -> Bool)
-> (IfAttr rt -> IfAttr rt -> Bool)
-> (IfAttr rt -> IfAttr rt -> Bool)
-> (IfAttr rt -> IfAttr rt -> IfAttr rt)
-> (IfAttr rt -> IfAttr rt -> IfAttr rt)
-> Ord (IfAttr rt)
IfAttr rt -> IfAttr rt -> Bool
IfAttr rt -> IfAttr rt -> Ordering
IfAttr rt -> IfAttr rt -> IfAttr rt
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall rt. Ord rt => Eq (IfAttr rt)
forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Bool
forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Ordering
forall rt. Ord rt => IfAttr rt -> IfAttr rt -> IfAttr rt
min :: IfAttr rt -> IfAttr rt -> IfAttr rt
$cmin :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> IfAttr rt
max :: IfAttr rt -> IfAttr rt -> IfAttr rt
$cmax :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> IfAttr rt
>= :: IfAttr rt -> IfAttr rt -> Bool
$c>= :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Bool
> :: IfAttr rt -> IfAttr rt -> Bool
$c> :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Bool
<= :: IfAttr rt -> IfAttr rt -> Bool
$c<= :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Bool
< :: IfAttr rt -> IfAttr rt -> Bool
$c< :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Bool
compare :: IfAttr rt -> IfAttr rt -> Ordering
$ccompare :: forall rt. Ord rt => IfAttr rt -> IfAttr rt -> Ordering
$cp1Ord :: forall rt. Ord rt => Eq (IfAttr rt)
Ord)
data IfSort = IfNormal
| IfFallback
deriving (IfSort -> IfSort -> Bool
(IfSort -> IfSort -> Bool)
-> (IfSort -> IfSort -> Bool) -> Eq IfSort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IfSort -> IfSort -> Bool
$c/= :: IfSort -> IfSort -> Bool
== :: IfSort -> IfSort -> Bool
$c== :: IfSort -> IfSort -> Bool
Eq, Int -> IfSort -> ShowS
[IfSort] -> ShowS
IfSort -> String
(Int -> IfSort -> ShowS)
-> (IfSort -> String) -> ([IfSort] -> ShowS) -> Show IfSort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IfSort] -> ShowS
$cshowList :: [IfSort] -> ShowS
show :: IfSort -> String
$cshow :: IfSort -> String
showsPrec :: Int -> IfSort -> ShowS
$cshowsPrec :: Int -> IfSort -> ShowS
Show, Eq IfSort
Eq IfSort
-> (IfSort -> IfSort -> Ordering)
-> (IfSort -> IfSort -> Bool)
-> (IfSort -> IfSort -> Bool)
-> (IfSort -> IfSort -> Bool)
-> (IfSort -> IfSort -> Bool)
-> (IfSort -> IfSort -> IfSort)
-> (IfSort -> IfSort -> IfSort)
-> Ord IfSort
IfSort -> IfSort -> Bool
IfSort -> IfSort -> Ordering
IfSort -> IfSort -> IfSort
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IfSort -> IfSort -> IfSort
$cmin :: IfSort -> IfSort -> IfSort
max :: IfSort -> IfSort -> IfSort
$cmax :: IfSort -> IfSort -> IfSort
>= :: IfSort -> IfSort -> Bool
$c>= :: IfSort -> IfSort -> Bool
> :: IfSort -> IfSort -> Bool
$c> :: IfSort -> IfSort -> Bool
<= :: IfSort -> IfSort -> Bool
$c<= :: IfSort -> IfSort -> Bool
< :: IfSort -> IfSort -> Bool
$c< :: IfSort -> IfSort -> Bool
compare :: IfSort -> IfSort -> Ordering
$ccompare :: IfSort -> IfSort -> Ordering
$cp1Ord :: Eq IfSort
Ord)
type Exp = ExpT
data LambdaT lore = Lambda { LambdaT lore -> [LParam lore]
lambdaParams :: [LParam lore]
, LambdaT lore -> BodyT lore
lambdaBody :: BodyT lore
, LambdaT lore -> [Type]
lambdaReturnType :: [Type]
}
deriving instance Annotations lore => Eq (LambdaT lore)
deriving instance Annotations lore => Show (LambdaT lore)
deriving instance Annotations lore => Ord (LambdaT lore)
type Lambda = LambdaT
type FParam lore = Param (FParamAttr lore)
type LParam lore = Param (LParamAttr lore)
data FunDef lore = FunDef { FunDef lore -> Maybe EntryPoint
funDefEntryPoint :: Maybe EntryPoint
, FunDef lore -> Name
funDefName :: Name
, FunDef lore -> [RetType lore]
funDefRetType :: [RetType lore]
, FunDef lore -> [FParam lore]
funDefParams :: [FParam lore]
, FunDef lore -> BodyT lore
funDefBody :: BodyT lore
}
deriving instance Annotations lore => Eq (FunDef lore)
deriving instance Annotations lore => Show (FunDef lore)
deriving instance Annotations lore => Ord (FunDef lore)
type EntryPoint = ([EntryPointType], [EntryPointType])
data EntryPointType = TypeUnsigned
| TypeOpaque String Int
| TypeDirect
deriving (EntryPointType -> EntryPointType -> Bool
(EntryPointType -> EntryPointType -> Bool)
-> (EntryPointType -> EntryPointType -> Bool) -> Eq EntryPointType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EntryPointType -> EntryPointType -> Bool
$c/= :: EntryPointType -> EntryPointType -> Bool
== :: EntryPointType -> EntryPointType -> Bool
$c== :: EntryPointType -> EntryPointType -> Bool
Eq, Int -> EntryPointType -> ShowS
[EntryPointType] -> ShowS
EntryPointType -> String
(Int -> EntryPointType -> ShowS)
-> (EntryPointType -> String)
-> ([EntryPointType] -> ShowS)
-> Show EntryPointType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EntryPointType] -> ShowS
$cshowList :: [EntryPointType] -> ShowS
show :: EntryPointType -> String
$cshow :: EntryPointType -> String
showsPrec :: Int -> EntryPointType -> ShowS
$cshowsPrec :: Int -> EntryPointType -> ShowS
Show, Eq EntryPointType
Eq EntryPointType
-> (EntryPointType -> EntryPointType -> Ordering)
-> (EntryPointType -> EntryPointType -> Bool)
-> (EntryPointType -> EntryPointType -> Bool)
-> (EntryPointType -> EntryPointType -> Bool)
-> (EntryPointType -> EntryPointType -> Bool)
-> (EntryPointType -> EntryPointType -> EntryPointType)
-> (EntryPointType -> EntryPointType -> EntryPointType)
-> Ord EntryPointType
EntryPointType -> EntryPointType -> Bool
EntryPointType -> EntryPointType -> Ordering
EntryPointType -> EntryPointType -> EntryPointType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EntryPointType -> EntryPointType -> EntryPointType
$cmin :: EntryPointType -> EntryPointType -> EntryPointType
max :: EntryPointType -> EntryPointType -> EntryPointType
$cmax :: EntryPointType -> EntryPointType -> EntryPointType
>= :: EntryPointType -> EntryPointType -> Bool
$c>= :: EntryPointType -> EntryPointType -> Bool
> :: EntryPointType -> EntryPointType -> Bool
$c> :: EntryPointType -> EntryPointType -> Bool
<= :: EntryPointType -> EntryPointType -> Bool
$c<= :: EntryPointType -> EntryPointType -> Bool
< :: EntryPointType -> EntryPointType -> Bool
$c< :: EntryPointType -> EntryPointType -> Bool
compare :: EntryPointType -> EntryPointType -> Ordering
$ccompare :: EntryPointType -> EntryPointType -> Ordering
$cp1Ord :: Eq EntryPointType
Ord)
data Prog lore = Prog
{ Prog lore -> Stms lore
progConsts :: Stms lore
, Prog lore -> [FunDef lore]
progFuns :: [FunDef lore]
} deriving (Prog lore -> Prog lore -> Bool
(Prog lore -> Prog lore -> Bool)
-> (Prog lore -> Prog lore -> Bool) -> Eq (Prog lore)
forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Prog lore -> Prog lore -> Bool
$c/= :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
== :: Prog lore -> Prog lore -> Bool
$c== :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
Eq, Eq (Prog lore)
Eq (Prog lore)
-> (Prog lore -> Prog lore -> Ordering)
-> (Prog lore -> Prog lore -> Bool)
-> (Prog lore -> Prog lore -> Bool)
-> (Prog lore -> Prog lore -> Bool)
-> (Prog lore -> Prog lore -> Bool)
-> (Prog lore -> Prog lore -> Prog lore)
-> (Prog lore -> Prog lore -> Prog lore)
-> Ord (Prog lore)
Prog lore -> Prog lore -> Bool
Prog lore -> Prog lore -> Ordering
Prog lore -> Prog lore -> Prog lore
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall lore. Annotations lore => Eq (Prog lore)
forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
forall lore. Annotations lore => Prog lore -> Prog lore -> Ordering
forall lore.
Annotations lore =>
Prog lore -> Prog lore -> Prog lore
min :: Prog lore -> Prog lore -> Prog lore
$cmin :: forall lore.
Annotations lore =>
Prog lore -> Prog lore -> Prog lore
max :: Prog lore -> Prog lore -> Prog lore
$cmax :: forall lore.
Annotations lore =>
Prog lore -> Prog lore -> Prog lore
>= :: Prog lore -> Prog lore -> Bool
$c>= :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
> :: Prog lore -> Prog lore -> Bool
$c> :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
<= :: Prog lore -> Prog lore -> Bool
$c<= :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
< :: Prog lore -> Prog lore -> Bool
$c< :: forall lore. Annotations lore => Prog lore -> Prog lore -> Bool
compare :: Prog lore -> Prog lore -> Ordering
$ccompare :: forall lore. Annotations lore => Prog lore -> Prog lore -> Ordering
$cp1Ord :: forall lore. Annotations lore => Eq (Prog lore)
Ord, Int -> Prog lore -> ShowS
[Prog lore] -> ShowS
Prog lore -> String
(Int -> Prog lore -> ShowS)
-> (Prog lore -> String)
-> ([Prog lore] -> ShowS)
-> Show (Prog lore)
forall lore. Annotations lore => Int -> Prog lore -> ShowS
forall lore. Annotations lore => [Prog lore] -> ShowS
forall lore. Annotations lore => Prog lore -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Prog lore] -> ShowS
$cshowList :: forall lore. Annotations lore => [Prog lore] -> ShowS
show :: Prog lore -> String
$cshow :: forall lore. Annotations lore => Prog lore -> String
showsPrec :: Int -> Prog lore -> ShowS
$cshowsPrec :: forall lore. Annotations lore => Int -> Prog lore -> ShowS
Show)