Equations
- Lean.IR.LLVM.size_tType llvmctx = LLVM.i64Type llvmctx
Equations
- Lean.IR.LLVM.unsignedType llvmctx = LLVM.i32Type llvmctx
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.LLVM.getOrAddGlobal m name type = do let __do_lift ← LLVM.getNamedGlobal m name match __do_lift with | some fn => pure fn | none => LLVM.addGlobal m name type
- env : Environment
- modName : Name
- jpMap : JPParamsMap
- mainFn : FunId
- llvmmodule : LLVM.Module llvmctx
- var2val : Std.HashMap VarId (LLVM.LLVMType llvmctx × LLVM.Value llvmctx)
- jp2bb : Std.HashMap JoinPointId (LLVM.BasicBlock llvmctx)
Equations
Equations
- Lean.IR.EmitLLVM.M llvmctx = StateRefT' IO.RealWorld (Lean.IR.EmitLLVM.State llvmctx) (ReaderT (Lean.IR.EmitLLVM.Context llvmctx) (ExceptT Lean.IR.EmitLLVM.Error IO))
Instances For
Equations
- Lean.IR.EmitLLVM.instInhabitedM = { default := throw "Error: inhabitant" }
Equations
- Lean.IR.EmitLLVM.addJpTostate jp bb = modify fun (s : Lean.IR.EmitLLVM.State llvmctx) => { var2val := s.var2val, jp2bb := s.jp2bb.insert jp bb }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.constInt8 n = liftM (LLVM.constInt8 llvmctx (UInt64.ofNat n))
Equations
- Lean.IR.EmitLLVM.constInt64 n = liftM (LLVM.constInt64 llvmctx (UInt64.ofNat n))
Equations
- Lean.IR.EmitLLVM.constIntSizeT n = liftM (LLVM.constIntSizeT llvmctx (UInt64.ofNat n))
Equations
- Lean.IR.EmitLLVM.constIntUnsigned n = liftM (LLVM.constIntUnsigned llvmctx (UInt64.ofNat n))
Equations
- Lean.IR.EmitLLVM.getOrCreateFunctionPrototype mod retty name args = do let __do_lift ← liftM (LLVM.functionType retty args) liftM (Lean.IR.LLVM.getOrAddFunction mod name __do_lift)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
- inc : RefcountKind
- dec : RefcountKind
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.float = liftM (LLVM.doubleTypeInContext llvmctx)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.float32 = liftM (LLVM.floatTypeInContext llvmctx)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.uint8 = liftM (LLVM.intTypeInContext llvmctx 8)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.uint16 = liftM (LLVM.intTypeInContext llvmctx 16)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.uint32 = liftM (LLVM.intTypeInContext llvmctx 32)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.uint64 = liftM (LLVM.intTypeInContext llvmctx 64)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.usize = liftM (Lean.IR.LLVM.size_tType llvmctx)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.object = do let __do_lift ← liftM (LLVM.i8Type llvmctx) liftM (LLVM.pointerType __do_lift)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.tobject = do let __do_lift ← liftM (LLVM.i8Type llvmctx) liftM (LLVM.pointerType __do_lift)
- Lean.IR.EmitLLVM.toLLVMType Lean.IR.IRType.irrelevant = do let __do_lift ← liftM (LLVM.i8Type llvmctx) liftM (LLVM.pointerType __do_lift)
- Lean.IR.EmitLLVM.toLLVMType (Lean.IR.IRType.struct leanTypeName types) = panicWithPosWithDecl "Lean.Compiler.IR.EmitLLVM" "Lean.IR.EmitLLVM.toLLVMType" 327 25 "not implemented yet"
- Lean.IR.EmitLLVM.toLLVMType (Lean.IR.IRType.union leanTypeName types) = panicWithPosWithDecl "Lean.Compiler.IR.EmitLLVM" "Lean.IR.EmitLLVM.toLLVMType" 328 25 "not implemented yet"
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
LLVM Control flow Utilities #
Equations
- Lean.IR.EmitLLVM.builderGetInsertionFn builder = do let builderBB ← liftM (LLVM.getInsertBlock builder) liftM (LLVM.getBasicBlockParent builderBB)
Equations
- Lean.IR.EmitLLVM.builderAppendBasicBlock builder name = do let fn ← Lean.IR.EmitLLVM.builderGetInsertionFn builder liftM (LLVM.appendBasicBlockInContext llvmctx fn name)
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.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.buildLeanBoolTrue? builder b name = do let __do_lift ← Lean.IR.EmitLLVM.constInt8 0 liftM (LLVM.buildICmp builder LLVM.IntPredicate.NE b __do_lift name)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.emitLhsVal builder x name = do let __discr ← Lean.IR.EmitLLVM.emitLhsSlot_ x match __discr with | (xty, xslot) => liftM (LLVM.buildLoad2 builder xty xslot name)
Equations
- Lean.IR.EmitLLVM.emitLhsSlotStore builder x v = do let __discr ← Lean.IR.EmitLLVM.emitLhsSlot_ x match __discr with | (fst, slot) => liftM (LLVM.buildStore builder v slot)
Equations
- One or more equations did not get rendered due to their size.
- Lean.IR.EmitLLVM.emitArgSlot_ builder (Lean.IR.Arg.var x_2) = Lean.IR.EmitLLVM.emitLhsSlot_ x_2
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.emitAllocCtor builder c = Lean.IR.EmitLLVM.callLeanAllocCtor builder c.cidx c.size (8 * c.usize + c.ssize) "lean_alloc_ctor_out"
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
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.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.IRType.isIntegerType Lean.IR.IRType.uint8 = true
- Lean.IR.EmitLLVM.IRType.isIntegerType Lean.IR.IRType.uint16 = true
- Lean.IR.EmitLLVM.IRType.isIntegerType Lean.IR.IRType.uint32 = true
- Lean.IR.EmitLLVM.IRType.isIntegerType Lean.IR.IRType.uint64 = true
- Lean.IR.EmitLLVM.IRType.isIntegerType Lean.IR.IRType.usize = true
- Lean.IR.EmitLLVM.IRType.isIntegerType t = false
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.ctor c ys) = Lean.IR.EmitLLVM.emitCtor builder z c ys
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.reset n x) = Lean.IR.EmitLLVM.emitReset builder z n x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.reuse x c u ys) = Lean.IR.EmitLLVM.emitReuse builder z x c u ys
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.proj i x) = Lean.IR.EmitLLVM.emitProj builder z i x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.uproj i x) = Lean.IR.EmitLLVM.emitUProj builder z i x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.sproj n o x) = Lean.IR.EmitLLVM.emitSProj builder z t n o x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.fap c ys) = Lean.IR.EmitLLVM.emitFullApp builder z c ys
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.pap c ys) = Lean.IR.EmitLLVM.emitPartialApp builder z c ys
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.ap x ys) = Lean.IR.EmitLLVM.emitApp builder z x ys
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.box t_1 x) = Lean.IR.EmitLLVM.emitBox builder z x t_1
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.unbox x) = Lean.IR.EmitLLVM.emitUnbox builder z t x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.isShared x) = Lean.IR.EmitLLVM.emitIsShared builder z x
- Lean.IR.EmitLLVM.emitVDecl builder z t (Lean.IR.Expr.lit v_2) = do let __discr ← Lean.IR.EmitLLVM.emitLit builder z t v_2 let x : LLVM.Value llvmctx := __discr pure PUnit.unit
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.emitFns mod builder = do let env ← Lean.IR.EmitLLVM.getEnv let decls : List Lean.IR.Decl := Lean.IR.getDecls env decls.reverse.forM (Lean.IR.EmitLLVM.emitDecl mod builder)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.EmitLLVM.hasMainFn = do let env ← Lean.IR.EmitLLVM.getEnv let decls : List Lean.IR.Decl := Lean.IR.getDecls env pure (decls.any fun (d : Lean.IR.Decl) => d.name == `main)
Equations
- Lean.IR.EmitLLVM.emitMainFnIfNeeded mod builder = do let __do_lift ← Lean.IR.EmitLLVM.hasMainFn if __do_lift = true then Lean.IR.EmitLLVM.emitMainFn mod builder else pure PUnit.unit
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.IR.getLeanHBcPath = do let __do_lift ← Lean.getBuildDir let __do_lift ← Lean.getLibDir __do_lift pure (__do_lift / { toString := "lean.h.bc" })
Get the names of all global symbols in the module
Equations
- Lean.IR.getModuleGlobals mod = do let __do_lift ← liftM (LLVM.getFirstGlobal mod) Lean.IR.getModuleGlobals.go __do_lift #[]
Get the names of all global functions in the module
Equations
- Lean.IR.getModuleFunctions mod = do let __do_lift ← liftM (LLVM.getFirstFunction mod) Lean.IR.getModuleFunctions.go __do_lift #[]
emitLLVM
is the entrypoint for the lean shell to code generate LLVM.
Equations
- One or more equations did not get rendered due to their size.