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

Safe Haskell | None
Language | GHC2021

Futhark.Internalise.Monad

Contents

- Convenient reexports

Synopsis

- data InternaliseM a
- runInternaliseM :: MonadFreshNames m => Bool -> InternaliseM () -> m (OpaqueTypes, Stms SOACS, [FunDef SOACS])
- throwError :: MonadError e m => e -> m a
- type VarSubsts = Map VName [SubExp]
- data InternaliseEnv = InternaliseEnv {
  - envSubsts :: VarSubsts
  - envDoBoundsChecks :: Bool
  - envSafe :: Bool
  - envAttrs :: Attrs
  - envLoc :: Loc
  }
- type FunInfo = ([VName], [DeclType], [FParam SOACS], [(SubExp, Type)] -> Maybe [(DeclExtType, RetAls)])
- substitutingVars :: VarSubsts -> InternaliseM a -> InternaliseM a
- lookupSubst :: VName -> InternaliseM (Maybe [SubExp])
- addOpaques :: OpaqueTypes -> InternaliseM ()
- addFunDef :: FunDef SOACS -> InternaliseM ()
- lookupFunction :: VName -> InternaliseM FunInfo
- lookupConst :: VName -> InternaliseM (Maybe [SubExp])
- bindFunction :: VName -> FunDef SOACS -> FunInfo -> InternaliseM ()
- bindConstant :: VName -> FunDef SOACS -> InternaliseM ()
- assert :: String -> SubExp -> ErrorMsg SubExp -> InternaliseM Certs
- locating :: Located a => a -> InternaliseM b -> InternaliseM b
- module Futhark.Tools

# Documentation

data InternaliseM a Source #

#### Instances

Instances details

MonadBuilder InternaliseM Source # |

Instance details

Defined in Futhark.Internalise.Monad

Associated Types

type Rep InternaliseM |
Instance details Defined in Futhark.Internalise.Monad type Rep InternaliseM = SOACS

Methods

mkExpDecM :: Pat (LetDec (Rep InternaliseM)) -> Exp (Rep InternaliseM) -> InternaliseM (ExpDec (Rep InternaliseM)) Source #

mkBodyM :: Stms (Rep InternaliseM) -> Result -> InternaliseM (Body (Rep InternaliseM)) Source #

mkLetNamesM :: [VName] -> Exp (Rep InternaliseM) -> InternaliseM (Stm (Rep InternaliseM)) Source #

addStm :: Stm (Rep InternaliseM) -> InternaliseM () Source #

addStms :: Stms (Rep InternaliseM) -> InternaliseM () Source #

collectStms :: InternaliseM a -> InternaliseM (a, Stms (Rep InternaliseM)) Source #

certifying :: Certs -> InternaliseM a -> InternaliseM a Source #

MonadFreshNames InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods getNameSource :: InternaliseM VNameSource Source # putNameSource :: VNameSource -> InternaliseM () Source #
Applicative InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods pure :: a -> InternaliseM a Source # (<*>) :: InternaliseM (a -> b) -> InternaliseM a -> InternaliseM b Source # liftA2 :: (a -> b -> c) -> InternaliseM a -> InternaliseM b -> InternaliseM c Source # (*>) :: InternaliseM a -> InternaliseM b -> InternaliseM b Source # (<*) :: InternaliseM a -> InternaliseM b -> InternaliseM a Source #
Functor InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods fmap :: (a -> b) -> InternaliseM a -> InternaliseM b Source # (<$) :: a -> InternaliseM b -> InternaliseM a Source #
Monad InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods (>>=) :: InternaliseM a -> (a -> InternaliseM b) -> InternaliseM b Source # (>>) :: InternaliseM a -> InternaliseM b -> InternaliseM b Source # return :: a -> InternaliseM a Source #
HasScope SOACS InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods lookupType :: VName -> InternaliseM Type Source # lookupInfo :: VName -> InternaliseM (NameInfo SOACS) Source # askScope :: InternaliseM (Scope SOACS) Source # asksScope :: (Scope SOACS -> a) -> InternaliseM a Source #
LocalScope SOACS InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods localScope :: Scope SOACS -> InternaliseM a -> InternaliseM a Source #
MonadReader InternaliseEnv InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods ask :: InternaliseM InternaliseEnv Source # local :: (InternaliseEnv -> InternaliseEnv) -> InternaliseM a -> InternaliseM a Source # reader :: (InternaliseEnv -> a) -> InternaliseM a Source #
type Rep InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad type Rep InternaliseM = SOACS

runInternaliseM :: MonadFreshNames m => Bool -> InternaliseM () -> m (OpaqueTypes, Stms SOACS, [FunDef SOACS]) Source #

throwError :: MonadError e m => e -> m a Source #

Is used within a monadic computation to begin exception processing.

type VarSubsts = Map VName [SubExp] Source #

A mapping from external variable names to the corresponding internalised subexpressions.

data InternaliseEnv Source #

Constructors

InternaliseEnv |

Fields

- envSubsts :: VarSubsts
- envDoBoundsChecks :: Bool
- envSafe :: Bool
- envAttrs :: Attrs
- envLoc :: Loc

#### Instances

Instances details

MonadReader InternaliseEnv InternaliseM Source # |
Instance details Defined in Futhark.Internalise.Monad Methods ask :: InternaliseM InternaliseEnv Source # local :: (InternaliseEnv -> InternaliseEnv) -> InternaliseM a -> InternaliseM a Source # reader :: (InternaliseEnv -> a) -> InternaliseM a Source #

type FunInfo = ([VName], [DeclType], [FParam SOACS], [(SubExp, Type)] -> Maybe [(DeclExtType, RetAls)]) Source #

substitutingVars :: VarSubsts -> InternaliseM a -> InternaliseM a Source #

lookupSubst :: VName -> InternaliseM (Maybe [SubExp]) Source #

addOpaques :: OpaqueTypes -> InternaliseM () Source #

Add opaque types. If the types are already known, they will not be added.

addFunDef :: FunDef SOACS -> InternaliseM () Source #

Add a function definition to the program being constructed.

lookupFunction :: VName -> InternaliseM FunInfo Source #

lookupConst :: VName -> InternaliseM (Maybe [SubExp]) Source #

bindFunction :: VName -> FunDef SOACS -> FunInfo -> InternaliseM () Source #

bindConstant :: VName -> FunDef SOACS -> InternaliseM () Source #

assert :: String -> SubExp -> ErrorMsg SubExp -> InternaliseM Certs Source #

Construct an `Assert` statement, but taking attributes into account. Always use this function, and never construct `Assert` directly in the internaliser!

locating :: Located a => a -> InternaliseM b -> InternaliseM b Source #

Attach the provided location to all statements produced during execution of this action.

# Convenient reexports

module Futhark.Tools