Safe Haskell | None |
---|---|
Language | Haskell2010 |
Definition of a polymorphic (generic) pass that can work with programs of any rep.
Synopsis
- data PassM a
- runPassM :: MonadFreshNames m => PassM a -> m (a, Log)
- liftEither :: Show err => Either err a -> PassM a
- liftEitherM :: Show err => PassM (Either err a) -> PassM a
- data Pass fromrep torep = Pass {
- passName :: String
- passDescription :: String
- passFunction :: Prog fromrep -> PassM (Prog torep)
- passLongOption :: Pass fromrep torep -> String
- parPass :: (a -> PassM b) -> [a] -> PassM [b]
- intraproceduralTransformation :: (Scope rep -> Stms rep -> PassM (Stms rep)) -> Prog rep -> PassM (Prog rep)
- intraproceduralTransformationWithConsts :: (Stms fromrep -> PassM (Stms torep)) -> (Stms torep -> FunDef fromrep -> PassM (FunDef torep)) -> Prog fromrep -> PassM (Prog torep)
Documentation
The monad in which passes execute.
Instances
Monad PassM Source # | |
Functor PassM Source # | |
Applicative PassM Source # | |
MonadLogger PassM Source # | |
MonadFreshNames PassM Source # | |
Defined in Futhark.Pass getNameSource :: PassM VNameSource Source # putNameSource :: VNameSource -> PassM () Source # |
runPassM :: MonadFreshNames m => PassM a -> m (a, Log) Source #
Execute a PassM
action, yielding logging information and either
an error text or a result.
liftEither :: Show err => Either err a -> PassM a Source #
Turn an Either
computation into a PassM
. If the Either
is
Left
, the result is a CompilerBug
.
data Pass fromrep torep Source #
Pass | |
|
passLongOption :: Pass fromrep torep -> String Source #
Take the name of the pass, turn spaces into dashes, and make all characters lowercase.
parPass :: (a -> PassM b) -> [a] -> PassM [b] Source #
Apply a PassM
operation in parallel to multiple elements,
joining together the name sources and logs, and propagating any
error properly.
intraproceduralTransformation :: (Scope rep -> Stms rep -> PassM (Stms rep)) -> Prog rep -> PassM (Prog rep) Source #
Like intraproceduralTransformationWithConsts
, but do not change
the top-level constants, and simply pass along their Scope
.
intraproceduralTransformationWithConsts :: (Stms fromrep -> PassM (Stms torep)) -> (Stms torep -> FunDef fromrep -> PassM (FunDef torep)) -> Prog fromrep -> PassM (Prog torep) Source #
Apply some operation to the top-level constants. Then applies an
operation to all the function function definitions, which are also
given the transformed constants so they can be brought into scope.
The function definition transformations are run in parallel (with
parPass
), since they cannot affect each other.