Documentation

Lean.Compiler.IR.LLVMBindings

This file defines bindings for LLVM. The main mechanisms are to:

Instances For
    Instances For
      Instances For
        structure Lean.LLVM.BasicBlock {Context : Sort u_1} (ctx : Context) :
        Instances For
          instance Lean.LLVM.instNonemptyBasicBlock {Context✝ : Sort u_1} {ctx : Context✝} :
          structure Lean.LLVM.Builder {Context : Sort u_1} (ctx : Context) :
          Instances For
            instance Lean.LLVM.instNonemptyBuilder {Context✝ : Sort u_1} {ctx : Context✝} :
            Instances For
              structure Lean.LLVM.LLVMType (ctx : Context) :
              Instances For
                Instances For
                  structure Lean.LLVM.Module (ctx : Context) :
                  Instances For
                    structure Lean.LLVM.Target (ctx : Context) :
                    Instances For
                      Instances For
                        structure Lean.LLVM.Value (ctx : Context) :
                        Instances For
                          def Lean.LLVM.Value.isNull {ctx : Context} (v : Value ctx) :

                          Check if the value is a null pointer. -

                          Equations
                          Instances For
                            @[extern lean_llvm_get_value_name2]
                            opaque Lean.LLVM.Value.getName {ctx : Context} (value : Value ctx) :
                            structure Lean.LLVM.Attribute (ctx : Context) :
                            Instances For
                              @[extern lean_llvm_initialize_target_info]
                              @[extern lean_llvm_create_context]
                              @[extern lean_llvm_create_module]
                              opaque Lean.LLVM.createModule (ctx : Context) (name : String) :
                              @[extern lean_llvm_module_to_string]
                              @[extern lean_llvm_write_bitcode_to_file]
                              opaque Lean.LLVM.writeBitcodeToFile {ctx : Context} (m : Module ctx) (path : String) :
                              @[extern lean_llvm_add_function]
                              opaque Lean.LLVM.addFunction {ctx : Context} (m : Module ctx) (name : String) (type : LLVMType ctx) :
                              @[extern lean_llvm_get_first_function]
                              opaque Lean.LLVM.getFirstFunction {ctx : Context} (m : Module ctx) :
                              @[extern lean_llvm_get_next_function]
                              opaque Lean.LLVM.getNextFunction {ctx : Context} (glbl : Value ctx) :
                              @[extern lean_llvm_get_named_function]
                              opaque Lean.LLVM.getNamedFunction {ctx : Context} (m : Module ctx) (name : String) :
                              @[extern lean_llvm_add_global]
                              opaque Lean.LLVM.addGlobal {ctx : Context} (m : Module ctx) (name : String) (type : LLVMType ctx) :
                              @[extern lean_llvm_get_named_global]
                              opaque Lean.LLVM.getNamedGlobal {ctx : Context} (m : Module ctx) (name : String) :
                              @[extern lean_llvm_get_first_global]
                              opaque Lean.LLVM.getFirstGlobal {ctx : Context} (m : Module ctx) :
                              @[extern lean_llvm_get_next_global]
                              opaque Lean.LLVM.getNextGlobal {ctx : Context} (glbl : Value ctx) :
                              @[extern lean_llvm_build_global_string]
                              opaque Lean.LLVM.buildGlobalString {ctx : Context} (builder : Builder ctx) (value : String) (name : String := "") :
                              @[extern llvm_is_declaration]
                              opaque Lean.LLVM.isDeclaration {ctx : Context} (global : Value ctx) :
                              @[extern lean_llvm_set_initializer]
                              opaque Lean.LLVM.setInitializer {ctx : Context} (glbl val : Value ctx) :
                              @[extern lean_llvm_function_type]
                              opaque Lean.LLVM.functionType {ctx : Context} (retty : LLVMType ctx) (args : Array (LLVMType ctx)) (isVarArg : Bool := false) :
                              @[extern lean_llvm_void_type_in_context]
                              @[extern lean_llvm_int_type_in_context]
                              opaque Lean.LLVM.intTypeInContext (ctx : Context) (width : UInt64) :
                              @[extern lean_llvm_opaque_pointer_type_in_context]
                              opaque Lean.LLVM.opaquePointerTypeInContext (ctx : Context) (addrspace : UInt64 := 0) :
                              @[extern lean_llvm_float_type_in_context]
                              @[extern lean_llvm_double_type_in_context]
                              @[extern lean_llvm_pointer_type]
                              opaque Lean.LLVM.pointerType {ctx : Context} (elemty : LLVMType ctx) :
                              @[extern lean_llvm_array_type]
                              opaque Lean.LLVM.arrayType {ctx : Context} (elemty : LLVMType ctx) (nelem : UInt64) :
                              @[extern lean_llvm_const_array]
                              opaque Lean.LLVM.constArray {ctx : Context} (elemty : LLVMType ctx) (vals : Array (Value ctx)) :
                              @[extern lean_llvm_const_string]
                              opaque Lean.LLVM.constString (ctx : Context) (str : String) :
                              @[extern lean_llvm_const_pointer_null]
                              opaque Lean.LLVM.constPointerNull {ctx : Context} (elemty : LLVMType ctx) :
                              @[extern lean_llvm_get_undef]
                              opaque Lean.LLVM.getUndef {ctx : Context} (elemty : LLVMType ctx) :
                              @[extern lean_llvm_create_builder_in_context]
                              @[extern lean_llvm_append_basic_block_in_context]
                              opaque Lean.LLVM.appendBasicBlockInContext (ctx : Context) (fn : Value ctx) (name : String) :
                              @[extern lean_llvm_count_basic_blocks]
                              @[extern lean_llvm_get_entry_basic_block]
                              @[extern lean_llvm_get_first_instruction]
                              @[extern lean_llvm_position_builder_before]
                              opaque Lean.LLVM.positionBuilderBefore {ctx : Context} (builder : Builder ctx) (instr : Value ctx) :
                              @[extern lean_llvm_position_builder_at_end]
                              opaque Lean.LLVM.positionBuilderAtEnd {Context✝ : Sort u_1} {ctx : Context✝} (builder : Builder ctx) (bb : BasicBlock ctx) :
                              @[extern lean_llvm_build_call2]
                              opaque Lean.LLVM.buildCall2 {ctx : Context} (builder : Builder ctx) (ty : LLVMType ctx) (fn : Value ctx) (args : Array (Value ctx)) (name : String := "") :
                              @[extern lean_llvm_set_tail_call]
                              opaque Lean.LLVM.setTailCall {ctx : Context} (fn : Value ctx) (istail : Bool) :
                              @[extern lean_llvm_build_cond_br]
                              opaque Lean.LLVM.buildCondBr {ctx : Context} (builder : Builder ctx) (if_ : Value ctx) (thenbb elsebb : BasicBlock ctx) :
                              @[extern lean_llvm_build_br]
                              opaque Lean.LLVM.buildBr {ctx : Context} (builder : Builder ctx) (bb : BasicBlock ctx) :
                              @[extern lean_llvm_build_alloca]
                              opaque Lean.LLVM.buildAlloca {ctx : Context} (builder : Builder ctx) (ty : LLVMType ctx) (name : String := "") :
                              @[extern lean_llvm_build_load2]
                              opaque Lean.LLVM.buildLoad2 {ctx : Context} (builder : Builder ctx) (ty : LLVMType ctx) (val : Value ctx) (name : String := "") :
                              @[extern lean_llvm_build_store]
                              opaque Lean.LLVM.buildStore {ctx : Context} (builder : Builder ctx) (val store_loc_ptr : Value ctx) :
                              @[extern lean_llvm_build_ret]
                              opaque Lean.LLVM.buildRet {ctx : Context} (builder : Builder ctx) (val : Value ctx) :
                              @[extern lean_llvm_build_unreachable]
                              opaque Lean.LLVM.buildUnreachable {ctx : Context} (builder : Builder ctx) :
                              @[extern lean_llvm_build_gep2]
                              opaque Lean.LLVM.buildGEP2 {ctx : Context} (builder : Builder ctx) (ty : LLVMType ctx) (base : Value ctx) (ixs : Array (Value ctx)) (name : String := "") :
                              @[extern lean_llvm_build_inbounds_gep2]
                              opaque Lean.LLVM.buildInBoundsGEP2 {ctx : Context} (builder : Builder ctx) (ty : LLVMType ctx) (base : Value ctx) (ixs : Array (Value ctx)) (name : String := "") :
                              @[extern lean_llvm_build_sext]
                              opaque Lean.LLVM.buildSext {ctx : Context} (builder : Builder ctx) (val : Value ctx) (destTy : LLVMType ctx) (name : String := "") :
                              @[extern lean_llvm_build_zext]
                              opaque Lean.LLVM.buildZext {ctx : Context} (builder : Builder ctx) (val : Value ctx) (destTy : LLVMType ctx) (name : String := "") :
                              @[extern lean_llvm_build_sext_or_trunc]
                              opaque Lean.LLVM.buildSextOrTrunc {ctx : Context} (builder : Builder ctx) (val : Value ctx) (destTy : LLVMType ctx) (name : String := "") :
                              @[extern lean_llvm_build_switch]
                              opaque Lean.LLVM.buildSwitch {ctx : Context} (builder : Builder ctx) (val : Value ctx) (elseBB : BasicBlock ctx) (numCasesHint : UInt64) :
                              @[extern lean_llvm_build_ptr_to_int]
                              opaque Lean.LLVM.buildPtrToInt {ctx : Context} (builder : Builder ctx) (ptr : Value ctx) (destTy : LLVMType ctx) (name : String := "") :
                              @[extern lean_llvm_build_mul]
                              opaque Lean.LLVM.buildMul {ctx : Context} (builder : Builder ctx) (x y : Value ctx) (name : String := "") :
                              @[extern lean_llvm_build_add]
                              opaque Lean.LLVM.buildAdd {ctx : Context} (builder : Builder ctx) (x y : Value ctx) (name : String := "") :
                              @[extern lean_llvm_build_sub]
                              opaque Lean.LLVM.buildSub {ctx : Context} (builder : Builder ctx) (x y : Value ctx) (name : String := "") :
                              @[extern lean_llvm_build_not]
                              opaque Lean.LLVM.buildNot {ctx : Context} (builder : Builder ctx) (x : Value ctx) (name : String := "") :
                              @[extern lean_llvm_build_icmp]
                              opaque Lean.LLVM.buildICmp {ctx : Context} (builder : Builder ctx) (predicate : IntPredicate) (x y : Value ctx) (name : String := "") :
                              @[extern lean_llvm_add_case]
                              opaque Lean.LLVM.addCase {ctx : Context} (switch onVal : Value ctx) (destBB : BasicBlock ctx) :
                              @[extern lean_llvm_get_insert_block]
                              opaque Lean.LLVM.getInsertBlock {Context✝ : Sort u_1} {ctx : Context✝} (builder : Builder ctx) :
                              @[extern lean_llvm_clear_insertion_position]
                              opaque Lean.LLVM.clearInsertionPosition {Context✝ : Sort u_1} {ctx : Context✝} (builder : Builder ctx) :
                              @[extern lean_llvm_get_basic_block_parent]
                              @[extern lean_llvm_type_of]
                              opaque Lean.LLVM.typeOf {ctx : Context} (val : Value ctx) :
                              @[extern lean_llvm_const_int]
                              opaque Lean.LLVM.constInt {ctx : Context} (intty : LLVMType ctx) (value : UInt64) (signExtend : Bool := false) :
                              @[extern lean_llvm_print_module_to_string]
                              @[extern lean_llvm_print_module_to_file]
                              opaque Lean.LLVM.printModuletoFile {ctx : Context} (mod : Module ctx) (file : String) :
                              @[extern llvm_count_params]
                              opaque Lean.LLVM.countParams {ctx : Context} (fn : Value ctx) :
                              @[extern llvm_get_param]
                              opaque Lean.LLVM.getParam {ctx : Context} (fn : Value ctx) (ix : UInt64) :
                              @[extern lean_llvm_create_memory_buffer_with_contents_of_file]
                              @[extern lean_llvm_parse_bitcode]
                              opaque Lean.LLVM.parseBitcode (ctx : Context) (membuf : MemoryBuffer ctx) :
                              @[extern lean_llvm_link_modules]
                              opaque Lean.LLVM.linkModules {ctx : Context} (dest src : Module ctx) :
                              @[extern lean_llvm_get_default_target_triple]
                              @[extern lean_llvm_get_target_from_triple]
                              opaque Lean.LLVM.getTargetFromTriple {ctx : Context} (triple : String) :
                              @[extern lean_llvm_create_target_machine]
                              opaque Lean.LLVM.createTargetMachine {ctx : Context} (target : Target ctx) (tripleStr cpu features : String) :
                              @[extern lean_llvm_target_machine_emit_to_file]
                              opaque Lean.LLVM.targetMachineEmitToFile {ctx : Context} (targetMachine : TargetMachine ctx) (module : Module ctx) (filepath : String) (codegenType : CodegenFileType) :
                              @[extern lean_llvm_dispose_target_machine]
                              @[extern lean_llvm_dispose_module]
                              @[extern lean_llvm_verify_module]
                              @[extern lean_llvm_create_string_attribute]
                              opaque Lean.LLVM.createStringAttribute {ctx : Context} (key value : String) :
                              @[extern lean_llvm_add_attribute_at_index]
                              opaque Lean.LLVM.addAttributeAtIndex {ctx : Context} (fn : Value ctx) (idx : AttributeIndex) (attr : Attribute ctx) :
                              Instances For
                                @[extern lean_llvm_set_visibility]
                                opaque Lean.LLVM.setVisibility {ctx : Context} (value : Value ctx) (visibility : Visibility) :
                                Instances For
                                  @[extern lean_llvm_set_dll_storage_class]
                                  opaque Lean.LLVM.setDLLStorageClass {ctx : Context} (value : Value ctx) (dllStorageClass : DLLStorageClass) :
                                  Instances For

                                    Externally visible function

                                    Equations
                                    Instances For

                                      Keep one copy of function when linking (inline)

                                      Equations
                                      Instances For

                                        Same, but only replaced by something equivalent

                                        Equations
                                        Instances For

                                          Keep one copy of function when linking (weak)

                                          Equations
                                          Instances For

                                            Same, but only replaced by something equivalent

                                            Equations
                                            Instances For

                                              Special purpose, only applies to global arrays

                                              Equations
                                              Instances For

                                                Rename collisions when linking (static functions)

                                                Equations
                                                Instances For

                                                  Like Internal, but omit from symbol table

                                                  Equations
                                                  Instances For

                                                    Obsolete

                                                    Equations
                                                    Instances For

                                                      Obsolete

                                                      Equations
                                                      Instances For

                                                        ExternalWeak linkage description

                                                        Equations
                                                        Instances For

                                                          Obsolete

                                                          Equations
                                                          Instances For

                                                            Tentative definitions

                                                            Equations
                                                            Instances For

                                                              Like Private, but linker removes.

                                                              Equations
                                                              Instances For

                                                                Like LinkerPrivate, but is weak.

                                                                Equations
                                                                Instances For
                                                                  @[extern lean_llvm_set_linkage]
                                                                  opaque Lean.LLVM.setLinkage {ctx : Context} (value : Value ctx) (linkage : Linkage) :
                                                                  Equations
                                                                  Instances For
                                                                    Equations
                                                                    Instances For
                                                                      Equations
                                                                      Instances For
                                                                        def Lean.LLVM.constInt' (ctx : Context) (width value : UInt64) (signExtend : Bool := false) :
                                                                        Equations
                                                                        Instances For
                                                                          def Lean.LLVM.constInt1 (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                          Equations
                                                                          Instances For
                                                                            def Lean.LLVM.constInt8 (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                            Equations
                                                                            Instances For
                                                                              def Lean.LLVM.constInt32 (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                              Equations
                                                                              Instances For
                                                                                def Lean.LLVM.constInt64 (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                                Equations
                                                                                Instances For
                                                                                  def Lean.LLVM.constIntSizeT (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                                  Equations
                                                                                  Instances For
                                                                                    def Lean.LLVM.constIntUnsigned (ctx : Context) (value : UInt64) (signExtend : Bool := false) :
                                                                                    Equations
                                                                                    Instances For