Insert explicit RC instructions. So, it assumes the input code does not contain inc
nor dec
instructions.
This transformation is applied before lower level optimizations
that introduce the instructions release
and set
Equations
- Lean.IR.ExplicitRC.instInhabitedVarInfo = { default := { ref := default, persistent := default, consume := default } }
@[inline, reducible]
Equations
- Lean.IR.ExplicitRC.VarMap = Lean.RBMap Lean.IR.VarId Lean.IR.ExplicitRC.VarInfo fun (x y : Lean.IR.VarId) => compare x.idx y.idx
Instances For
- env : Lean.Environment
- decls : Array Lean.IR.Decl
- varMap : Lean.IR.ExplicitRC.VarMap
- jpLiveVarMap : Lean.IR.JPLiveVarMap
- localCtx : Lean.IR.LocalContext
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.IR.ExplicitRC.getJPLiveVars ctx j = match Lean.RBMap.find? ctx.jpLiveVarMap j with | some s => s | none => ∅
Instances For
Equations
- Lean.IR.ExplicitRC.mustConsume ctx x = let info := Lean.IR.ExplicitRC.getVarInfo ctx x; info.ref && info.consume
Instances For
@[inline]
def
Lean.IR.ExplicitRC.addInc
(ctx : Lean.IR.ExplicitRC.Context)
(x : Lean.IR.VarId)
(b : Lean.IR.FnBody)
(n : optParam Nat 1)
:
Equations
- Lean.IR.ExplicitRC.addInc ctx x b n = let info := Lean.IR.ExplicitRC.getVarInfo ctx x; if (n == 0) = true then b else Lean.IR.FnBody.inc x n true info.persistent b
Instances For
@[inline]
def
Lean.IR.ExplicitRC.addDec
(ctx : Lean.IR.ExplicitRC.Context)
(x : Lean.IR.VarId)
(b : Lean.IR.FnBody)
:
Equations
- Lean.IR.ExplicitRC.addDec ctx x b = let info := Lean.IR.ExplicitRC.getVarInfo ctx x; Lean.IR.FnBody.dec x 1 true info.persistent b
Instances For
def
Lean.IR.ExplicitRC.updateVarInfoWithParams
(ctx : Lean.IR.ExplicitRC.Context)
(ps : Array Lean.IR.Param)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lean.IR.ExplicitRC.visitDecl
(env : Lean.Environment)
(decls : Array Lean.IR.Decl)
(d : Lean.IR.Decl)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.IR.explicitRC decls = do let env ← Lean.IR.getEnv pure (Array.map (Lean.IR.ExplicitRC.visitDecl env decls) decls)