This module provides an interface to libLLVMCore, which implements the LLVM intermediate representation as well as other related types and utilities.
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed as base types. Despite the declared types, most of the functions provided operate only on branches of the type hierarchy. The declared parameter names are descriptive and specify which type is required. Additionally, each type hierarchy is documented along with the functions that operate upon it. For more detail, refer to LLVM's C++ code. If in doubt, refer to Core.cpp, which performs parameter downcasts in the form unwrap<RequiredType>(Param).
Many exotic languages can interoperate with C code but have a harder time with C++ due to name mangling. So in addition to C, this interface enables tools written in such languages.
Types
ContextRef = ptr object
- The top-level container for all LLVM global data. See the LLVMContext class.
ModuleRef = ptr object
- The top-level container for all other LLVM Intermediate Representation (IR) objects.
TypeRef = ptr object
- Each value in the LLVM IR has a type, an LLVMTypeRef.
ValueRef = ptr object
- Represents an individual value in LLVM IR.
BasicBlockRef = ptr object
- Represents a basic block of instructions in LLVM IR.
BuilderRef = ptr object
- Represents an LLVM basic block builder
ModuleProviderRef = ptr object
- Interface used to provide a module to JIT or interpreter. This is now just a synonym for llvm::Module, but we have to keep using the different type to keep binary compatibility.
PassManagerRef = ptr object
PassRegistryRef = ptr object
UseRef = ptr object
- Used to get the users and usees of a Value.
DiagnosticInfoRef = ptr object
Attribute = enum ZExtAttribute = 1 shl 0, SExtAttribute = 1 shl 1, NoReturnAttribute = 1 shl 2, InRegAttribute = 1 shl 3, StructRetAttribute = 1 shl 4, NoUnwindAttribute = 1 shl 5, NoAliasAttribute = 1 shl 6, ByValAttribute = 1 shl 7, NestAttribute = 1 shl 8, ReadNoneAttribute = 1 shl 9, ReadOnlyAttribute = 1 shl 10, NoInlineAttribute = 1 shl 11, AlwaysInlineAttribute = 1 shl 12, OptimizeForSizeAttribute = 1 shl 13, StackProtectAttribute = 1 shl 14, StackProtectReqAttribute = 1 shl 15, Alignment = 31 shl 16, NoCaptureAttribute = 1 shl 21, NoRedZoneAttribute = 1 shl 22, NoImplicitFloatAttribute = 1 shl 23, NakedAttribute = 1 shl 24, InlineHintAttribute = 1 shl 25, StackAlignment = 7 shl 26, ReturnsTwice = 1 shl 29, UWTable = 1 shl 30, NonLazyBind = 1 shl 31
Opcode = enum Ret = 1, Br = 2, Switch = 3, IndirectBr = 4, Invoke = 5, Unreachable = 7, Add = 8, FAdd = 9, Sub = 10, FSub = 11, Mul = 12, FMul = 13, UDiv = 14, SDiv = 15, FDiv = 16, URem = 17, SRem = 18, FRem = 19, Shl = 20, LShr = 21, AShr = 22, And = 23, Or = 24, Xor = 25, Alloca = 26, Load = 27, Store = 28, GetElementPtr = 29, Trunc = 30, ZExt = 31, SExt = 32, FPToUI = 33, FPToSI = 34, UIToFP = 35, SIToFP = 36, FPTrunc = 37, FPExt = 38, PtrToInt = 39, IntToPtr = 40, BitCast = 41, ICmp = 42, FCmp = 43, PHI = 44, Call = 45, Select = 46, UserOp1 = 47, UserOp2 = 48, VAArg = 49, ExtractElement = 50, InsertElement = 51, ShuffleVector = 52, ExtractValue = 53, InsertValue = 54, Fence = 55, AtomicCmpXchg = 56, AtomicRMW = 57, Resume = 58, LandingPad = 59, AddrSpaceCast = 60
TypeKind = enum VoidTypeKind, ## type with no size HalfTypeKind, ## 16 bit floating point type FloatTypeKind, ## 32 bit floating point type DoubleTypeKind, ## 64 bit floating point type X86_FP80TypeKind, ## 80 bit floating point type (X87) FP128TypeKind, ## 128 bit floating point type (112-bit mantissa)*/ PPC_FP128TypeKind, ## 128 bit floating point type (two 64-bits) LabelTypeKind, ## Labels IntegerTypeKind, ## Arbitrary bit width integers FunctionTypeKind, ## Functions StructTypeKind, ## Structures ArrayTypeKind, ## Arrays PointerTypeKind, ## Pointers VectorTypeKind, ## SIMD 'packed' format or other vector type MetadataTypeKind, ## Metadata X86_MMXTypeKind ## X86 MMX
- Type kind.
Linkage = enum ExternalLinkage, ## Externally visible function AvailableExternallyLinkage, ## LinkOnceAnyLinkage, ## Keep one copy of function when linking (inline) LinkOnceODRLinkage, ## Same but only replaced by something equivalent. LinkOnceODRAutoHideLinkage, ## Obsolete WeakAnyLinkage, ## Keep one copy of function when linking (weak) WeakODRLinkage, ## Same but only replaced by something equivalent. AppendingLinkage, ## Special purpose only applies to global arrays InternalLinkage, ## Rename collisions when linking (static functions) PrivateLinkage, ## Like Internal but omit from symbol table DLLImportLinkage, ## Obsolete DLLExportLinkage, ## Obsolete ExternalWeakLinkage, ## ExternalWeak linkage description GhostLinkage, ## Obsolete CommonLinkage, ## Tentative definitions LinkerPrivateLinkage, ## Like Private but linker removes. LinkerPrivateWeakLinkage ## Like LinkerPrivate but is weak.
- Linkage.
Visibility = enum DefaultVisibility, ## The GV is visible HiddenVisibility, ## The GV is hidden ProtectedVisibility ## The GV is protected
- Visibility.
DLLStorageClass = enum DefaultStorageClass = 0, ## DLLImportStorageClass = 1, ## Function to be imported from DLL. DLLExportStorageClass = 2 ## Function to be accessible from DLL.
- DLL storage class.
CallConv = enum CCallConv = 0, FastCallConv = 8, ColdCallConv = 9, WebKitJSCallConv = 12, AnyRegCallConv = 13, X86StdcallCallConv = 64, X86FastcallCallConv = 65
IntPredicate = enum IntEQ = 32, ## equal IntNE, ## not equal IntUGT, ## unsigned greater than IntUGE, ## unsigned greater or equal IntULT, ## unsigned less than IntULE, ## unsigned less or equal IntSGT, ## signed greater than IntSGE, ## signed greater or equal IntSLT, ## signed less than IntSLE ## signed less or equal
- Integer predicate.
RealPredicate = enum RealPredicateFalse, ## Always false (always folded) RealOEQ, ## True if ordered and equal RealOGT, ## True if ordered and greater than RealOGE, ## True if ordered and greater than or equal RealOLT, ## True if ordered and less than RealOLE, ## True if ordered and less than or equal RealONE, ## True if ordered and operands are unequal RealORD, ## True if ordered (no nans) RealUNO, ## True if unordered: isnan(X) | isnan(Y) RealUEQ, ## True if unordered or equal RealUGT, ## True if unordered or greater than RealUGE, ## True if unordered greater than or equal RealULT, ## True if unordered or less than RealULE, ## True if unordered less than or equal RealUNE, ## True if unordered or not equal RealPredicateTrue ## Always true (always folded)
- Real predicate.
LandingPadClauseTy = enum LandingPadCatch, ## A catch clause LandingPadFilter ## A filter clause
- Landing pad clause type.
ThreadLocalMode = enum NotThreadLocal = 0, GeneralDynamicTLSModel, LocalDynamicTLSModel, InitialExecTLSModel, LocalExecTLSModel
AtomicOrdering = enum AtomicOrderingNotAtomic = 0, ## A load or store which is not atomic AtomicOrderingUnordered = 1, ## Lowest level of atomicity guarantees ## somewhat sane results lock free. AtomicOrderingMonotonic = 2, ## Guarantees that if you take all the ## operations affecting a specific address ## a consistent ordering exists AtomicOrderingAcquire = 4, ## Acquire provides a barrier of the sort ## necessary to acquire a lock to access other ## memory with normal loads and stores. AtomicOrderingRelease = 5, ## Release is similar to Acquire but with ## a barrier of the sort necessary to ## release a lock. AtomicOrderingAcquireRelease = 6, ## Provides both an Acquire and a Release ## barrier (for fences and operations ## which both read and write memory). AtomicOrderingSequentiallyConsistent = 7 ## Provides Acquire semantics for ## loads and Release semantics for ## stores. Additionally it guarantees ## that a total ordering exists ## between all SequentiallyConsistent ## operations.
- Atomic ordering.
AtomicRMWBinOp = enum AtomicRMWBinOpXchg, ## Set the new value and return the one old AtomicRMWBinOpAdd, ## Add a value and return the old one AtomicRMWBinOpSub, ## Subtract a value and return the old one AtomicRMWBinOpAnd, ## And a value and return the old one AtomicRMWBinOpNand, ## Not-And a value and return the old one AtomicRMWBinOpOr, ## OR a value and return the old one AtomicRMWBinOpXor, ## Xor a value and return the old one AtomicRMWBinOpMax, ## Sets the value if it's greater than the original ## using a signed comparison and return the old one AtomicRMWBinOpMin, ## Sets the value if it's Smaller than the original ## using a signed comparison and return the old one AtomicRMWBinOpUMax, ## Sets the value if it's greater than the original ## using an unsigned comparison and return the old one AtomicRMWBinOpUMin ## Sets the value if it's smaller than the original ## using an unsigned comparison and return the old one
- Atomic R/W binary operation.
DiagnosticSeverity = enum DSError, DSWarning, DSRemark, DSNote
FatalErrorHandler = proc (reason: cstring) {.cdecl.}
DiagnosticHandler = proc (di: DiagnosticInfoRef; p: pointer) {.cdecl.}
YieldCallback = proc (c: ContextRef; p: pointer) {.cdecl.}
Procs
proc initializeCore(r: PassRegistryRef) {.importc: "LLVMInitializeCore", cdecl, dynlib: dllname.}
proc shutdown() {.importc: "LLVMShutdown", cdecl, dynlib: dllname.}
- Deallocate and destroy all ManagedStatic variables.
proc createMessage(message: cstring): cstring {.importc: "LLVMCreateMessage", cdecl, dynlib: dllname.}
proc disposeMessage(message: cstring) {.importc: "LLVMDisposeMessage", cdecl, dynlib: dllname.}
proc installFatalErrorHandler(handler: FatalErrorHandler) {. importc: "LLVMInstallFatalErrorHandler", cdecl, dynlib: dllname.}
- Install a fatal error handler. By default, if LLVM detects a fatal error, it will call exit(1). This may not be appropriate in many contexts. For example, doing exit(1) will bypass many crash reporting/tracing system tools. This function allows you to install a callback that will be invoked prior to the call to exit(1).
proc resetFatalErrorHandler() {.importc: "LLVMResetFatalErrorHandler", cdecl, dynlib: dllname.}
- Reset the fatal error handler. This resets LLVM's fatal error handling behavior to the default.
proc enablePrettyStackTrace() {.importc: "LLVMEnablePrettyStackTrace", cdecl, dynlib: dllname.}
- Enable LLVM's built-in stack trace code. This intercepts the OS's crash signals and prints which component of LLVM you were in at the time if the crash.
proc contextCreate(): ContextRef {.importc: "LLVMContextCreate", cdecl, dynlib: dllname.}
-
Create a new context.
Every call to this function should be paired with a call to LLVMContextDispose() or the context will leak memory.
proc getGlobalContext(): ContextRef {.importc: "LLVMGetGlobalContext", cdecl, dynlib: dllname.}
- Obtain the global context instance.
proc contextSetDiagnosticHandler(c: ContextRef; handler: DiagnosticHandler; diagnosticContext: pointer) {. importc: "LLVMContextSetDiagnosticHandler", cdecl, dynlib: dllname.}
- Set the diagnostic handler for this context.
proc contextSetYieldCallback(c: ContextRef; callback: YieldCallback; opaqueHandle: pointer) {. importc: "LLVMContextSetYieldCallback", cdecl, dynlib: dllname.}
- Set the yield callback function for this context.
proc contextDispose(c: ContextRef) {.importc: "LLVMContextDispose", cdecl, dynlib: dllname.}
-
Destroy a context instance.
This should be called for every call to LLVMContextCreate() or memory will be leaked.
proc getDiagInfoDescription(di: DiagnosticInfoRef): cstring {. importc: "LLVMGetDiagInfoDescription", cdecl, dynlib: dllname.}
- Return a string representation of the DiagnosticInfo. Use LLVMDisposeMessage to free the string.
proc getDiagInfoSeverity(di: DiagnosticInfoRef): DiagnosticSeverity {. importc: "LLVMGetDiagInfoSeverity", cdecl, dynlib: dllname.}
- Return an enum LLVMDiagnosticSeverity.
proc getMDKindIDInContex(c: ContextRef; name: cstring; sLen: cuint): cuint {. importc: "LLVMGetMDKindIDInContext", cdecl, dynlib: dllname.}
proc getMDKindID(name: cstring; sLen: cuint): cuint {. importc: "LLVMGetMDKindID", cdecl, dynlib: dllname.}
proc moduleCreateWithName(moduleID: cstring): ModuleRef {. importc: "LLVMModuleCreateWithName", cdecl, dynlib: dllname.}
-
Create a new, empty module in the global context.
This is equivalent to calling LLVMModuleCreateWithNameInContext with LLVMGetGlobalContext() as the context parameter.
Every invocation should be paired with LLVMDisposeModule() or memory will be leaked.
proc moduleCreateWithNameInContext(moduleID: cstring; c: ContextRef): ModuleRef {. importc: "LLVMModuleCreateWithNameInContext", cdecl, dynlib: dllname.}
-
Create a new, empty module in a specific context.
Every invocation should be paired with LLVMDisposeModule() or memory will be leaked.
proc disposeModule(m: ModuleRef) {.importc: "LLVMDisposeModule", cdecl, dynlib: dllname.}
-
Destroy a module instance.
This must be called for every created module or memory will be leaked.
proc getDataLayout(m: ModuleRef): cstring {.importc: "LLVMGetDataLayout", cdecl, dynlib: dllname.}
- Obtain the data layout for a module.
proc setDataLayout(m: ModuleRef; triple: cstring) {. importc: "LLVMSetDataLayout", cdecl, dynlib: dllname.}
- Set the data layout for a module.
proc getTarget(m: ModuleRef): cstring {.importc: "LLVMGetTarget", cdecl, dynlib: dllname.}
- Obtain the target triple for a module.
proc setTarget(m: ModuleRef; triple: cstring) {.importc: "LLVMSetTarget", cdecl, dynlib: dllname.}
- Set the target triple for a module.
proc dumpModule(m: ModuleRef) {.importc: "LLVMDumpModule", cdecl, dynlib: dllname.}
- Dump a representation of a module to stderr.
proc printModuleToFile(m: ModuleRef; filename: cstring; errorMessage: ptr cstring): Bool {. importc: "LLVMPrintModuleToFile", cdecl, dynlib: dllname.}
- Print a representation of a module to a file. The ErrorMessage needs to be disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
proc printModuleToString(m: ModuleRef): cstring {. importc: "LLVMPrintModuleToString", cdecl, dynlib: dllname.}
- Return a string representation of the module. Use LLVMDisposeMessage to free the string.
proc setModuleInlineAsm(m: ModuleRef; asmStr: cstring) {. importc: "LLVMSetModuleInlineAsm", cdecl, dynlib: dllname.}
- Set inline assembly for a module.
proc getModuleContext(m: ModuleRef): ContextRef {. importc: "LLVMGetModuleContext", cdecl, dynlib: dllname.}
- Obtain the context to which this module is associated.
proc getTypeByName(m: ModuleRef; name: cstring): TypeRef {. importc: "LLVMGetTypeByName", cdecl, dynlib: dllname.}
- Obtain a Type from a module by its registered name.
proc getNamedMetadataNumOperands(m: ModuleRef; name: cstring): cuint {. importc: "LLVMGetNamedMetadataNumOperands", cdecl, dynlib: dllname.}
- Obtain the number of operands for named metadata in a module.
proc getNamedMetadataOperands(m: ModuleRef; name: cstring; dest: ValueRef) {. importc: "LLVMGetNamedMetadataOperands", cdecl, dynlib: dllname.}
-
Obtain the named metadata operands for a module.
The passed LLVMValueRef pointer should refer to an array of LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This array will be populated with the LLVMValueRef instances. Each instance corresponds to a llvm::MDNode.
proc addNamedMetadataOperand(m: ModuleRef; name: cstring; val: ValueRef) {. importc: "LLVMAddNamedMetadataOperand", cdecl, dynlib: dllname.}
- Add an operand to named metadata.
proc addFunction(m: ModuleRef; name: cstring; functionType: TypeRef): ValueRef {. importc: "LLVMAddFunction", cdecl, dynlib: dllname.}
- Add a function to a module under a specified name.
proc getNamedFunction(m: ModuleRef; name: cstring): ValueRef {. importc: "LLVMGetNamedFunction", cdecl, dynlib: dllname.}
-
Obtain a Function value from a Module by its name.
The returned value corresponds to a llvm::Function value.
proc getFirstFunction(m: ModuleRef): ValueRef {.importc: "LLVMGetFirstFunction", cdecl, dynlib: dllname.}
- Obtain an iterator to the first Function in a Module.
proc getLastFunction(m: ModuleRef): ValueRef {.importc: "LLVMGetLastFunction", cdecl, dynlib: dllname.}
- Obtain an iterator to the last Function in a Module.
proc getNextFunction(fn: ValueRef): ValueRef {.importc: "LLVMGetNextFunction", cdecl, dynlib: dllname.}
-
Advance a Function iterator to the next Function.
Returns NULL if the iterator was already at the end and there are no more functions.
proc getPreviousFunction(fn: ValueRef): ValueRef {. importc: "LLVMGetPreviousFunction", cdecl, dynlib: dllname.}
-
Decrement a Function iterator to the previous Function.
Returns NULL if the iterator was already at the beginning and there are no previous functions.
proc getTypeKind(ty: TypeRef): TypeKind {.importc: "LLVMGetTypeKind", cdecl, dynlib: dllname.}
- Obtain the enumerated type of a Type instance.
proc typeIsSized(ty: TypeRef): Bool {.importc: "LLVMTypeIsSized", cdecl, dynlib: dllname.}
-
Whether the type has a known size.
Things that don't have a size are abstract types, labels, and void.a
proc getTypeContext(ty: TypeRef): ContextRef {.importc: "LLVMGetTypeContext", cdecl, dynlib: dllname.}
- Obtain the context to which this type instance is associated.
proc dumpType(val: TypeRef) {.importc: "LLVMDumpType", cdecl, dynlib: dllname.}
- Dump a representation of a type to stderr.
proc printTypeToString(val: TypeRef): cstring {. importc: "LLVMPrintTypeToString", cdecl, dynlib: dllname.}
- Return a string representation of the type. Use LLVMDisposeMessage to free the string.
proc int1TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMInt1TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 1-bit integer type from a context.
proc int8TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMInt8TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 8-bit integer type from a context.
proc int16TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMInt16TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 16-bit integer type from a context.
proc int32TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMInt32TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 32-bit integer type from a context.
proc int64TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMInt64TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 64-bit integer type from a context.
proc intTypeInContext(c: ContextRef; numBits: cuint): TypeRef {. importc: "LLVMIntTypeInContext", cdecl, dynlib: dllname.}
- Obtain an integer type from a context with specified bit width.
proc int1Type(): TypeRef {.importc: "LLVMInt1Type", cdecl, dynlib: dllname.}
- Obtain a 1-bit integer type from the global context.
proc int8Type(): TypeRef {.importc: "LLVMInt8Type", cdecl, dynlib: dllname.}
- Obtain a 8-bit integer type from the global context.
proc int16Type(): TypeRef {.importc: "LLVMInt16Type", cdecl, dynlib: dllname.}
- Obtain a 16-bit integer type from the global context.
proc int32Type(): TypeRef {.importc: "LLVMInt32Type", cdecl, dynlib: dllname.}
- Obtain a 32-bit integer type from the global context.
proc int64Type(): TypeRef {.importc: "LLVMInt64Type", cdecl, dynlib: dllname.}
- Obtain a 64-bit integer type from the global context.
proc intType(numBits: cuint): TypeRef {.importc: "LLVMIntType", cdecl, dynlib: dllname.}
- Obtain an integer type from the global context with a specified bit width.
proc getIntTypeWidth(integerType: TypeRef): cuint {. importc: "LLVMGetIntTypeWidth", cdecl, dynlib: dllname.}
proc halfTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMHalfTypeInContext", cdecl, dynlib: dllname.}
- Obtain a 16-bit floating point type from a context.
proc floatTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMFloatTypeInContext", cdecl, dynlib: dllname.}
- Obtain a 32-bit floating point type from a context.
proc doubleTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMDoubleTypeInContext", cdecl, dynlib: dllname.}
- Obtain a 64-bit floating point type from a context.
proc x86FP80TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMX86FP80TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 80-bit floating point type (X87) from a context.
proc fp128TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMFP128TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 128-bit floating point type (112-bit mantissa) from a context.
proc ppcFP128TypeInContext(c: ContextRef): TypeRef {. importc: "LLVMPPCFP128TypeInContext", cdecl, dynlib: dllname.}
- Obtain a 128-bit floating point type (two 64-bits) from a context.
proc halfType(): TypeRef {.importc: "LLVMHalfType", cdecl, dynlib: dllname.}
- Obtain a 16-bit floating point type from the global context.
proc floatType(): TypeRef {.importc: "LLVMFloatType", cdecl, dynlib: dllname.}
- Obtain a 32-bit floating point type from the global context.
proc doubleType(): TypeRef {.importc: "LLVMDoubleType", cdecl, dynlib: dllname.}
- Obtain a 64-bit floating point type from the global context.
proc x86FP80Type(): TypeRef {.importc: "LLVMX86FP80Type", cdecl, dynlib: dllname.}
- Obtain a 80-bit floating point type from the global context.
proc fp128Type(): TypeRef {.importc: "LLVMFP128Type", cdecl, dynlib: dllname.}
- Obtain a 128-bit floating point type from the global context.
proc ppcFP128Type(): TypeRef {.importc: "LLVMPPCFP128Type", cdecl, dynlib: dllname.}
- Obtain a 128-bit floating point type from the global context.
proc functionType(returnType: TypeRef; paramTypes: ptr TypeRef; paramCount: cuint; isVarArg: Bool): TypeRef {. importc: "LLVMFunctionType", cdecl, dynlib: dllname.}
-
Obtain a function type consisting of a specified signature.
The function is defined as a tuple of a return Type, a list of parameter types, and whether the function is variadic.
proc isFunctionVarArg(functionType: TypeRef): Bool {. importc: "LLVMIsFunctionVarArg", cdecl, dynlib: dllname.}
- Returns whether a function type is variadic.
proc getReturnType(functionType: TypeRef): TypeRef {. importc: "LLVMGetReturnType", cdecl, dynlib: dllname.}
- Obtain the Type this function Type returns.
proc countParamTypes(functionType: TypeRef): cuint {. importc: "LLVMCountParamTypes", cdecl, dynlib: dllname.}
- Obtain the number of parameters this function accepts.
proc getParamTypes(functionType: TypeRef; dest: ptr TypeRef) {. importc: "LLVMGetParamTypes", cdecl, dynlib: dllname.}
-
Obtain the types of a function's parameters.
The Dest parameter should point to a pre-allocated array of LLVMTypeRef at least LLVMCountParamTypes() large. On return, the first LLVMCountParamTypes() entries in the array will be populated with LLVMTypeRef instances.
proc structTypeInContext(c: ContextRef; elementTypes: ptr TypeRef; elementCount: cuint; packed: Bool): TypeRef {. importc: "LLVMStructTypeInContext", cdecl, dynlib: dllname.}
-
Create a new structure type in a context.
A structure is specified by a list of inner elements/types and whether these can be packed together.
proc structType(elementTypes: ptr TypeRef; elementCount: cuint; packed: Bool): TypeRef {. importc: "LLVMStructType", cdecl, dynlib: dllname.}
- Create a new structure type in the global context.
proc structCreateNamed(c: ContextRef; name: cstring): TypeRef {. importc: "LLVMStructCreateNamed", cdecl, dynlib: dllname.}
- Create an empty structure in a context having a specified name.
proc getStructName(ty: TypeRef): cstring {.importc: "LLVMGetStructName", cdecl, dynlib: dllname.}
- Obtain the name of a structure.
proc structSetBody(structType: TypeRef; elementTypes: ptr TypeRef; elementCount: cuint; packed: Bool) {. importc: "LLVMStructSetBody", cdecl, dynlib: dllname.}
- Set the contents of a structure type.
proc countStructElementTypes(structType: TypeRef): cuint {. importc: "LLVMCountStructElementTypes", cdecl, dynlib: dllname.}
- Get the number of elements defined inside the structure.
proc getStructElementTypes(structType: TypeRef; dest: ptr TypeRef) {. importc: "LLVMGetStructElementTypes", cdecl, dynlib: dllname.}
-
Get the elements within a structure.
The function is passed the address of a pre-allocated array of LLVMTypeRef at least LLVMCountStructElementTypes() long. After invocation, this array will be populated with the structure's elements. The objects in the destination array will have a lifetime of the structure type itself, which is the lifetime of the context it is contained in.
proc isPackedStruct(structType: TypeRef): Bool {.importc: "LLVMIsPackedStruct", cdecl, dynlib: dllname.}
- Determine whether a structure is packed.
proc isOpaqueStruct(structType: TypeRef): Bool {.importc: "LLVMIsOpaqueStruct", cdecl, dynlib: dllname.}
- Determine whether a structure is opaque.
proc getElementType(ty: TypeRef): TypeRef {.importc: "LLVMGetElementType", cdecl, dynlib: dllname.}
-
Obtain the type of elements within a sequential type.
This works on array, vector, and pointer types.
proc arrayType(elementType: TypeRef; elementCount: cuint): TypeRef {. importc: "LLVMArrayType", cdecl, dynlib: dllname.}
-
Create a fixed size array type that refers to a specific type.
The created type will exist in the context that its element type exists in.
proc getArrayLength(arrayType: TypeRef): cuint {.importc: "LLVMGetArrayLength", cdecl, dynlib: dllname.}
-
Obtain the length of an array type.
This only works on types that represent arrays.
proc pointerType(elementType: TypeRef; addressSpace: cuint): TypeRef {. importc: "LLVMPointerType", cdecl, dynlib: dllname.}
-
Create a pointer type that points to a defined type.
The created type will exist in the context that its pointee type exists in.
proc getPointerAddressSpace(pointerType: TypeRef): cuint {. importc: "LLVMGetPointerAddressSpace", cdecl, dynlib: dllname.}
-
Obtain the address space of a pointer type.
This only works on types that represent pointers.
proc vectorType(elementType: TypeRef; elementCount: cuint): TypeRef {. importc: "LLVMVectorType", cdecl, dynlib: dllname.}
-
Create a vector type that contains a defined type and has a specific number of elements.
The created type will exist in the context that its element type exists in.
proc getVectorSize(vectorType: TypeRef): cuint {.importc: "LLVMGetVectorSize", cdecl, dynlib: dllname.}
-
Obtain the number of elements in a vector type.
This only works on types that represent vectors.
proc voidTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMVoidTypeInContext", cdecl, dynlib: dllname.}
- Create a void type in a context.
proc labelTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMLabelTypeInContext", cdecl, dynlib: dllname.}
- Create a label type in a context.
proc x86MMXTypeInContext(c: ContextRef): TypeRef {. importc: "LLVMX86MMXTypeInContext", cdecl, dynlib: dllname.}
- Create a X86 MMX type in a context.
proc voidType(): TypeRef {.importc: "LLVMVoidType", cdecl, dynlib: dllname.}
- Create a void type in the global context.
proc labelType(): TypeRef {.importc: "LLVMLabelType", cdecl, dynlib: dllname.}
- Create a label type in the global context.
proc x86MMXType(): TypeRef {.importc: "LLVMX86MMXType", cdecl, dynlib: dllname.}
- Create a X86 MMX type in the global context.
proc isAArgument(val: ValueRef): ValueRef {.importc: "LLVMIsAArgument", cdecl, dynlib: dllname.}
proc isABasicBlock(val: ValueRef): ValueRef {.importc: "LLVMIsABasicBlock", cdecl, dynlib: dllname.}
proc isAInlineAsm(val: ValueRef): ValueRef {.importc: "LLVMIsAInlineAsm", cdecl, dynlib: dllname.}
proc isAMDNode(val: ValueRef): ValueRef {.importc: "LLVMIsAMDNode", cdecl, dynlib: dllname.}
proc isAMDString(val: ValueRef): ValueRef {.importc: "LLVMIsAMDString", cdecl, dynlib: dllname.}
proc isAUser(val: ValueRef): ValueRef {.importc: "LLVMIsAUser", cdecl, dynlib: dllname.}
proc isAConstant(val: ValueRef): ValueRef {.importc: "LLVMIsAConstant", cdecl, dynlib: dllname.}
proc isABlockAddress(val: ValueRef): ValueRef {.importc: "LLVMIsABlockAddress", cdecl, dynlib: dllname.}
proc isAConstantAggregateZero(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantAggregateZero", cdecl, dynlib: dllname.}
proc isAConstantArray(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantArray", cdecl, dynlib: dllname.}
proc isAConstantDataSequential(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantDataSequential", cdecl, dynlib: dllname.}
proc isAConstantDataArray(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantDataArray", cdecl, dynlib: dllname.}
proc isAConstantDataVector(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantDataVector", cdecl, dynlib: dllname.}
proc isAConstantExpr(val: ValueRef): ValueRef {.importc: "LLVMIsAConstantExpr", cdecl, dynlib: dllname.}
proc isAConstantFP(val: ValueRef): ValueRef {.importc: "LLVMIsAConstantFP", cdecl, dynlib: dllname.}
proc isAConstantInt(val: ValueRef): ValueRef {.importc: "LLVMIsAConstantInt", cdecl, dynlib: dllname.}
proc isAConstantPointerNull(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantPointerNull", cdecl, dynlib: dllname.}
proc isAConstantStruct(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantStruct", cdecl, dynlib: dllname.}
proc isAConstantVector(val: ValueRef): ValueRef {. importc: "LLVMIsAConstantVector", cdecl, dynlib: dllname.}
proc isAGlobalValue(val: ValueRef): ValueRef {.importc: "LLVMIsAGlobalValue", cdecl, dynlib: dllname.}
proc isAGlobalAlias(val: ValueRef): ValueRef {.importc: "LLVMIsAGlobalAlias", cdecl, dynlib: dllname.}
proc isAGlobalObject(val: ValueRef): ValueRef {.importc: "LLVMIsAGlobalObject", cdecl, dynlib: dllname.}
proc isAFunction(val: ValueRef): ValueRef {.importc: "LLVMIsAFunction", cdecl, dynlib: dllname.}
proc isAGlobalVariable(val: ValueRef): ValueRef {. importc: "LLVMIsAGlobalVariable", cdecl, dynlib: dllname.}
proc isAUndefValue(val: ValueRef): ValueRef {.importc: "LLVMIsAUndefValue", cdecl, dynlib: dllname.}
proc isAInstruction(val: ValueRef): ValueRef {.importc: "LLVMIsAInstruction", cdecl, dynlib: dllname.}
proc isABinaryOperator(val: ValueRef): ValueRef {. importc: "LLVMIsABinaryOperator", cdecl, dynlib: dllname.}
proc isACallInst(val: ValueRef): ValueRef {.importc: "LLVMIsACallInst", cdecl, dynlib: dllname.}
proc isAAIntrinsicInst(val: ValueRef): ValueRef {. importc: "LLVMIsAIntrinsicInst", cdecl, dynlib: dllname.}
proc isADbgInfoIntrinsic(val: ValueRef): ValueRef {. importc: "LLVMIsADbgInfoIntrinsic", cdecl, dynlib: dllname.}
proc isADbgDeclareInst(val: ValueRef): ValueRef {. importc: "LLVMIsADbgDeclareInst", cdecl, dynlib: dllname.}
proc isAMemIntrinsic(val: ValueRef): ValueRef {.importc: "LLVMIsAMemIntrinsic", cdecl, dynlib: dllname.}
proc isAMemCpyInst(val: ValueRef): ValueRef {.importc: "LLVMIsAMemCpyInst", cdecl, dynlib: dllname.}
proc isAMemMoveInst(val: ValueRef): ValueRef {.importc: "LLVMIsAMemMoveInst", cdecl, dynlib: dllname.}
proc isAMemSetInst(val: ValueRef): ValueRef {.importc: "LLVMIsAMemSetInst", cdecl, dynlib: dllname.}
proc isACmpInst(val: ValueRef): ValueRef {.importc: "LLVMIsACmpInst", cdecl, dynlib: dllname.}
proc isAFCmpInst(val: ValueRef): ValueRef {.importc: "LLVMIsAFCmpInst", cdecl, dynlib: dllname.}
proc isAICmpInst(val: ValueRef): ValueRef {.importc: "LLVMIsAICmpInst", cdecl, dynlib: dllname.}
proc isAExtractElementInst(val: ValueRef): ValueRef {. importc: "LLVMIsAExtractElementInst", cdecl, dynlib: dllname.}
proc isAGetElementPtrInst(val: ValueRef): ValueRef {. importc: "LLVMIsAGetElementPtrInst", cdecl, dynlib: dllname.}
proc isAInsertElementInst(val: ValueRef): ValueRef {. importc: "LLVMIsAInsertElementInst", cdecl, dynlib: dllname.}
proc isAInsertValueInst(val: ValueRef): ValueRef {. importc: "LLVMIsAInsertValueInst", cdecl, dynlib: dllname.}
proc isALandingPadInst(val: ValueRef): ValueRef {. importc: "LLVMIsALandingPadInst", cdecl, dynlib: dllname.}
proc isAPHINode(val: ValueRef): ValueRef {.importc: "LLVMIsAPHINode", cdecl, dynlib: dllname.}
proc isASelectInst(val: ValueRef): ValueRef {.importc: "LLVMIsASelectInst", cdecl, dynlib: dllname.}
proc isAShuffleVectorInst(val: ValueRef): ValueRef {. importc: "LLVMIsAShuffleVectorInst", cdecl, dynlib: dllname.}
proc isAStoreInst(val: ValueRef): ValueRef {.importc: "LLVMIsAStoreInst", cdecl, dynlib: dllname.}
proc isATerminatorInst(val: ValueRef): ValueRef {. importc: "LLVMIsATerminatorInst", cdecl, dynlib: dllname.}
proc isABranchInst(val: ValueRef): ValueRef {.importc: "LLVMIsABranchInst", cdecl, dynlib: dllname.}
proc isAIndirectBrInst(val: ValueRef): ValueRef {. importc: "LLVMIsAIndirectBrInst", cdecl, dynlib: dllname.}
proc isAInvokeInst(val: ValueRef): ValueRef {.importc: "LLVMIsAInvokeInst", cdecl, dynlib: dllname.}
proc isAReturnInst(val: ValueRef): ValueRef {.importc: "LLVMIsAReturnInst", cdecl, dynlib: dllname.}
proc isASwitchInst(val: ValueRef): ValueRef {.importc: "LLVMIsASwitchInst", cdecl, dynlib: dllname.}
proc isAUnreachableInst(val: ValueRef): ValueRef {. importc: "LLVMIsAUnreachableInst", cdecl, dynlib: dllname.}
proc isAResumeInst(val: ValueRef): ValueRef {.importc: "LLVMIsAResumeInst", cdecl, dynlib: dllname.}
proc isAUnaryInstruction(val: ValueRef): ValueRef {. importc: "LLVMIsAUnaryInstruction", cdecl, dynlib: dllname.}
proc isAAllocaInst(val: ValueRef): ValueRef {.importc: "LLVMIsAAllocaInst", cdecl, dynlib: dllname.}
proc isACastInst(val: ValueRef): ValueRef {.importc: "LLVMIsACastInst", cdecl, dynlib: dllname.}
proc isAAddrSpaceCastInst(val: ValueRef): ValueRef {. importc: "LLVMIsAAddrSpaceCastInst", cdecl, dynlib: dllname.}
proc isABitCastInst(val: ValueRef): ValueRef {.importc: "LLVMIsABitCastInst", cdecl, dynlib: dllname.}
proc isAFPExtInst(val: ValueRef): ValueRef {.importc: "LLVMIsAFPExtInst", cdecl, dynlib: dllname.}
proc isAFPToSIInst(val: ValueRef): ValueRef {.importc: "LLVMIsAFPToSIInst", cdecl, dynlib: dllname.}
proc isAFPToUIInst(val: ValueRef): ValueRef {.importc: "LLVMIsAFPToUIInst", cdecl, dynlib: dllname.}
proc isAFPTruncInst(val: ValueRef): ValueRef {.importc: "LLVMIsAFPTruncInst", cdecl, dynlib: dllname.}
proc isAIntToPtrInst(val: ValueRef): ValueRef {.importc: "LLVMIsAIntToPtrInst", cdecl, dynlib: dllname.}
proc isAPtrToIntInst(val: ValueRef): ValueRef {.importc: "LLVMIsAPtrToIntInst", cdecl, dynlib: dllname.}
proc isASExtInst(val: ValueRef): ValueRef {.importc: "LLVMIsASExtInst", cdecl, dynlib: dllname.}
proc isASIToFPInst(val: ValueRef): ValueRef {.importc: "LLVMIsASIToFPInst", cdecl, dynlib: dllname.}
proc isATruncInst(val: ValueRef): ValueRef {.importc: "LLVMIsATruncInst", cdecl, dynlib: dllname.}
proc isAUIToFPInst(val: ValueRef): ValueRef {.importc: "LLVMIsAUIToFPInst", cdecl, dynlib: dllname.}
proc isAZExtInst(val: ValueRef): ValueRef {.importc: "LLVMIsAZExtInst", cdecl, dynlib: dllname.}
proc isAExtractValueInst(val: ValueRef): ValueRef {. importc: "LLVMIsAExtractValueInst", cdecl, dynlib: dllname.}
proc isALoadInst(val: ValueRef): ValueRef {.importc: "LLVMIsALoadInst", cdecl, dynlib: dllname.}
proc isAVAArgInst(val: ValueRef): ValueRef {.importc: "LLVMIsAVAArgInst", cdecl, dynlib: dllname.}
proc typeOf(val: ValueRef): TypeRef {.importc: "LLVMTypeOf", cdecl, dynlib: dllname.}
- Obtain the type of a value.
proc getValueName(val: ValueRef): cstring {.importc: "LLVMGetValueName", cdecl, dynlib: dllname.}
- Obtain the string name of a value.
proc setValueName(val: ValueRef; name: cstring) {.importc: "LLVMSetValueName", cdecl, dynlib: dllname.}
- Set the string name of a value.
proc dumpValue(val: ValueRef) {.importc: "LLVMDumpValue", cdecl, dynlib: dllname.}
- Dump a representation of a value to stderr.
proc printValueToString(val: ValueRef): cstring {. importc: "LLVMPrintValueToString", cdecl, dynlib: dllname.}
- Return a string representation of the value. Use LLVMDisposeMessage to free the string.
proc replaceAllUsesWith(oldVal: ValueRef; newVal: ValueRef) {. importc: "LLVMReplaceAllUsesWith", cdecl, dynlib: dllname.}
- Replace all uses of a value with another one.
proc isConstant(val: ValueRef): Bool {.importc: "LLVMIsConstant", cdecl, dynlib: dllname.}
- Determine whether the specified constant instance is constant.
proc isUndef(val: ValueRef): Bool {.importc: "LLVMIsUndef", cdecl, dynlib: dllname.}
- Determine whether a value instance is undefined.
proc getFirstUse(val: ValueRef): UseRef {.importc: "LLVMGetFirstUse", cdecl, dynlib: dllname.}
-
Obtain the first use of a value.
Uses are obtained in an iterator fashion. First, call this function to obtain a reference to the first use. Then, call LLVMGetNextUse() on that instance and all subsequently obtained instances until LLVMGetNextUse() returns NULL.
proc getNextUse(u: UseRef): UseRef {.importc: "LLVMGetNextUse", cdecl, dynlib: dllname.}
-
Obtain the next use of a value.
This effectively advances the iterator. It returns NULL if you are on the final use and no more are available.
proc getUser(u: UseRef): ValueRef {.importc: "LLVMGetUser", cdecl, dynlib: dllname.}
-
Obtain the user value for a use.
The returned value corresponds to a llvm::User type.
proc getUsedValue(u: UseRef): ValueRef {.importc: "LLVMGetUsedValue", cdecl, dynlib: dllname.}
- Obtain the value this use corresponds to.
proc getOperand(val: ValueRef; index: cuint): ValueRef {. importc: "LLVMGetOperand", cdecl, dynlib: dllname.}
- Obtain an operand at a specific index in a llvm::User value.
proc setOperand(user: ValueRef; index: cuint; val: ValueRef) {. importc: "LLVMSetOperand", cdecl, dynlib: dllname.}
- Set an operand at a specific index in a llvm::User value.
proc getNumOperands(val: ValueRef): cint {.importc: "LLVMGetNumOperands", cdecl, dynlib: dllname.}
- Obtain the number of operands in a llvm::User value.
proc constNull(ty: TypeRef): ValueRef {.importc: "LLVMConstNull", cdecl, dynlib: dllname.}
- Obtain a constant value referring to the null instance of a type.
proc constAllOnes(ty: TypeRef): ValueRef {.importc: "LLVMConstAllOnes", cdecl, dynlib: dllname.}
-
Obtain a constant value referring to the instance of a type consisting of all ones.
This is only valid for integer types.
proc getUndef(ty: TypeRef): ValueRef {.importc: "LLVMGetUndef", cdecl, dynlib: dllname.}
- Obtain a constant value referring to an undefined value of a type.
proc isNull(val: ValueRef): Bool {.importc: "LLVMIsNull", cdecl, dynlib: dllname.}
- Determine whether a value instance is null.
proc constPointerNull(ty: TypeRef): ValueRef {.importc: "LLVMConstPointerNull", cdecl, dynlib: dllname.}
- Obtain a constant that is a constant pointer pointing to NULL for a specified type.
proc constInt(intType: TypeRef; n: culonglong; signExtend: Bool): ValueRef {. importc: "LLVMConstInt", cdecl, dynlib: dllname.}
-
Obtain a constant value for an integer type.
The returned value corresponds to a llvm::ConstantInt.
proc constIntOfArbitraryPrecision(intType: TypeRef; numWords: cuint; words: ptr culonglong): ValueRef {. importc: "LLVMConstIntOfArbitraryPrecision", cdecl, dynlib: dllname.}
- Obtain a constant value for an integer of arbitrary precision.
proc constIntOfString(intType: TypeRef; text: cstring; radix: cuchar): ValueRef {. importc: "LLVMConstIntOfString", cdecl, dynlib: dllname.}
-
Obtain a constant value for an integer parsed from a string.
A similar API, LLVMConstIntOfStringAndSize is also available. If the string's length is available, it is preferred to call that function instead.
proc constIntOfStringAndSize(intType: TypeRef; text: cstring; sLen: cuint; radix: cuchar): ValueRef {. importc: "LLVMConstIntOfStringAndSize", cdecl, dynlib: dllname.}
- Obtain a constant value for an integer parsed from a string with specified length.
proc constReal(realType: TypeRef; n: cdouble): ValueRef {. importc: "LLVMConstReal", cdecl, dynlib: dllname.}
- Obtain a constant value referring to a double floating point value.
proc constRealOfString(realType: TypeRef; text: cstring): ValueRef {. importc: "LLVMConstRealOfString", cdecl, dynlib: dllname.}
-
Obtain a constant for a floating point value parsed from a string.
A similar API, LLVMConstRealOfStringAndSize is also available. It should be used if the input string's length is known.
proc constRealOfStringAndSize(realType: TypeRef; text: cstring; sLen: cuint): ValueRef {. importc: "LLVMConstRealOfStringAndSize", cdecl, dynlib: dllname.}
- Obtain a constant for a floating point value parsed from a string.
proc constIntGetZExtValue(constantVal: ValueRef): culonglong {. importc: "LLVMConstIntGetZExtValue", cdecl, dynlib: dllname.}
- Obtain the zero extended value for an integer constant value.
proc constIntGetSExtValue(constantVal: ValueRef): clonglong {. importc: "LLVMConstIntGetSExtValue", cdecl, dynlib: dllname.}
- Obtain the sign extended value for an integer constant value.
proc constStringInContext(c: ContextRef; str: cstring; length: cuint; dontNullTerminate: Bool): ValueRef {. importc: "LLVMConstStringInContext", cdecl, dynlib: dllname.}
- Create a ConstantDataSequential and initialize it with a string.
proc constString(str: cstring; length: cuint; dontNullTerminate: Bool): ValueRef {. importc: "LLVMConstString", cdecl, dynlib: dllname.}
-
Create a ConstantDataSequential with string content in the global context.
This is the same as LLVMConstStringInContext except it operates on the global context.
proc constStructInContext(c: ContextRef; constantVals: ptr ValueRef; count: cuint; packed: Bool): ValueRef {. importc: "LLVMConstStructInContext", cdecl, dynlib: dllname.}
- Create an anonymous ConstantStruct with the specified values.
proc constStruct(constantVals: ptr ValueRef; count: cuint; packed: Bool): ValueRef {. importc: "LLVMConstStruct", cdecl, dynlib: dllname.}
-
Create a ConstantStruct in the global Context.
This is the same as LLVMConstStructInContext except it operates on the global Context.
proc constArray(elementType: TypeRef; constantVals: ptr ValueRef; length: cuint): ValueRef {. importc: "LLVMConstArray", cdecl, dynlib: dllname.}
- Create a ConstantArray from values.
proc constNamedStruct(structType: TypeRef; constantVals: ptr ValueRef; count: cuint): ValueRef {.importc: "LLVMConstNamedStruct", cdecl, dynlib: dllname.}
- Create a non-anonymous ConstantStruct from values.
proc constVector(scalarConstantVals: ptr ValueRef; size: cuint): ValueRef {. importc: "LLVMConstVector", cdecl, dynlib: dllname.}
- Create a ConstantVector from values.
proc getConstOpcode(constantVal: ValueRef): Opcode {. importc: "LLVMGetConstOpcode", cdecl, dynlib: dllname.}
proc alignOf(ty: TypeRef): ValueRef {.importc: "LLVMAlignOf", cdecl, dynlib: dllname.}
proc sizeOf(ty: TypeRef): ValueRef {.importc: "LLVMSizeOf", cdecl, dynlib: dllname.}
proc constNeg(constantVal: ValueRef): ValueRef {.importc: "LLVMConstNeg", cdecl, dynlib: dllname.}
proc constNSWNeg(constantVal: ValueRef): ValueRef {.importc: "LLVMConstNSWNeg", cdecl, dynlib: dllname.}
proc constNUWNeg(constantVal: ValueRef): ValueRef {.importc: "LLVMConstNUWNeg", cdecl, dynlib: dllname.}
proc constFNeg(constantVal: ValueRef): ValueRef {.importc: "LLVMConstFNeg", cdecl, dynlib: dllname.}
proc constNot(constantVal: ValueRef): ValueRef {.importc: "LLVMConstNot", cdecl, dynlib: dllname.}
proc constAdd(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstAdd", cdecl, dynlib: dllname.}
proc ConstNSWAdd(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNSWAdd", cdecl, dynlib: dllname.}
proc constNUWAdd(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNUWAdd", cdecl, dynlib: dllname.}
proc constFAdd(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstFAdd", cdecl, dynlib: dllname.}
proc constSub(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstSub", cdecl, dynlib: dllname.}
proc constNSWSub(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNSWSub", cdecl, dynlib: dllname.}
proc constNUWSub(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNUWSub", cdecl, dynlib: dllname.}
proc constFSub(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstFSub", cdecl, dynlib: dllname.}
proc constMul(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstMul", cdecl, dynlib: dllname.}
proc constNSWMul(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNSWMul", cdecl, dynlib: dllname.}
proc constNUWMul(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstNUWMul", cdecl, dynlib: dllname.}
proc constFMul(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstFMul", cdecl, dynlib: dllname.}
proc constUDiv(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstUDiv", cdecl, dynlib: dllname.}
proc constSDiv(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstSDiv", cdecl, dynlib: dllname.}
proc constExactSDiv(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstExactSDiv", cdecl, dynlib: dllname.}
proc constFDiv(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstFDiv", cdecl, dynlib: dllname.}
proc constURem(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstURem", cdecl, dynlib: dllname.}
proc constSRem(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstSRem", cdecl, dynlib: dllname.}
proc constFRem(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstFRem", cdecl, dynlib: dllname.}
proc constAnd(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstAnd", cdecl, dynlib: dllname.}
proc constOr(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstOr", cdecl, dynlib: dllname.}
proc constXor(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstXor", cdecl, dynlib: dllname.}
proc constICmp(predicate: IntPredicate; lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {.importc: "LLVMConstICmp", cdecl, dynlib: dllname.}
proc constFCmp(predicate: RealPredicate; lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {.importc: "LLVMConstFCmp", cdecl, dynlib: dllname.}
proc constShl(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstShl", cdecl, dynlib: dllname.}
proc constLShr(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstLShr", cdecl, dynlib: dllname.}
proc constAShr(lhsConstant: ValueRef; rhsConstant: ValueRef): ValueRef {. importc: "LLVMConstAShr", cdecl, dynlib: dllname.}
proc constGEP(constantVal: ValueRef; constantIndices: ptr ValueRef; numIndices: cuint): ValueRef {.importc: "LLVMConstGEP", cdecl, dynlib: dllname.}
proc constInBoundsGEP(constantVal: ValueRef; constantIndices: ptr ValueRef; numIndices: cuint): ValueRef {. importc: "LLVMConstInBoundsGEP", cdecl, dynlib: dllname.}
proc constTrunc(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstTrunc", cdecl, dynlib: dllname.}
proc constSExt(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstSExt", cdecl, dynlib: dllname.}
proc constZExt(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstZExt", cdecl, dynlib: dllname.}
proc constFPTrunc(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstFPTrunc", cdecl, dynlib: dllname.}
proc constFPExt(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstFPExt", cdecl, dynlib: dllname.}
proc constUIToFP(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstUIToFP", cdecl, dynlib: dllname.}
proc constSIToFP(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstSIToFP", cdecl, dynlib: dllname.}
proc constFPToUI(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstFPToUI", cdecl, dynlib: dllname.}
proc constFPToSI(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstFPToSI", cdecl, dynlib: dllname.}
proc constPtrToInt(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstPtrToInt", cdecl, dynlib: dllname.}
proc constIntToPtr(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstIntToPtr", cdecl, dynlib: dllname.}
proc constBitCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstBitCast", cdecl, dynlib: dllname.}
proc constAddrSpaceCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstAddrSpaceCast", cdecl, dynlib: dllname.}
proc constZExtOrBitCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstZExtOrBitCast", cdecl, dynlib: dllname.}
proc constSExtOrBitCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstSExtOrBitCast", cdecl, dynlib: dllname.}
proc constTruncOrBitCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstTruncOrBitCast", cdecl, dynlib: dllname.}
proc constPointerCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstPointerCast", cdecl, dynlib: dllname.}
proc constIntCast(constantVal: ValueRef; toType: TypeRef; isSigned: Bool): ValueRef {. importc: "LLVMConstIntCast", cdecl, dynlib: dllname.}
proc constFPCast(constantVal: ValueRef; toType: TypeRef): ValueRef {. importc: "LLVMConstFPCast", cdecl, dynlib: dllname.}
proc constSelect(constantCondition: ValueRef; constantIfTrue: ValueRef; constantIfFalse: ValueRef): ValueRef {. importc: "LLVMConstSelect", cdecl, dynlib: dllname.}
proc constExtractElement(vectorConstant: ValueRef; indexConstant: ValueRef): ValueRef {. importc: "LLVMConstExtractElement", cdecl, dynlib: dllname.}
proc constInsertElement(vectorConstant: ValueRef; elementValueConstant: ValueRef; indexConstant: ValueRef): ValueRef {. importc: "LLVMConstInsertElement", cdecl, dynlib: dllname.}
proc constShuffleVector(vectorAConstant: ValueRef; vectorBConstant: ValueRef; maskConstant: ValueRef): ValueRef {. importc: "LLVMConstShuffleVector", cdecl, dynlib: dllname.}
proc constExtractValue(aggConstant: ValueRef; idxList: ptr cuint; numIdx: cuint): ValueRef {. importc: "LLVMConstExtractValue", cdecl, dynlib: dllname.}
proc constInsertValue(aggConstant: ValueRef; elementValueConstant: ValueRef; idxList: ptr cuint; numIdx: cuint): ValueRef {. importc: "LLVMConstInsertValue", cdecl, dynlib: dllname.}
proc constInlineAsm(ty: TypeRef; asmString: cstring; constraints: cstring; hasSideEffects: Bool; isAlignStack: Bool): ValueRef {. importc: "LLVMConstInlineAsm", cdecl, dynlib: dllname.}
proc BlockAddress(f: ValueRef; bb: BasicBlockRef): ValueRef {. importc: "LLVMBlockAddress", cdecl, dynlib: dllname.}
proc getGlobalParent(global: ValueRef): ModuleRef {. importc: "LLVMGetGlobalParent", cdecl, dynlib: dllname.}
proc isDeclaration(global: ValueRef): Bool {.importc: "LLVMIsDeclaration", cdecl, dynlib: dllname.}
proc getLinkage(global: ValueRef): Linkage {.importc: "LLVMGetLinkage", cdecl, dynlib: dllname.}
proc setLinkage(global: ValueRef; linkage: Linkage) {.importc: "LLVMSetLinkage", cdecl, dynlib: dllname.}
proc getSection(global: ValueRef): cstring {.importc: "LLVMGetSection", cdecl, dynlib: dllname.}
proc setSection(global: ValueRef; section: cstring) {.importc: "LLVMSetSection", cdecl, dynlib: dllname.}
proc getVisibility(global: ValueRef): Visibility {.importc: "LLVMGetVisibility", cdecl, dynlib: dllname.}
proc setVisibility(global: ValueRef; viz: Visibility) {. importc: "LLVMSetVisibility", cdecl, dynlib: dllname.}
proc getDLLStorageClass(global: ValueRef): DLLStorageClass {. importc: "LLVMGetDLLStorageClass", cdecl, dynlib: dllname.}
proc setDLLStorageClass(global: ValueRef; class: DLLStorageClass) {. importc: "LLVMSetDLLStorageClass", cdecl, dynlib: dllname.}
proc hasUnnamedAddr(global: ValueRef): Bool {.importc: "LLVMHasUnnamedAddr", cdecl, dynlib: dllname.}
proc setUnnamedAddr(global: ValueRef; hasUnnamedAddr: Bool) {. importc: "LLVMSetUnnamedAddr", cdecl, dynlib: dllname.}
proc getAlignment(v: ValueRef): cuint {.importc: "LLVMGetAlignment", cdecl, dynlib: dllname.}
- Obtain the preferred alignment of the value.
proc setAlignment(v: ValueRef; bytes: cuint) {.importc: "LLVMSetAlignment", cdecl, dynlib: dllname.}
- Set the preferred alignment of the value.
proc addGlobal(m: ModuleRef; ty: TypeRef; name: cstring): ValueRef {. importc: "LLVMAddGlobal", cdecl, dynlib: dllname.}
proc addGlobalInAddressSpace(m: ModuleRef; ty: TypeRef; name: cstring; addressSpace: cuint): ValueRef {. importc: "LLVMAddGlobalInAddressSpace", cdecl, dynlib: dllname.}
proc getNamedGlobal(m: ModuleRef; name: cstring): ValueRef {. importc: "LLVMGetNamedGlobal", cdecl, dynlib: dllname.}
proc getFirstGlobal(m: ModuleRef): ValueRef {.importc: "LLVMGetFirstGlobal", cdecl, dynlib: dllname.}
proc getLastGlobal(m: ModuleRef): ValueRef {.importc: "LLVMGetLastGlobal", cdecl, dynlib: dllname.}
proc getNextGlobal(globalVar: ValueRef): ValueRef {. importc: "LLVMGetNextGlobal", cdecl, dynlib: dllname.}
proc getPreviousGlobal(globalVar: ValueRef): ValueRef {. importc: "LLVMGetPreviousGlobal", cdecl, dynlib: dllname.}
proc deleteGlobal(globalVar: ValueRef) {.importc: "LLVMDeleteGlobal", cdecl, dynlib: dllname.}
proc getInitializer(globalVar: ValueRef): ValueRef {. importc: "LLVMGetInitializer", cdecl, dynlib: dllname.}
proc setInitializer(globalVar: ValueRef; constantVal: ValueRef) {. importc: "LLVMSetInitializer", cdecl, dynlib: dllname.}
proc isThreadLocal(globalVar: ValueRef): Bool {.importc: "LLVMIsThreadLocal", cdecl, dynlib: dllname.}
proc setThreadLocal(globalVar: ValueRef; isThreadLocal: Bool) {. importc: "LLVMSetThreadLocal", cdecl, dynlib: dllname.}
proc isGlobalConstant(globalVar: ValueRef): Bool {. importc: "LLVMIsGlobalConstant", cdecl, dynlib: dllname.}
proc setGlobalConstant(globalVar: ValueRef; isConstant: Bool) {. importc: "LLVMSetGlobalConstant", cdecl, dynlib: dllname.}
proc getThreadLocalMode(globalVar: ValueRef): ThreadLocalMode {. importc: "LLVMGetThreadLocalMode", cdecl, dynlib: dllname.}
proc setThreadLocalMode(globalVar: ValueRef; mode: ThreadLocalMode) {. importc: "LLVMSetThreadLocalMode", cdecl, dynlib: dllname.}
proc isExternallyInitialized(globalVar: ValueRef): Bool {. importc: "LLVMIsExternallyInitialized", cdecl, dynlib: dllname.}
proc setExternallyInitialized(globalVar: ValueRef; isExtInit: Bool) {. importc: "LLVMSetExternallyInitialized", cdecl, dynlib: dllname.}
proc addAlias(m: ModuleRef; ty: TypeRef; aliasee: ValueRef; name: cstring): ValueRef {. importc: "LLVMAddAlias", cdecl, dynlib: dllname.}
proc deleteFunction(fn: ValueRef) {.importc: "LLVMDeleteFunction", cdecl, dynlib: dllname.}
- Remove a function from its containing module and deletes it.
proc getIntrinsicID(fn: ValueRef): cuint {.importc: "LLVMGetIntrinsicID", cdecl, dynlib: dllname.}
- Obtain the ID number from a function instance.
proc getFunctionCallConv(fn: ValueRef): cuint {. importc: "LLVMGetFunctionCallConv", cdecl, dynlib: dllname.}
-
Obtain the calling function of a function.
The returned value corresponds to the LLVMCallConv enumeration.
proc setFunctionCallConv(fn: ValueRef; cc: CallConv) {. importc: "LLVMSetFunctionCallConv", cdecl, dynlib: dllname.}
- Set the calling convention of a function.
proc getGC(fn: ValueRef): cstring {.importc: "LLVMGetGC", cdecl, dynlib: dllname.}
- Obtain the name of the garbage collector to use during code generation.
proc setGC(fn: ValueRef; name: cstring) {.importc: "LLVMSetGC", cdecl, dynlib: dllname.}
- Define the garbage collector to use during code generation.
proc addFunctionAttr(fn: ValueRef; pa: Attribute) {. importc: "LLVMAddFunctionAttr", cdecl, dynlib: dllname.}
- Add an attribute to a function.
proc addTargetDependentFunctionAttr(fn: ValueRef; a: cstring; v: cstring) {. importc: "LLVMAddTargetDependentFunctionAttr", cdecl, dynlib: dllname.}
- Add a target-dependent attribute to a fuction
proc getFunctionAttr(fn: ValueRef): Attribute {.importc: "LLVMGetFunctionAttr", cdecl, dynlib: dllname.}
- Obtain an attribute from a function.
proc removeFunctionAttr(fn: ValueRef; pa: Attribute) {. importc: "LLVMRemoveFunctionAttr", cdecl, dynlib: dllname.}
- Remove an attribute from a function.
proc countParams(fn: ValueRef): cuint {.importc: "LLVMCountParams", cdecl, dynlib: dllname.}
- Obtain the number of parameters in a function.
proc getParams(fn: ValueRef; params: ptr ValueRef) {.importc: "LLVMGetParams", cdecl, dynlib: dllname.}
-
Obtain the parameters in a function.
The takes a pointer to a pre-allocated array of LLVMValueRef that is at least LLVMCountParams() long. This array will be filled with LLVMValueRef instances which correspond to the parameters the function receives. Each LLVMValueRef corresponds to a llvm::Argument instance.
proc getParam(fn: ValueRef; index: cuint): ValueRef {.importc: "LLVMGetParam", cdecl, dynlib: dllname.}
-
Obtain the parameter at the specified index.
Parameters are indexed from 0.
proc getParamParent(inst: ValueRef): ValueRef {.importc: "LLVMGetParamParent", cdecl, dynlib: dllname.}
-
Obtain the function to which this argument belongs.
Unlike other functions in this group, this one takes an LLVMValueRef that corresponds to a llvm::Attribute.
The returned LLVMValueRef is the llvm::Function to which this argument belongs.
proc getFirstParam(fn: ValueRef): ValueRef {.importc: "LLVMGetFirstParam", cdecl, dynlib: dllname.}
- Obtain the first parameter to a function.
proc getLastParam(fn: ValueRef): ValueRef {.importc: "LLVMGetLastParam", cdecl, dynlib: dllname.}
- Obtain the last parameter to a function.
proc getNextParam(arg: ValueRef): ValueRef {.importc: "LLVMGetNextParam", cdecl, dynlib: dllname.}
-
Obtain the next parameter to a function.
This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is actually a wrapped iterator) and obtains the next parameter from the underlying iterator.
proc getPreviousParam(arg: ValueRef): ValueRef {. importc: "LLVMGetPreviousParam", cdecl, dynlib: dllname.}
-
Obtain the previous parameter to a function.
This is the opposite of LLVMGetNextParam().
proc addAttribute(arg: ValueRef; pa: Attribute) {.importc: "LLVMAddAttribute", cdecl, dynlib: dllname.}
- Add an attribute to a function argument.
proc removeAttribute(arg: ValueRef; pa: Attribute) {. importc: "LLVMRemoveAttribute", cdecl, dynlib: dllname.}
- Remove an attribute from a function argument.
proc getAttribute(arg: ValueRef): Attribute {.importc: "LLVMGetAttribute", cdecl, dynlib: dllname.}
- Get an attribute from a function argument.
proc setParamAlignment(arg: ValueRef; align: cuint) {. importc: "LLVMSetParamAlignment", cdecl, dynlib: dllname.}
- Set the alignment for a function parameter.
proc mdStringInContext(c: ContextRef; str: cstring; sLen: cuint): ValueRef {. importc: "LLVMMDStringInContext", cdecl, dynlib: dllname.}
-
Obtain a MDString value from a context.
The returned instance corresponds to the llvm::MDString class.
The instance is specified by string data of a specified length. The string content is copied, so the backing memory can be freed after this function returns.
proc mdString(str: cstring; sLen: cuint): ValueRef {.importc: "LLVMMDString", cdecl, dynlib: dllname.}
- Obtain a MDString value from the global context.
proc mdNodeInContext(c: ContextRef; vals: ptr ValueRef; count: cuint): ValueRef {. importc: "LLVMMDNodeInContext", cdecl, dynlib: dllname.}
-
Obtain a MDNode value from a context.
The returned value corresponds to the llvm::MDNode class.
proc mdNode(vals: ptr ValueRef; count: cuint): ValueRef {.importc: "LLVMMDNode", cdecl, dynlib: dllname.}
- Obtain a MDNode value from the global context.
proc getMDString(v: ValueRef; len: ptr cuint): cstring {. importc: "LLVMGetMDString", cdecl, dynlib: dllname.}
- Obtain the underlying string from a MDString value.
proc getMDNodeNumOperands(v: ValueRef): cuint {. importc: "LLVMGetMDNodeNumOperands", cdecl, dynlib: dllname.}
- Obtain the number of operands from an MDNode value.
proc getMDNodeOperands(v: ValueRef; dest: ptr ValueRef) {. importc: "LLVMGetMDNodeOperands", cdecl, dynlib: dllname.}
-
Obtain the given MDNode's operands.
The passed LLVMValueRef pointer should point to enough memory to hold all of the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the MDNode's operands.
proc basicBlockAsValue(bb: BasicBlockRef): ValueRef {. importc: "LLVMBasicBlockAsValue", cdecl, dynlib: dllname.}
- Convert a basic block instance to a value type.
proc valueIsBasicBlock(val: ValueRef): Bool {.importc: "LLVMValueIsBasicBlock", cdecl, dynlib: dllname.}
- Determine whether an LLVMValueRef is itself a basic block.
proc valueAsBasicBlock(val: ValueRef): BasicBlockRef {. importc: "LLVMValueAsBasicBlock", cdecl, dynlib: dllname.}
- Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
proc getBasicBlockParent(bb: BasicBlockRef): ValueRef {. importc: "LLVMGetBasicBlockParent", cdecl, dynlib: dllname.}
- Obtain the function to which a basic block belongs.
proc getBasicBlockTerminator(bb: BasicBlockRef): ValueRef {. importc: "LLVMGetBasicBlockTerminator", cdecl, dynlib: dllname.}
-
Obtain the terminator instruction for a basic block.
If the basic block does not have a terminator (it is not well-formed if it doesn't), then NULL is returned.
The returned LLVMValueRef corresponds to a llvm::TerminatorInst.
proc countBasicBlocks(fn: ValueRef): cuint {.importc: "LLVMCountBasicBlocks", cdecl, dynlib: dllname.}
- Obtain the number of basic blocks in a function.
proc getBasicBlocks(fn: ValueRef; basicBlocks: ptr BasicBlockRef) {. importc: "LLVMGetBasicBlocks", cdecl, dynlib: dllname.}
-
Obtain all of the basic blocks in a function.
This operates on a function value. The BasicBlocks parameter is a pointer to a pre-allocated array of LLVMBasicBlockRef of at least LLVMCountBasicBlocks() in length. This array is populated with LLVMBasicBlockRef instances.
proc getFirstBasicBlock(fn: ValueRef): BasicBlockRef {. importc: "LLVMGetFirstBasicBlock", cdecl, dynlib: dllname.}
-
Obtain the first basic block in a function.
The returned basic block can be used as an iterator. You will likely eventually call into LLVMGetNextBasicBlock() with it.
proc getLastBasicBlock(fn: ValueRef): BasicBlockRef {. importc: "LLVMGetLastBasicBlock", cdecl, dynlib: dllname.}
- Obtain the last basic block in a function.
proc getNextBasicBlock(bb: BasicBlockRef): BasicBlockRef {. importc: "LLVMGetNextBasicBlock", cdecl, dynlib: dllname.}
- Advance a basic block iterator.
proc getPreviousBasicBlock(bb: BasicBlockRef): BasicBlockRef {. importc: "LLVMGetPreviousBasicBlock", cdecl, dynlib: dllname.}
- Go backwards in a basic block iterator.
proc getEntryBasicBlock(fn: ValueRef): BasicBlockRef {. importc: "LLVMGetEntryBasicBlock", cdecl, dynlib: dllname.}
- Obtain the basic block that corresponds to the entry point of a function.
proc appendBasicBlockInContext(c: ContextRef; fn: ValueRef; name: cstring): BasicBlockRef {. importc: "LLVMAppendBasicBlockInContext", cdecl, dynlib: dllname.}
- Append a basic block to the end of a function.
proc appendBasicBlock(fn: ValueRef; name: cstring): BasicBlockRef {. importc: "LLVMAppendBasicBlock", cdecl, dynlib: dllname.}
- Append a basic block to the end of a function using the global context.
proc insertBasicBlockInContext(c: ContextRef; bb: BasicBlockRef; name: cstring): BasicBlockRef {. importc: "LLVMInsertBasicBlockInContext", cdecl, dynlib: dllname.}
-
Insert a basic block in a function before another basic block.
The function to add to is determined by the function of the passed basic block.
proc insertBasicBlock(insertBeforeBB: BasicBlockRef; name: cstring): BasicBlockRef {. importc: "LLVMInsertBasicBlock", cdecl, dynlib: dllname.}
- Insert a basic block in a function using the global context.
proc deleteBasicBlock(bb: BasicBlockRef) {.importc: "LLVMDeleteBasicBlock", cdecl, dynlib: dllname.}
-
Remove a basic block from a function and delete it.
This deletes the basic block from its containing function and deletes the basic block itself.
proc removeBasicBlockFromParent(bb: BasicBlockRef) {. importc: "LLVMRemoveBasicBlockFromParent", cdecl, dynlib: dllname.}
-
Remove a basic block from a function.
This deletes the basic block from its containing function but keep the basic block alive.
proc moveBasicBlockBefore(bb: BasicBlockRef; movePos: BasicBlockRef) {. importc: "LLVMMoveBasicBlockBefore", cdecl, dynlib: dllname.}
- Move a basic block to before another one.
proc moveBasicBlockAfter(bb: BasicBlockRef; movePos: BasicBlockRef) {. importc: "LLVMMoveBasicBlockAfter", cdecl, dynlib: dllname.}
- Move a basic block to after another one.
proc getFirstInstruction(bb: BasicBlockRef): ValueRef {. importc: "LLVMGetFirstInstruction", cdecl, dynlib: dllname.}
-
Obtain the first instruction in a basic block.
The returned LLVMValueRef corresponds to a llvm::Instruction instance.
proc GetLastInstruction(bb: BasicBlockRef): ValueRef {. importc: "LLVMGetLastInstruction", cdecl, dynlib: dllname.}
-
Obtain the last instruction in a basic block.
The returned LLVMValueRef corresponds to an LLVM:Instruction.
proc hasMetadata(val: ValueRef): cint {.importc: "LLVMHasMetadata", cdecl, dynlib: dllname.}
- Determine whether an instruction has any metadata attached.
proc getMetadata(val: ValueRef; kindID: cuint): ValueRef {. importc: "LLVMGetMetadata", cdecl, dynlib: dllname.}
- Return metadata associated with an instruction value.
proc setMetadata(val: ValueRef; kindID: cuint; node: ValueRef) {. importc: "LLVMSetMetadata", cdecl, dynlib: dllname.}
- Set metadata associated with an instruction value.
proc getInstructionParent(inst: ValueRef): BasicBlockRef {. importc: "LLVMGetInstructionParent", cdecl, dynlib: dllname.}
- Obtain the basic block to which an instruction belongs.
proc getNextInstruction(inst: ValueRef): ValueRef {. importc: "LLVMGetNextInstruction", cdecl, dynlib: dllname.}
-
Obtain the instruction that occurs after the one specified.
The next instruction will be from the same basic block.
If this is the last instruction in a basic block, NULL will be returned.
proc getPreviousInstruction(inst: ValueRef): ValueRef {. importc: "LLVMGetPreviousInstruction", cdecl, dynlib: dllname.}
-
Obtain the instruction that occurred before this one.
If the instruction is the first instruction in a basic block, NULL will be returned.
proc instructionEraseFromParent(inst: ValueRef) {. importc: "LLVMInstructionEraseFromParent", cdecl, dynlib: dllname.}
-
Remove and delete an instruction.
The instruction specified is removed from its containing building block and then deleted.
proc getInstructionOpcode(inst: ValueRef): Opcode {. importc: "LLVMGetInstructionOpcode", cdecl, dynlib: dllname.}
- Obtain the code opcode for an individual instruction.
proc getICmpPredicate(inst: ValueRef): IntPredicate {. importc: "LLVMGetICmpPredicate", cdecl, dynlib: dllname.}
-
Obtain the predicate of an instruction.
This is only valid for instructions that correspond to llvm::ICmpInst or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
proc setInstructionCallConv(instr: ValueRef; cc: cuint) {. importc: "LLVMSetInstructionCallConv", cdecl, dynlib: dllname.}
-
Set the calling convention for a call instruction.
This expects an LLVMValueRef that corresponds to a llvm::CallInst or llvm::InvokeInst.
proc getInstructionCallConv(instr: ValueRef): cuint {. importc: "LLVMGetInstructionCallConv", cdecl, dynlib: dllname.}
-
Obtain the calling convention for a call instruction.
This is the opposite of LLVMSetInstructionCallConv(). Reads its usage.
proc addInstrAttribute(instr: ValueRef; index: cuint; attr: Attribute) {. importc: "LLVMAddInstrAttribute", cdecl, dynlib: dllname.}
proc removeInstrAttribute(instr: ValueRef; index: cuint; attr: Attribute) {. importc: "LLVMRemoveInstrAttribute", cdecl, dynlib: dllname.}
proc setInstrParamAlignment(instr: ValueRef; index: cuint; align: cuint) {. importc: "LLVMSetInstrParamAlignment", cdecl, dynlib: dllname.}
proc isTailCall(callInst: ValueRef): Bool {.importc: "LLVMIsTailCall", cdecl, dynlib: dllname.}
-
Obtain whether a call instruction is a tail call.
This only works on llvm::CallInst instructions.
proc setTailCall(callInst: ValueRef; isTailCall: Bool) {. importc: "LLVMSetTailCall", cdecl, dynlib: dllname.}
-
Set whether a call instruction is a tail call.
This only works on llvm::CallInst instructions.
proc getSwitchDefaultDest(SwitchInstr: ValueRef): BasicBlockRef {. importc: "LLVMGetSwitchDefaultDest", cdecl, dynlib: dllname.}
-
Obtain the default destination basic block of a switch instruction.
This only works on llvm::SwitchInst instructions.
proc addIncoming(phiNode: ValueRef; incomingValues: ptr ValueRef; incomingBlocks: ptr BasicBlockRef; count: cuint) {. importc: "LLVMAddIncoming", cdecl, dynlib: dllname.}
- Add an incoming value to the end of a PHI list.
proc countIncoming(phiNode: ValueRef): cuint {.importc: "LLVMCountIncoming", cdecl, dynlib: dllname.}
- Obtain the number of incoming basic blocks to a PHI node.
proc getIncomingValue(phiNode: ValueRef; index: cuint): ValueRef {. importc: "LLVMGetIncomingValue", cdecl, dynlib: dllname.}
- Obtain an incoming value to a PHI node as an LLVMValueRef.
proc getIncomingBlock(phiNode: ValueRef; index: cuint): BasicBlockRef {. importc: "LLVMGetIncomingBlock", cdecl, dynlib: dllname.}
- Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
proc createBuilderInContext(c: ContextRef): BuilderRef {. importc: "LLVMCreateBuilderInContext", cdecl, dynlib: dllname.}
proc createBuilder(): BuilderRef {.importc: "LLVMCreateBuilder", cdecl, dynlib: dllname.}
proc positionBuilder(builder: BuilderRef; bb: BasicBlockRef; instr: ValueRef) {. importc: "LLVMPositionBuilder", cdecl, dynlib: dllname.}
proc positionBuilderBefore(builder: BuilderRef; instr: ValueRef) {. importc: "LLVMPositionBuilderBefore", cdecl, dynlib: dllname.}
proc positionBuilderAtEnd(builder: BuilderRef; bb: BasicBlockRef) {. importc: "LLVMPositionBuilderAtEnd", cdecl, dynlib: dllname.}
proc getInsertBlock(builder: BuilderRef): BasicBlockRef {. importc: "LLVMGetInsertBlock", cdecl, dynlib: dllname.}
proc clearInsertionPosition(builder: BuilderRef) {. importc: "LLVMClearInsertionPosition", cdecl, dynlib: dllname.}
proc insertIntoBuilder(builder: BuilderRef; instr: ValueRef) {. importc: "LLVMInsertIntoBuilder", cdecl, dynlib: dllname.}
proc insertIntoBuilderWithName(builder: BuilderRef; instr: ValueRef; name: cstring) {. importc: "LLVMInsertIntoBuilderWithName", cdecl, dynlib: dllname.}
proc disposeBuilder(builder: BuilderRef) {.importc: "LLVMDisposeBuilder", cdecl, dynlib: dllname.}
proc setCurrentDebugLocation(builder: BuilderRef; location: ValueRef) {. importc: "LLVMSetCurrentDebugLocation", cdecl, dynlib: dllname.}
proc getCurrentDebugLocation(builder: BuilderRef): ValueRef {. importc: "LLVMGetCurrentDebugLocation", cdecl, dynlib: dllname.}
proc setInstDebugLocation(builder: BuilderRef; inst: ValueRef) {. importc: "LLVMSetInstDebugLocation", cdecl, dynlib: dllname.}
proc buildRetVoid(builder: BuilderRef): ValueRef {.importc: "LLVMBuildRetVoid", cdecl, dynlib: dllname.}
proc buildRet(builder: BuilderRef; v: ValueRef): ValueRef {. importc: "LLVMBuildRet", cdecl, dynlib: dllname.}
proc buildAggregateRet(builder: BuilderRef; retVals: ptr ValueRef; n: cuint): ValueRef {. importc: "LLVMBuildAggregateRet", cdecl, dynlib: dllname.}
proc buildBr(builder: BuilderRef; dest: BasicBlockRef): ValueRef {. importc: "LLVMBuildBr", cdecl, dynlib: dllname.}
proc buildCondBr(builder: BuilderRef; ifCond: ValueRef; then: BasicBlockRef; elseBranch: BasicBlockRef): ValueRef {. importc: "LLVMBuildCondBr", cdecl, dynlib: dllname.}
proc buildSwitch(builder: BuilderRef; v: ValueRef; elseBranch: BasicBlockRef; numCases: cuint): ValueRef {.importc: "LLVMBuildSwitch", cdecl, dynlib: dllname.}
proc buildIndirectBr(builder: BuilderRef; address: ValueRef; numDests: cuint): ValueRef {. importc: "LLVMBuildIndirectBr", cdecl, dynlib: dllname.}
proc buildInvoke(builder: BuilderRef; fn: ValueRef; args: ptr ValueRef; numArgs: cuint; then: BasicBlockRef; catch: BasicBlockRef; name: cstring): ValueRef {.importc: "LLVMBuildInvoke", cdecl, dynlib: dllname.}
proc buildLandingPad(builder: BuilderRef; ty: TypeRef; persFn: ValueRef; numClauses: cuint; name: cstring): ValueRef {. importc: "LLVMBuildLandingPad", cdecl, dynlib: dllname.}
proc buildResume(builder: BuilderRef; exn: ValueRef): ValueRef {. importc: "LLVMBuildResume", cdecl, dynlib: dllname.}
proc buildUnreachable(builder: BuilderRef): ValueRef {. importc: "LLVMBuildUnreachable", cdecl, dynlib: dllname.}
proc addCase(switch: ValueRef; onVal: ValueRef; dest: BasicBlockRef) {. importc: "LLVMAddCase", cdecl, dynlib: dllname.}
- Add a case to the switch instruction
proc addDestination(indirectBr: ValueRef; dest: BasicBlockRef) {. importc: "LLVMAddDestination", cdecl, dynlib: dllname.}
- Add a destination to the indirectbr instruction
proc addClause(landingPad: ValueRef; clauseVal: ValueRef) {. importc: "LLVMAddClause", cdecl, dynlib: dllname.}
- Add a catch or filter clause to the landingpad instruction
proc setCleanup(landingPad: ValueRef; val: Bool) {.importc: "LLVMAddClause", cdecl, dynlib: dllname.}
- Set the 'cleanup' flag in the landingpad instruction
proc buildAdd(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildAdd", cdecl, dynlib: dllname.}
proc buildNSWAdd(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNSWAdd", cdecl, dynlib: dllname.}
proc buildNUWAdd(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNUWAdd", cdecl, dynlib: dllname.}
proc buildFAdd(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFAdd", cdecl, dynlib: dllname.}
proc buildSub(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildSub", cdecl, dynlib: dllname.}
proc buildNSWSub(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNSWSub", cdecl, dynlib: dllname.}
proc buildNUWSub(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNUWSub", cdecl, dynlib: dllname.}
proc buildFSub(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFSub", cdecl, dynlib: dllname.}
proc buildMul(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildMul", cdecl, dynlib: dllname.}
proc buildNSWMul(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNSWMul", cdecl, dynlib: dllname.}
proc buildNUWMul(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildNUWMul", cdecl, dynlib: dllname.}
proc buildFMul(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFMul", cdecl, dynlib: dllname.}
proc buildUDiv(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildUDiv", cdecl, dynlib: dllname.}
proc buildSDiv(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildSDiv", cdecl, dynlib: dllname.}
proc buildExactSDiv(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildExactSDiv", cdecl, dynlib: dllname.}
proc buildFDiv(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFDiv", cdecl, dynlib: dllname.}
proc buildURem(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildURem", cdecl, dynlib: dllname.}
proc buildSRem(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildSRem", cdecl, dynlib: dllname.}
proc buildFRem(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFRem", cdecl, dynlib: dllname.}
proc buildShl(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildShl", cdecl, dynlib: dllname.}
proc buildLShr(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildLShr", cdecl, dynlib: dllname.}
proc buildAShr(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildAShr", cdecl, dynlib: dllname.}
proc buildAnd(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildAnd", cdecl, dynlib: dllname.}
proc buildOr(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildOr", cdecl, dynlib: dllname.}
proc buildXor(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildXor", cdecl, dynlib: dllname.}
proc buildBinOp(builder: BuilderRef; op: Opcode; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildBinOp", cdecl, dynlib: dllname.}
proc buildNeg(builder: BuilderRef; v: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildNeg", cdecl, dynlib: dllname.}
proc buildNSWNeg(builder: BuilderRef; v: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildNSWNeg", cdecl, dynlib: dllname.}
proc buildNUWNeg(builder: BuilderRef; v: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildNUWNeg", cdecl, dynlib: dllname.}
proc buildFNeg(builder: BuilderRef; v: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFNeg", cdecl, dynlib: dllname.}
proc buildNot(builder: BuilderRef; v: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildNot", cdecl, dynlib: dllname.}
proc buildMalloc(builder: BuilderRef; ty: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildMalloc", cdecl, dynlib: dllname.}
proc buildArrayMalloc(builder: BuilderRef; ty: TypeRef; val: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildArrayMalloc", cdecl, dynlib: dllname.}
proc buildAlloca(builder: BuilderRef; ty: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildAlloca", cdecl, dynlib: dllname.}
proc buildArrayAlloca(builder: BuilderRef; ty: TypeRef; val: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildArrayAlloca", cdecl, dynlib: dllname.}
proc buildFree(builder: BuilderRef; pointerVal: ValueRef): ValueRef {. importc: "LLVMBuildFree", cdecl, dynlib: dllname.}
proc buildLoad(builder: BuilderRef; pointerVal: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildLoad", cdecl, dynlib: dllname.}
proc buildStore(builder: BuilderRef; val: ValueRef; address: ValueRef): ValueRef {. importc: "LLVMBuildStore", cdecl, dynlib: dllname.}
proc buildGEP(builder: BuilderRef; pointer: ValueRef; indices: ptr ValueRef; numIndices: cuint; name: cstring): ValueRef {. importc: "LLVMBuildGEP", cdecl, dynlib: dllname.}
proc buildInBoundsGEP(builder: BuilderRef; pointer: ValueRef; indices: ptr ValueRef; numIndices: cuint; name: cstring): ValueRef {. importc: "LLVMBuildInBoundsGEP", cdecl, dynlib: dllname.}
proc buildStructGEP(builder: BuilderRef; pointer: ValueRef; idx: cuint; name: cstring): ValueRef {.importc: "LLVMBuildStructGEP", cdecl, dynlib: dllname.}
proc buildGlobalString(builder: BuilderRef; str: cstring; name: cstring): ValueRef {. importc: "LLVMBuildGlobalString", cdecl, dynlib: dllname.}
proc buildGlobalStringPtr(builder: BuilderRef; str: cstring; name: cstring): ValueRef {. importc: "LLVMBuildGlobalStringPtr", cdecl, dynlib: dllname.}
proc getVolatile(memoryAccessInst: ValueRef): Bool {.importc: "LLVMGetVolatile", cdecl, dynlib: dllname.}
proc setVolatile(memoryAccessInst: ValueRef; isVolatile: Bool) {. importc: "LLVMSetVolatile", cdecl, dynlib: dllname.}
proc buildTrunc(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildTrunc", cdecl, dynlib: dllname.}
proc buildZExt(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildZExt", cdecl, dynlib: dllname.}
proc buildSExt(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildSExt", cdecl, dynlib: dllname.}
proc buildFPToUI(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildFPToUI", cdecl, dynlib: dllname.}
proc buildFPToSI(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildFPToSI", cdecl, dynlib: dllname.}
proc buildUIToFP(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildUIToFP", cdecl, dynlib: dllname.}
proc buildSIToFP(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildSIToFP", cdecl, dynlib: dllname.}
proc buildFPTrunc(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildFPTrunc", cdecl, dynlib: dllname.}
proc buildFPExt(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildFPExt", cdecl, dynlib: dllname.}
proc buildPtrToInt(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildPtrToInt", cdecl, dynlib: dllname.}
proc buildIntToPtr(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildIntToPtr", cdecl, dynlib: dllname.}
proc buildBitCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildBitCast", cdecl, dynlib: dllname.}
proc buildAddrSpaceCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildAddrSpaceCast", cdecl, dynlib: dllname.}
proc buildZExtOrBitCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildZExtOrBitCast", cdecl, dynlib: dllname.}
proc buildSExtOrBitCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildSExtOrBitCast", cdecl, dynlib: dllname.}
proc buildTruncOrBitCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildTruncOrBitCast", cdecl, dynlib: dllname.}
proc buildCast(builder: BuilderRef; op: Opcode; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildCast", cdecl, dynlib: dllname.}
proc buildPointerCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildPointerCast", cdecl, dynlib: dllname.}
proc buildIntCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildIntCast", cdecl, dynlib: dllname.}
proc buildFPCast(builder: BuilderRef; val: ValueRef; destTy: TypeRef; name: cstring): ValueRef {.importc: "LLVMBuildFPCast", cdecl, dynlib: dllname.}
proc buildICmp(builder: BuilderRef; op: IntPredicate; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildICmp", cdecl, dynlib: dllname.}
proc buildFCmp(builder: BuilderRef; op: IntPredicate; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildFCmp", cdecl, dynlib: dllname.}
proc buildPhi(builder: BuilderRef; ty: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildPhi", cdecl, dynlib: dllname.}
proc buildCall(builder: BuilderRef; fn: ValueRef; args: ptr ValueRef; numArgs: cuint; name: cstring): ValueRef {. importc: "LLVMBuildCall", cdecl, dynlib: dllname.}
proc buildSelect(builder: BuilderRef; ifCond: ValueRef; then: ValueRef; elseBranch: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildSelect", cdecl, dynlib: dllname.}
proc buildVAArg(builder: BuilderRef; list: ValueRef; ty: TypeRef; name: cstring): ValueRef {. importc: "LLVMBuildVAArg", cdecl, dynlib: dllname.}
proc buildExtractElement(builder: BuilderRef; vecVal: ValueRef; index: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildExtractElement", cdecl, dynlib: dllname.}
proc buildInsertElement(builder: BuilderRef; vecVal: ValueRef; eltVal: ValueRef; index: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildInsertElement", cdecl, dynlib: dllname.}
proc buildShuffleVector(builder: BuilderRef; v1: ValueRef; v2: ValueRef; mask: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildShuffleVector", cdecl, dynlib: dllname.}
proc buildExtractValue(builder: BuilderRef; aggVal: ValueRef; index: cuint; name: cstring): ValueRef {. importc: "LLVMBuildExtractValue", cdecl, dynlib: dllname.}
proc BuildInsertValue(builder: BuilderRef; aggVal: ValueRef; eltVal: ValueRef; index: cuint; name: cstring): ValueRef {. importc: "LLVMBuildInsertValue", cdecl, dynlib: dllname.}
proc buildIsNull(builder: BuilderRef; val: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildIsNull", cdecl, dynlib: dllname.}
proc buildIsNotNull(builder: BuilderRef; val: ValueRef; name: cstring): ValueRef {. importc: "LLVMBuildIsNotNull", cdecl, dynlib: dllname.}
proc buildPtrDiff(builder: BuilderRef; lhs: ValueRef; rhs: ValueRef; name: cstring): ValueRef {.importc: "LLVMBuildPtrDiff", cdecl, dynlib: dllname.}
proc buildFence(builder: BuilderRef; ordering: AtomicOrdering; singleThread: Bool; name: cstring): ValueRef {. importc: "LLVMBuildFence", cdecl, dynlib: dllname.}
proc buildAtomicRMW(builder: BuilderRef; op: AtomicRMWBinOp; address: ValueRef; val: ValueRef; ordering: AtomicOrdering; singleThread: Bool): ValueRef {. importc: "LLVMBuildAtomicRMW", cdecl, dynlib: dllname.}
proc createModuleProviderForExistingModule(m: ModuleRef): ModuleProviderRef {. importc: "LLVMCreateModuleProviderForExistingModule", cdecl, dynlib: dllname.}
- Changes the type of M so it can be passed to FunctionPassManagers and the JIT. They take ModuleProviders for historical reasons.
proc disposeModuleProvider(m: ModuleProviderRef) {. importc: "LLVMDisposeModuleProvider", cdecl, dynlib: dllname.}
- Destroys the module M.
proc createMemoryBufferWithContentsOfFile(path: cstring; outMemBuf: ptr MemoryBufferRef; outMessage: cstringArray): Bool {. importc: "LLVMCreateMemoryBufferWithContentsOfFile", cdecl, dynlib: dllname.}
proc createMemoryBufferWithSTDIN(outMemBuf: ptr MemoryBufferRef; outMessage: cstringArray): Bool {. importc: "LLVMCreateMemoryBufferWithSTDIN", cdecl, dynlib: dllname.}
proc createMemoryBufferWithMemoryRange(inputData: cstring; inputDataLength: csize; bufferName: cstring; requiresNullTerminator: Bool): MemoryBufferRef {. importc: "LLVMCreateMemoryBufferWithMemoryRange", cdecl, dynlib: dllname.}
proc createMemoryBufferWithMemoryRangeCopy(InputData: cstring; InputDataLength: csize; BufferName: cstring): MemoryBufferRef {. importc: "LLVMCreateMemoryBufferWithMemoryRangeCopy", cdecl, dynlib: dllname.}
proc getBufferStart(memBuf: MemoryBufferRef): cstring {. importc: "LLVMGetBufferStart", cdecl, dynlib: dllname.}
proc getBufferSize(memBuf: MemoryBufferRef): csize {. importc: "LLVMGetBufferSize", cdecl, dynlib: dllname.}
proc disposeMemoryBuffer(memBuf: MemoryBufferRef) {. importc: "LLVMDisposeMemoryBuffer", cdecl, dynlib: dllname.}
proc getGlobalPassRegistry(): PassRegistryRef {. importc: "LLVMGetGlobalPassRegistry", cdecl, dynlib: dllname.}
- Return the global pass registry, for use with initialization functions.
proc createPassManager(): PassManagerRef {.importc: "LLVMCreatePassManager", cdecl, dynlib: dllname.}
- Constructs a new whole-module pass pipeline. This type of pipeline is suitable for link-time optimization and whole-module transformations.
proc createFunctionPassManagerForModule(m: ModuleRef): PassManagerRef {. importc: "LLVMCreateFunctionPassManagerForModule", cdecl, dynlib: dllname.}
- Constructs a new function-by-function pass pipeline over the module provider. It does not take ownership of the module provider. This type of pipeline is suitable for code generation and JIT compilation tasks.
proc createFunctionPassManager(mp: ModuleProviderRef): PassManagerRef {. deprecated, importc: "LLVMCreateFunctionPassManager", cdecl, dynlib: dllname.}
- Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
proc runPassManager(pm: PassManagerRef; m: ModuleRef): Bool {. importc: "LLVMRunPassManager", cdecl, dynlib: dllname.}
- Initializes, executes on the provided module, and finalizes all of the passes scheduled in the pass manager. Returns 1 if any of the passes modified the module, 0 otherwise.
proc initializeFunctionPassManager(fpm: PassManagerRef): Bool {. importc: "LLVMInitializeFunctionPassManager", cdecl, dynlib: dllname.}
- Initializes all of the function passes scheduled in the function pass manager. Returns 1 if any of the passes modified the module, 0 otherwise.
proc runFunctionPassManager(fpm: PassManagerRef; f: ValueRef): Bool {. importc: "LLVMRunFunctionPassManager", cdecl, dynlib: dllname.}
- Executes all of the function passes scheduled in the function pass manager on the provided function. Returns 1 if any of the passes modified the function, false otherwise.
proc finalizeFunctionPassManager(fpm: PassManagerRef): Bool {. importc: "LLVMFinalizeFunctionPassManager", cdecl, dynlib: dllname.}
- Finalizes all of the function passes scheduled in in the function pass manager. Returns 1 if any of the passes modified the module, 0 otherwise.
proc disposePassManager(pm: PassManagerRef) {.importc: "LLVMDisposePassManager", cdecl, dynlib: dllname.}
- Frees the memory of a pass pipeline. For function pipelines, does not free the module provider.
proc startMultithreaded(): Bool {.deprecated, importc: "LLVMStartMultithreaded", cdecl, dynlib: dllname.}
- Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THREADS. This function always returns LLVMIsMultithreaded().
proc stopMultithreaded() {.deprecated, importc: "LLVMStopMultithreaded", cdecl, dynlib: dllname.}
- Deprecated: Multi-threading can only be enabled/disabled with the compile time define LLVM_ENABLE_THREADS.
proc isMultithreaded(): Bool {.importc: "LLVMIsMultithreaded", cdecl, dynlib: dllname.}
- Check whether LLVM is executing in thread-safe mode or not.