Safe Haskell | None |
---|---|
Language | Haskell98 |
- newtype IRBuilderT m a = IRBuilderT {
- unIRBuilderT :: StateT IRBuilderState m a
- type IRBuilder = IRBuilderT Identity
- class Monad m => MonadIRBuilder m where
- data PartialBlock = PartialBlock {}
- emptyPartialBlock :: Name -> PartialBlock
- data IRBuilderState = IRBuilderState {}
- emptyIRBuilder :: IRBuilderState
- runIRBuilder :: IRBuilderState -> IRBuilder a -> (a, [BasicBlock])
- runIRBuilderT :: Monad m => IRBuilderState -> IRBuilderT m a -> m (a, [BasicBlock])
- execIRBuilder :: IRBuilderState -> IRBuilder a -> [BasicBlock]
- execIRBuilderT :: Monad m => IRBuilderState -> IRBuilderT m a -> m [BasicBlock]
- modifyBlock :: MonadIRBuilder m => (PartialBlock -> PartialBlock) -> m ()
- fresh :: MonadIRBuilder m => m Name
- freshName :: MonadIRBuilder m => ShortByteString -> m Name
- freshUnName :: MonadIRBuilder m => m Name
- emitInstr :: MonadIRBuilder m => Type -> Instruction -> m Operand
- emitInstrVoid :: MonadIRBuilder m => Instruction -> m ()
- emitTerm :: MonadIRBuilder m => Terminator -> m ()
- emitBlockStart :: MonadIRBuilder m => Name -> m ()
- block :: MonadIRBuilder m => m Name
- named :: MonadIRBuilder m => m r -> ShortByteString -> m r
Documentation
newtype IRBuilderT m a Source #
This provides a uniform API for creating instructions and inserting them into a basic block: either at the end of a BasicBlock, or at a specific location in a block.
MonadTrans IRBuilderT Source # | |
MonadWriter w m => MonadWriter w (IRBuilderT m) Source # | |
MonadState s m => MonadState s (IRBuilderT m) Source # | |
MonadReader r m => MonadReader r (IRBuilderT m) Source # | |
MonadError e m => MonadError e (IRBuilderT m) Source # | |
Monad m => Monad (IRBuilderT m) Source # | |
Functor m => Functor (IRBuilderT m) Source # | |
MonadFix m => MonadFix (IRBuilderT m) Source # | |
MonadFail m => MonadFail (IRBuilderT m) Source # | |
Monad m => Applicative (IRBuilderT m) Source # | |
MonadPlus m => Alternative (IRBuilderT m) Source # | |
MonadPlus m => MonadPlus (IRBuilderT m) Source # | |
MonadIO m => MonadIO (IRBuilderT m) Source # | |
MonadCont m => MonadCont (IRBuilderT m) Source # | |
Monad m => MonadIRBuilder (IRBuilderT m) Source # | |
type IRBuilder = IRBuilderT Identity Source #
class Monad m => MonadIRBuilder m where Source #
liftIRState :: State IRBuilderState a -> m a Source #
liftIRState :: (MonadTrans t, MonadIRBuilder m1, m ~ t m1) => State IRBuilderState a -> m a Source #
MonadIRBuilder m => MonadIRBuilder (ListT m) Source # | |
MonadIRBuilder m => MonadIRBuilder (MaybeT m) Source # | |
Monad m => MonadIRBuilder (IRBuilderT m) Source # | |
MonadIRBuilder m => MonadIRBuilder (ExceptT e m) Source # | |
MonadIRBuilder m => MonadIRBuilder (StateT s m) Source # | |
MonadIRBuilder m => MonadIRBuilder (StateT s m) Source # | |
(Monoid w, MonadIRBuilder m) => MonadIRBuilder (WriterT w m) Source # | |
(Monoid w, MonadIRBuilder m) => MonadIRBuilder (WriterT w m) Source # | |
MonadIRBuilder m => MonadIRBuilder (IdentityT * m) Source # | |
MonadIRBuilder m => MonadIRBuilder (ContT * r m) Source # | |
MonadIRBuilder m => MonadIRBuilder (ReaderT * r m) Source # | |
(MonadIRBuilder m, Monoid w) => MonadIRBuilder (RWST r w s m) Source # | |
(MonadIRBuilder m, Monoid w) => MonadIRBuilder (RWST r w s m) Source # | |
data PartialBlock Source #
A partially constructed block as a sequence of instructions
emptyPartialBlock :: Name -> PartialBlock Source #
data IRBuilderState Source #
Builder monad state
runIRBuilder :: IRBuilderState -> IRBuilder a -> (a, [BasicBlock]) Source #
Evaluate IRBuilder to a result and a list of basic blocks
runIRBuilderT :: Monad m => IRBuilderState -> IRBuilderT m a -> m (a, [BasicBlock]) Source #
Evaluate IRBuilderT to a result and a list of basic blocks
execIRBuilder :: IRBuilderState -> IRBuilder a -> [BasicBlock] Source #
Evaluate IRBuilder to a list of basic blocks
execIRBuilderT :: Monad m => IRBuilderState -> IRBuilderT m a -> m [BasicBlock] Source #
Evaluate IRBuilderT to a list of basic blocks
Low-level functionality
modifyBlock :: MonadIRBuilder m => (PartialBlock -> PartialBlock) -> m () Source #
fresh :: MonadIRBuilder m => m Name Source #
Generate a fresh name. The resulting name is numbered or
based on the name suggested with named
if that's used.
freshName :: MonadIRBuilder m => ShortByteString -> m Name Source #
Generate a fresh name from a name suggestion
freshUnName :: MonadIRBuilder m => m Name Source #
Generate a fresh numbered name
:: MonadIRBuilder m | |
=> Type | Return type |
-> Instruction | |
-> m Operand |
Emit instruction
emitInstrVoid :: MonadIRBuilder m => Instruction -> m () Source #
Emit instruction that returns void
emitTerm :: MonadIRBuilder m => Terminator -> m () Source #
Emit terminator
emitBlockStart :: MonadIRBuilder m => Name -> m () Source #
Starts a new block labelled using the given name and ends the previous one. The name is assumed to be fresh.
High-level functionality
block :: MonadIRBuilder m => m Name Source #
Starts a new block and ends the previous one
named :: MonadIRBuilder m => m r -> ShortByteString -> m r Source #