File: .lake/packages/lean4/src/lean/Lean/Compiler/IR/EmitLLVM.lean

full_name: Lean.IR.leanMainFn
code: def leanMainFn 
goal: String

full_name: Lean.IR.LLVM.size_tType
code: def size_tType (llvmctx : LLVM.Context) : BaseIO (LLVM.LLVMType llvmctx) 
goal: BaseIO (LLVM.LLVMType llvmctx)

full_name: Lean.IR.LLVM.unsignedType
code: def unsignedType (llvmctx : LLVM.Context) : BaseIO (LLVM.LLVMType llvmctx) 
goal: BaseIO (LLVM.LLVMType llvmctx)

full_name: Lean.IR.LLVM.getOrAddFunction
code: def getOrAddFunction (m : LLVM.Module ctx) (name : String) (type : LLVM.LLVMType ctx) : BaseIO (LLVM.Value ctx) 
goal: BaseIO (LLVM.Value ctx)

full_name: Lean.IR.LLVM.getOrAddGlobal
code: def getOrAddGlobal (m : LLVM.Module ctx) (name : String) (type : LLVM.LLVMType ctx) : BaseIO (LLVM.Value ctx) 
goal: BaseIO (LLVM.Value ctx)

full_name: Lean.IR.EmitLLVM.Context.mainFn
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Lean.IR.FunId

full_name: Lean.IR.EmitLLVM.Context.jpMap
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Lean.IR.JPParamsMap

full_name: Lean.IR.EmitLLVM.Context.env
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Lean.Environment

full_name: Lean.IR.EmitLLVM.Context.modName
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Lean.Name

full_name: Lean.IR.EmitLLVM.Context.mainParams
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Array Lean.IR.Param

full_name: Lean.IR.EmitLLVM.Context
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: Type

full_name: Lean.IR.EmitLLVM.Context.llvmmodule
code: structure Context (llvmctx : LLVM.Context) where
  env        : Environment
  modName    : Name
  jpMap      : JPParamsMap := {}
  mainFn     : FunId := default
  mainParams : Array Param := #[]
  llvmmodule : LLVM.Module llvmctx
goal: LLVM.Module llvmctx

full_name: Lean.IR.EmitLLVM.State
code: structure State (llvmctx : LLVM.Context) where
  var2val : HashMap VarId (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)
  jp2bb   : HashMap JoinPointId (LLVM.BasicBlock llvmctx)
goal: Type

full_name: Lean.IR.EmitLLVM.State.var2val
code: structure State (llvmctx : LLVM.Context) where
  var2val : HashMap VarId (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)
  jp2bb   : HashMap JoinPointId (LLVM.BasicBlock llvmctx)
goal: Lean.HashMap Lean.IR.VarId (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.State.jp2bb
code: structure State (llvmctx : LLVM.Context) where
  var2val : HashMap VarId (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)
  jp2bb   : HashMap JoinPointId (LLVM.BasicBlock llvmctx)
goal: Lean.HashMap Lean.IR.JoinPointId (LLVM.BasicBlock llvmctx)

full_name: Lean.IR.EmitLLVM.Error
code: abbrev Error 
goal: Type

full_name: Lean.IR.EmitLLVM.M
code: abbrev M (llvmctx : LLVM.Context) 
goal: Type

full_name: Lean.IR.EmitLLVM.instInhabitedM
code: instance : Inhabited (M llvmctx α) 
goal: Inhabited (Lean.IR.EmitLLVM.M llvmctx α)

full_name: Lean.IR.EmitLLVM.addVartoState
code: def addVartoState (x : VarId) (v : LLVM.Value llvmctx) (ty : LLVM.LLVMType llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.addJpTostate
code: def addJpTostate (jp : JoinPointId) (bb : LLVM.BasicBlock llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitJp
code: def emitJp (jp : JoinPointId) : M llvmctx (LLVM.BasicBlock llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.BasicBlock llvmctx)

full_name: Lean.IR.EmitLLVM.getLLVMModule
code: def getLLVMModule : M llvmctx (LLVM.Module llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Module llvmctx)

full_name: Lean.IR.EmitLLVM.getEnv
code: def getEnv : M llvmctx Environment 
goal: Lean.IR.EmitLLVM.M llvmctx Lean.Environment

full_name: Lean.IR.EmitLLVM.getModName
code: def getModName : M llvmctx  Name 
goal: Lean.IR.EmitLLVM.M llvmctx Lean.Name

full_name: Lean.IR.EmitLLVM.getDecl
code: def getDecl (n : Name) : M llvmctx Decl 
goal: Lean.IR.EmitLLVM.M llvmctx Lean.IR.Decl

full_name: Lean.IR.EmitLLVM.constInt8
code: def constInt8 (n : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.constInt64
code: def constInt64 (n : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.constIntSizeT
code: def constIntSizeT (n : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.constIntUnsigned
code: def constIntUnsigned (n : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.getOrCreateFunctionPrototype
code: def getOrCreateFunctionPrototype (mod : LLVM.Module llvmctx)
    (retty : LLVM.LLVMType llvmctx) (name : String) (args : Array (LLVM.LLVMType llvmctx)) : M llvmctx  (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanBox
code: def callLeanBox (builder : LLVM.Builder llvmctx)
    (arg : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanMarkPersistentFn
code: def callLeanMarkPersistentFn (builder : LLVM.Builder llvmctx) (arg : LLVM.Value llvmctx) : M llvmctx  Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.RefcountKind
code: inductive RefcountKind where
  | inc | dec
goal: Type

full_name: Lean.IR.EmitLLVM.RefcountKind.dec
code: inductive RefcountKind where
  | inc | dec
goal: Lean.IR.EmitLLVM.RefcountKind

full_name: Lean.IR.EmitLLVM.RefcountKind.inc
code: inductive RefcountKind where
  | inc | dec
goal: Lean.IR.EmitLLVM.RefcountKind

full_name: Lean.IR.EmitLLVM.instToStringRefcountKind
code: instance : ToString RefcountKind 
goal: ToString Lean.IR.EmitLLVM.RefcountKind

full_name: Lean.IR.EmitLLVM.callLeanRefcountFn
code: def callLeanRefcountFn (builder : LLVM.Builder llvmctx)
    (kind : RefcountKind) (checkRef? : Bool) (arg : LLVM.Value llvmctx)
    (delta : Option (LLVM.Value llvmctx) := Option.none) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanDecRef
code: def callLeanDecRef (builder : LLVM.Builder llvmctx) (res : LLVM.Value llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanUnsignedToNatFn
code: def callLeanUnsignedToNatFn (builder : LLVM.Builder llvmctx)
    (n : Nat) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanMkStringUncheckedFn
code: def callLeanMkStringUncheckedFn (builder : LLVM.Builder llvmctx)
    (strPtr nBytes nChars : LLVM.Value llvmctx) (name : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanMkString
code: def callLeanMkString (builder : LLVM.Builder llvmctx)
    (strPtr : LLVM.Value llvmctx) (name : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanCStrToNatFn
code: def callLeanCStrToNatFn (builder : LLVM.Builder llvmctx)
    (n : Nat) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanIOMkWorld
code: def callLeanIOMkWorld (builder : LLVM.Builder llvmctx) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanIOResultIsError
code: def callLeanIOResultIsError (builder : LLVM.Builder llvmctx)
    (arg : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanAllocCtor
code: def callLeanAllocCtor (builder : LLVM.Builder llvmctx)
    (tag num_objs scalar_sz : Nat) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanCtorSet
code: def callLeanCtorSet (builder : LLVM.Builder llvmctx)
    (o i v : LLVM.Value llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanIOResultMKOk
code: def callLeanIOResultMKOk (builder : LLVM.Builder llvmctx)
    (v : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanAllocClosureFn
code: def callLeanAllocClosureFn (builder : LLVM.Builder llvmctx)
    (f arity nys : LLVM.Value llvmctx) (retName : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanClosureSetFn
code: def callLeanClosureSetFn (builder : LLVM.Builder llvmctx)
    (closure ix arg : LLVM.Value llvmctx) (retName : String := "") : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanObjTag
code: def callLeanObjTag (builder : LLVM.Builder llvmctx)
    (closure : LLVM.Value llvmctx) (retName : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanIOResultGetValue
code: def callLeanIOResultGetValue (builder : LLVM.Builder llvmctx)
    (v : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanCtorRelease
code: def callLeanCtorRelease (builder : LLVM.Builder llvmctx)
    (closure i : LLVM.Value llvmctx) (retName : String := "") : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanCtorSetTag
code: def callLeanCtorSetTag (builder : LLVM.Builder llvmctx)
    (closure i : LLVM.Value llvmctx) (retName : String := "") : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.toLLVMType
code: def toLLVMType (t : IRType) : M llvmctx (LLVM.LLVMType llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.LLVMType llvmctx)

full_name: Lean.IR.EmitLLVM.throwInvalidExportName
code: def throwInvalidExportName {α : Type} (n : Name) : M llvmctx α 
goal: Lean.IR.EmitLLVM.M llvmctx α

full_name: Lean.IR.EmitLLVM.toCName
code: def toCName (n : Name) : M llvmctx String 
goal: Lean.IR.EmitLLVM.M llvmctx String

full_name: Lean.IR.EmitLLVM.toCInitName
code: def toCInitName (n : Name) : M llvmctx String 
goal: Lean.IR.EmitLLVM.M llvmctx String

full_name: Lean.IR.EmitLLVM.ShouldForwardControlFlow.no
code: /--
## LLVM Control flow Utilities
-/

-- Indicates whether the API for building the blocks for then/else should
-- forward the control flow to the merge block.
inductive ShouldForwardControlFlow where
| yes | no
goal: Lean.IR.EmitLLVM.ShouldForwardControlFlow

full_name: Lean.IR.EmitLLVM.ShouldForwardControlFlow.yes
code: /--
## LLVM Control flow Utilities
-/

-- Indicates whether the API for building the blocks for then/else should
-- forward the control flow to the merge block.
inductive ShouldForwardControlFlow where
| yes | no
goal: Lean.IR.EmitLLVM.ShouldForwardControlFlow

full_name: Lean.IR.EmitLLVM.ShouldForwardControlFlow
code: /--
## LLVM Control flow Utilities
-/

-- Indicates whether the API for building the blocks for then/else should
-- forward the control flow to the merge block.
inductive ShouldForwardControlFlow where
| yes | no
goal: Type

full_name: Lean.IR.EmitLLVM.builderGetInsertionFn
code: def builderGetInsertionFn (builder : LLVM.Builder llvmctx) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.builderAppendBasicBlock
code: def builderAppendBasicBlock (builder : LLVM.Builder llvmctx) (name : String) : M llvmctx (LLVM.BasicBlock llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.BasicBlock llvmctx)

full_name: Lean.IR.EmitLLVM.buildPrologueAlloca
code: /--
Add an alloca to the first BB of the current function. The builders final position
will be the end of the BB that we came from.

If it is possible to put an alloca in the first BB this approach is to be preferred
over putting it in other BBs. This is because mem2reg only inspects allocas in the first BB,
leading to missed optimizations for allocas in other BBs.
-/
def buildPrologueAlloca (builder : LLVM.Builder llvmctx) (ty : LLVM.LLVMType llvmctx) (name : @&String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.buildWhile_
code: def buildWhile_ (builder : LLVM.Builder llvmctx) (name : String)
    (condcodegen : LLVM.Builder llvmctx → M llvmctx (LLVM.Value llvmctx))
    (bodycodegen : LLVM.Builder llvmctx → M llvmctx Unit) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.buildIfThen_
code: def buildIfThen_ (builder : LLVM.Builder llvmctx) (name : String) (brval : LLVM.Value llvmctx)
    (thencodegen : LLVM.Builder llvmctx → M llvmctx ShouldForwardControlFlow) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.buildIfThenElse_
code: def buildIfThenElse_ (builder : LLVM.Builder llvmctx)  (name : String) (brval : LLVM.Value llvmctx)
    (thencodegen : LLVM.Builder llvmctx → M llvmctx ShouldForwardControlFlow)
    (elsecodegen : LLVM.Builder llvmctx → M llvmctx ShouldForwardControlFlow) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.buildLeanBoolTrue?
code: def buildLeanBoolTrue? (builder : LLVM.Builder llvmctx)
    (b : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitFnDeclAux
code: def emitFnDeclAux (mod : LLVM.Module llvmctx)
    (decl : Decl) (cppBaseName : String) (isExternal : Bool) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitFnDecl
code: def emitFnDecl (decl : Decl) (isExternal : Bool) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitExternDeclAux
code: def emitExternDeclAux (decl : Decl) (cNameStr : String) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitFnDecls
code: def emitFnDecls : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitLhsSlot_
code: def emitLhsSlot_ (x : VarId) : M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitLhsVal
code: def emitLhsVal (builder : LLVM.Builder llvmctx)
    (x : VarId) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitLhsSlotStore
code: def emitLhsSlotStore (builder : LLVM.Builder llvmctx)
    (x : VarId) (v : LLVM.Value llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitArgSlot_
code: def emitArgSlot_ (builder : LLVM.Builder llvmctx)
    (x : Arg) : M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitArgVal
code: def emitArgVal (builder : LLVM.Builder llvmctx)
    (x : Arg) (name : String := "") : M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitAllocCtor
code: def emitAllocCtor (builder : LLVM.Builder llvmctx)
    (c : CtorInfo) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitCtorSetArgs
code: def emitCtorSetArgs (builder : LLVM.Builder llvmctx)
    (z : VarId) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitCtor
code: def emitCtor (builder : LLVM.Builder llvmctx)
    (z : VarId) (c : CtorInfo) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitInc
code: def emitInc (builder : LLVM.Builder llvmctx)
    (x : VarId) (n : Nat) (checkRef? : Bool) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitDec
code: def emitDec (builder : LLVM.Builder llvmctx)
    (x : VarId) (n : Nat) (checkRef? : Bool) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitNumLit
code: def emitNumLit (builder : LLVM.Builder llvmctx)
    (t : IRType) (v : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.toHexDigit
code: def toHexDigit (c : Nat) : String 
goal: String

full_name: Lean.IR.EmitLLVM.quoteString
code: def quoteString (s : String) : String 
goal: String

full_name: Lean.IR.EmitLLVM.emitSimpleExternalCall
code: def emitSimpleExternalCall (builder : LLVM.Builder llvmctx)
    (f : String)
    (ps : Array Param)
    (ys : Array Arg)
    (retty : IRType)
    (name : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitExternCall
code: def emitExternCall (builder : LLVM.Builder llvmctx)
    (f : FunId)
    (ps : Array Param)
    (extData : ExternAttrData)
    (ys : Array Arg) (retty : IRType)
    (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.getFunIdTy
code: def getFunIdTy (f : FunId) : M llvmctx (LLVM.LLVMType llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.LLVMType llvmctx)

full_name: Lean.IR.EmitLLVM.getOrAddFunIdValue
code: /--
Create a function declaration and return a pointer to the function.
If the function actually takes arguments, then we must have a function pointer in scope.
If the function takes no arguments, then it is a top-level closed term, and its value will
be stored in a global pointer. So, we load from the global pointer. The type of the global is function pointer pointer.
This returns a *function pointer.*
-/
def getOrAddFunIdValue (builder : LLVM.Builder llvmctx) (f : FunId) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitPartialApp
code: def emitPartialApp (builder : LLVM.Builder llvmctx) (z : VarId) (f : FunId) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitApp
code: def emitApp (builder : LLVM.Builder llvmctx) (z : VarId) (f : VarId) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitFullApp
code: def emitFullApp (builder : LLVM.Builder llvmctx)
    (z : VarId) (f : FunId) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitLit
code: def emitLit (builder : LLVM.Builder llvmctx)
    (z : VarId) (t : IRType) (v : LitVal) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanCtorGet
code: def callLeanCtorGet (builder : LLVM.Builder llvmctx)
    (x i : LLVM.Value llvmctx) (retName : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitProj
code: def emitProj (builder : LLVM.Builder llvmctx) (z : VarId) (i : Nat) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanCtorGetUsize
code: def callLeanCtorGetUsize (builder : LLVM.Builder llvmctx)
    (x i : LLVM.Value llvmctx) (retName : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitUProj
code: def emitUProj (builder : LLVM.Builder llvmctx) (z : VarId) (i : Nat) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitOffset
code: def emitOffset (builder : LLVM.Builder llvmctx)
    (n : Nat) (offset : Nat) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitSProj
code: def emitSProj (builder : LLVM.Builder llvmctx)
    (z : VarId) (t : IRType) (n offset : Nat) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanIsExclusive
code: def callLeanIsExclusive (builder : LLVM.Builder llvmctx)
    (closure : LLVM.Value llvmctx) (retName : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanIsScalar
code: def callLeanIsScalar (builder : LLVM.Builder llvmctx)
    (closure : LLVM.Value llvmctx) (retName : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitIsShared
code: def emitIsShared (builder : LLVM.Builder llvmctx) (z : VarId) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitBox
code: def emitBox (builder : LLVM.Builder llvmctx) (z : VarId) (x : VarId) (xType : IRType) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.IRType.isIntegerType
code: def IRType.isIntegerType (t : IRType) : Bool 
goal: Bool

full_name: Lean.IR.EmitLLVM.callUnboxForType
code: def callUnboxForType (builder : LLVM.Builder llvmctx)
    (t : IRType)
    (v : LLVM.Value llvmctx)
    (retName : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitUnbox
code: def emitUnbox (builder : LLVM.Builder llvmctx)
    (z : VarId) (t : IRType) (x : VarId) (retName : String := "") : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitReset
code: def emitReset (builder : LLVM.Builder llvmctx) (z : VarId) (n : Nat) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitReuse
code: def emitReuse (builder : LLVM.Builder llvmctx)
    (z : VarId) (x : VarId) (c : CtorInfo) (updtHeader : Bool) (ys : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitVDecl
code: def emitVDecl (builder : LLVM.Builder llvmctx) (z : VarId) (t : IRType) (v : Expr) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.declareVar
code: def declareVar (builder : LLVM.Builder llvmctx) (x : VarId) (t : IRType) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.declareVars
code: partial def declareVars (builder : LLVM.Builder llvmctx) (f : FnBody) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitTag
code: def emitTag (builder : LLVM.Builder llvmctx) (x : VarId) (xType : IRType) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitSet
code: def emitSet (builder : LLVM.Builder llvmctx) (x : VarId) (i : Nat) (y : Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitUSet
code: def emitUSet (builder : LLVM.Builder llvmctx) (x : VarId) (i : Nat) (y : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitTailCall
code: def emitTailCall (builder : LLVM.Builder llvmctx) (f : FunId) (v : Expr) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitJmp
code: def emitJmp (builder : LLVM.Builder llvmctx) (jp : JoinPointId) (xs : Array Arg) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitSSet
code: def emitSSet (builder : LLVM.Builder llvmctx) (x : VarId) (n : Nat) (offset : Nat) (y : VarId) (t : IRType) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitDel
code: def emitDel (builder : LLVM.Builder llvmctx) (x : VarId) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitSetTag
code: def emitSetTag (builder : LLVM.Builder llvmctx) (x : VarId) (i : Nat) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.ensureHasDefault'
code: def ensureHasDefault' (alts : Array Alt) : Array Alt 
goal: Array Lean.IR.Alt

full_name: Lean.IR.EmitLLVM.emitFnArgs
code: def emitFnArgs (builder : LLVM.Builder llvmctx)
    (needsPackedArgs? : Bool)  (llvmfn : LLVM.Value llvmctx) (params : Array Param) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitDeclAux
code: def emitDeclAux (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) (d : Decl) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitDecl
code: def emitDecl (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) (d : Decl) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.emitFns
code: def emitFns (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callIODeclInitFn
code: def callIODeclInitFn (builder : LLVM.Builder llvmctx)
    (initFnName : String)
    (world : LLVM.Value llvmctx): M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callPureDeclInitFn
code: def callPureDeclInitFn (builder : LLVM.Builder llvmctx)
    (initFnName : String)
    (retty : LLVM.LLVMType llvmctx): M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitDeclInit
code: def emitDeclInit (builder : LLVM.Builder llvmctx)
    (parentFn : LLVM.Value llvmctx) (d : Decl) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callModInitFn
code: def callModInitFn (builder : LLVM.Builder llvmctx)
    (modName : Name) (input world : LLVM.Value llvmctx) (retName : String): M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitInitFn
code: def emitInitFn (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanInitialize
code: def callLeanInitialize (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanInitializeRuntimeModule
code: def callLeanInitializeRuntimeModule (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanSetPanicMessages
code: def callLeanSetPanicMessages (builder : LLVM.Builder llvmctx)
    (enable? : LLVM.Value llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanIOMarkEndInitialization
code: def callLeanIOMarkEndInitialization (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanIOResultIsOk
code: def callLeanIOResultIsOk (builder : LLVM.Builder llvmctx)
    (arg : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanInitTaskManager
code: def callLeanInitTaskManager (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanFinalizeTaskManager
code: def callLeanFinalizeTaskManager (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanUnboxUint32
code: def callLeanUnboxUint32 (builder : LLVM.Builder llvmctx)
    (v : LLVM.Value llvmctx) (name : String := "") : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.callLeanIOResultShowError
code: def callLeanIOResultShowError (builder : LLVM.Builder llvmctx)
    (v : LLVM.Value llvmctx) (name : String := "") : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.callLeanMainFn
code: def callLeanMainFn (builder : LLVM.Builder llvmctx)
    (argv? : Option (LLVM.Value llvmctx))
    (world : LLVM.Value llvmctx)
    (name : String) : M llvmctx (LLVM.Value llvmctx) 
goal: Lean.IR.EmitLLVM.M llvmctx (LLVM.Value llvmctx)

full_name: Lean.IR.EmitLLVM.emitMainFn
code: def emitMainFn (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.hasMainFn
code: def hasMainFn : M llvmctx Bool 
goal: Lean.IR.EmitLLVM.M llvmctx Bool

full_name: Lean.IR.EmitLLVM.emitMainFnIfNeeded
code: def emitMainFnIfNeeded (mod : LLVM.Module llvmctx) (builder : LLVM.Builder llvmctx) : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.EmitLLVM.main
code: def main : M llvmctx Unit 
goal: Lean.IR.EmitLLVM.M llvmctx Unit

full_name: Lean.IR.getLeanHBcPath
code: def getLeanHBcPath : IO System.FilePath 
goal: IO System.FilePath

full_name: Lean.IR.getModuleGlobals
code: /-- Get the names of all global symbols in the module -/
partial def getModuleGlobals (mod : LLVM.Module llvmctx) : IO (Array (LLVM.Value llvmctx)) 
goal: IO (Array (LLVM.Value llvmctx))

full_name: Lean.IR.getModuleGlobals.go
code: /-- Get the names of all global symbols in the module -/
partial def getModuleGlobals (mod : LLVM.Module llvmctx) : IO (Array (LLVM.Value llvmctx)) 
goal: IO (Array (LLVM.Value llvmctx))

full_name: Lean.IR.getModuleFunctions
code: /-- Get the names of all global functions in the module -/
partial def getModuleFunctions (mod : LLVM.Module llvmctx) : IO (Array (LLVM.Value llvmctx)) 
goal: IO (Array (LLVM.Value llvmctx))

full_name: Lean.IR.getModuleFunctions.go
code: /-- Get the names of all global functions in the module -/
partial def getModuleFunctions (mod : LLVM.Module llvmctx) : IO (Array (LLVM.Value llvmctx)) 
goal: IO (Array (LLVM.Value llvmctx))

full_name: Lean.IR.emitLLVM
code: /--
`emitLLVM` is the entrypoint for the lean shell to code generate LLVM.
-/
@[export lean_ir_emit_llvm]
def emitLLVM (env : Environment) (modName : Name) (filepath : String) : IO Unit 
goal: IO Unit