futhark-0.19.5: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Futhark.Analysis.PrimExp.Convert

Description

Converting back and forth between PrimExps. Use the ToExp instance to convert to Futhark expressions.

Synopsis

Documentation

primExpFromExp :: (MonadFail m, Decorations lore) => (VName -> m (PrimExp v)) -> Exp lore -> m (PrimExp v) Source #

Convert an expression to a PrimExp. The provided function is used to convert expressions that are not trivially PrimExps. This includes constants and variable names, which are passed as SubExps.

primExpFromSubExp :: PrimType -> SubExp -> PrimExp VName Source #

Convert SubExps of a given type.

pe32 :: SubExp -> TPrimExp Int32 VName Source #

Shorthand for constructing a TPrimExp of type Int32.

le32 :: a -> TPrimExp Int32 a Source #

Shorthand for constructing a TPrimExp of type Int32, from a leaf.

pe64 :: SubExp -> TPrimExp Int64 VName Source #

Shorthand for constructing a TPrimExp of type Int64.

le64 :: a -> TPrimExp Int64 a Source #

Shorthand for constructing a TPrimExp of type Int64, from a leaf.

f32pe :: SubExp -> TPrimExp Float VName Source #

Shorthand for constructing a TPrimExp of type Float32.

f32le :: a -> TPrimExp Float a Source #

Shorthand for constructing a TPrimExp of type Float32, from a leaf.

f64pe :: SubExp -> TPrimExp Double VName Source #

Shorthand for constructing a TPrimExp of type Float64.

f64le :: a -> TPrimExp Double a Source #

Shorthand for constructing a TPrimExp of type Float64, from a leaf.

primExpFromSubExpM :: Applicative m => (VName -> m (PrimExp v)) -> SubExp -> m (PrimExp v) Source #

Like primExpFromExp, but for a SubExp.

replaceInPrimExp :: (a -> PrimType -> PrimExp b) -> PrimExp a -> PrimExp b Source #

As replaceInPrimExpM, but in the identity monad.

replaceInPrimExpM :: Monad m => (a -> PrimType -> m (PrimExp b)) -> PrimExp a -> m (PrimExp b) Source #

Applying a monadic transformation to the leaves in a PrimExp.

substituteInPrimExp :: Ord v => Map v (PrimExp v) -> PrimExp v -> PrimExp v Source #

Substituting names in a PrimExp with other PrimExps

primExpSlice :: Slice SubExp -> Slice (TPrimExp Int64 VName) Source #

Convert a SubExp slice to a PrimExp slice.

subExpSlice :: MonadBinder m => Slice (TPrimExp Int64 VName) -> m (Slice SubExp) Source #

Convert a PrimExp slice to a SubExp slice.

Module reexport

Orphan instances

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

Methods

toExp :: MonadBinder m => PrimExp v -> m (Exp (Lore m)) Source #

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

Methods

toExp :: MonadBinder m => TPrimExp t v -> m (Exp (Lore m)) Source #