Safe Haskell | Safe-Infered |
---|
- data HermitBinding
- hermitBindingDepth :: HermitBinding -> Int
- data Context
- initContext :: ModGuts -> Context
- (@@) :: Context -> Int -> Context
- addAltBindings :: [Id] -> Context -> Context
- addBinding :: CoreBind -> Context -> Context
- addCaseBinding :: (Id, CoreExpr, CoreAlt) -> Context -> Context
- addLambdaBinding :: Id -> Context -> Context
- hermitBindings :: Context -> Map Id HermitBinding
- hermitDepth :: Context -> Int
- hermitPath :: Context -> AbsolutePath
- hermitModGuts :: Context -> ModGuts
- lookupHermitBinding :: Id -> Context -> Maybe HermitBinding
- listBindings :: Context -> [Id]
- boundIn :: Id -> Context -> Bool
HERMIT Bindings
data HermitBinding Source
HERMIT's representation of variable bindings.
BIND Int Bool CoreExpr | Binding depth, whether it is recursive, and the bound value (which cannot be inlined without checking for scoping issues). |
LAM Int | For a lambda binding you only know the depth. |
CASE Int CoreExpr (AltCon, [Id]) | For case wildcard binders. First expr points to scrutinee, second to AltCon (which can be converted to Constructor or Literal). |
hermitBindingDepth :: HermitBinding -> IntSource
Get the depth of a binding.
The HERMIT Context
The HERMIT context, containing all bindings in scope and the current location in the AST. The bindings here are lazy by choice, so that we can avoid the cost of building the context if we never use it.
PathContext Context | The HERMIT context stores an |
Walker Context HermitM ModGuts | |
Walker Context HermitM CoreProgram | |
Walker Context HermitM CoreExpr | |
Walker Context HermitM CoreBind | |
Walker Context HermitM CoreAlt | |
Walker Context HermitM CoreDef | |
Walker Context HermitM Core | |
Extern (RewriteH Core) | |
Extern (TranslateH Core String) | |
Extern (TranslateH Core ()) | |
Extern (TranslateH Core Path) |
(@@) :: Context -> Int -> ContextSource
Update the context by extending the stored AbsolutePath
to a child.
addAltBindings :: [Id] -> Context -> ContextSource
Add the Ids bound by a DataCon in a case. Like lambda bindings, in that we know nothing about them, but all bound at the same depth, so we cannot just fold addLambdaBinding over the list.
addBinding :: CoreBind -> Context -> ContextSource
Add all bindings in a binding group to the Context
.
addCaseBinding :: (Id, CoreExpr, CoreAlt) -> Context -> ContextSource
Add the bindings for a specific case alternative.
addLambdaBinding :: Id -> Context -> ContextSource
Add a binding that you know nothing about, except that it may shadow something. If so, do not worry about it here, just remember the binding and the depth. When we want to inline a value from the environment, we then check to see what is free in the inlinee, and see if any of the frees will stop the validity of the inlining.
hermitBindings :: Context -> Map Id HermitBindingSource
All (important) bindings in scope.
hermitDepth :: Context -> IntSource
The depth of the bindings.
hermitPath :: Context -> AbsolutePathSource
The AbsolutePath
to the current node from the root.
hermitModGuts :: Context -> ModGutsSource
The ModGuts
of the current module.
lookupHermitBinding :: Id -> Context -> Maybe HermitBindingSource
Lookup the binding for an identifier in a Context
.
listBindings :: Context -> [Id]Source
List all the identifiers bound in the Context
.