GHC.StgToJS.ExprCtx

ghc-9.10.0.20240413: The GHC API

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file LICENSE)
Maintainer | Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io>
Stability | experimental
Safe Haskell | None
Language | GHC2021

GHC.StgToJS.ExprCtx

Contents

- Let-no-escape

Description

Synopsis

- data ExprCtx
- initExprCtx :: Id -> ExprCtx
- ctxIsEvaluated :: Id -> Bool
- ctxSetSrcSpan :: RealSrcSpan -> ExprCtx -> ExprCtx
- ctxSrcSpan :: ExprCtx -> Maybe RealSrcSpan
- ctxSetTop :: Id -> ExprCtx -> ExprCtx
- ctxTarget :: ExprCtx -> [TypedExpr]
- ctxSetTarget :: [TypedExpr] -> ExprCtx -> ExprCtx
- ctxClearLneFrame :: ExprCtx -> ExprCtx
- ctxUpdateLneFrame :: [(Id, Int)] -> [Id] -> ExprCtx -> ExprCtx
- ctxLneFrameVars :: ExprCtx -> [(Id, Int)]
- ctxLneFrameSize :: ExprCtx -> Int
- ctxIsLneBinding :: ExprCtx -> Id -> Bool
- ctxIsLneLiveVar :: ExprCtx -> Id -> Bool
- ctxLneBindingStackSize :: ExprCtx -> Id -> Maybe Int
- ctxLneShrinkStack :: ExprCtx -> Int -> ExprCtx

# Documentation

data ExprCtx Source #

Context into which an expression is evaluated

initExprCtx :: Id -> ExprCtx Source #

Initialize an expression context in the context of the given top-level binding Id

ctxIsEvaluated :: Id -> Bool Source #

Predicate: do we know for sure that the given Id is evaluated?

ctxSetSrcSpan :: RealSrcSpan -> ExprCtx -> ExprCtx Source #

Set source location

ctxSrcSpan :: ExprCtx -> Maybe RealSrcSpan Source #

Source location

ctxSetTop :: Id -> ExprCtx -> ExprCtx Source #

Set top-level binding Id

ctxTarget :: ExprCtx -> [TypedExpr] Source #

Target variables for the evaluated expression

ctxSetTarget :: [TypedExpr] -> ExprCtx -> ExprCtx Source #

Set target

# Let-no-escape

ctxClearLneFrame :: ExprCtx -> ExprCtx Source #

Remove information about the current LNE frame

ctxUpdateLneFrame :: [(Id, Int)] -> [Id] -> ExprCtx -> ExprCtx Source #

Update let-no-escape frame

ctxLneFrameVars :: ExprCtx -> [(Id, Int)] Source #

Contents of current LNE frame

Variables and their index on the stack

ctxLneFrameSize :: ExprCtx -> Int Source #

Cache the length of `ctxLneFrameVars`

ctxIsLneBinding :: ExprCtx -> Id -> Bool Source #

Does the given Id correspond to a LNE binding

ctxIsLneLiveVar :: ExprCtx -> Id -> Bool Source #

Does the given Id correspond to a LNE live var on the stack

ctxLneBindingStackSize :: ExprCtx -> Id -> Maybe Int Source #

Return the LNE stack size associated to the given Id. Return Nothing when the Id doesn't correspond to a LNE binding.

ctxLneShrinkStack :: ExprCtx -> Int -> ExprCtx Source #

Shrink the LNE stack to the given size