LlvmCore API.
This interface provides an OCaml API for the LLVM intermediate representation, the classes in the VMCore library.
These abstract types correlate directly to the LLVMCore classes.
The top-level container for all other LLVM Intermediate Representation (IR) objects. See the llvm::Module class.
Any value in the LLVM IR. Functions, instructions, global variables, constants, and much more are all llvalues. See the llvm::Value class. This type covers a wide range of subclasses.
Used to efficiently handle large buffers of read-only binary data. See the llvm::MemoryBuffer class.
module TypeKind : sig ... endThe kind of an lltype, the result of classify_type ty. See the llvm::Type::TypeID enumeration.
module Linkage : sig ... endThe linkage of a global value, accessed with linkage and set_linkage. See llvm::GlobalValue::LinkageTypes.
module Visibility : sig ... endThe linker visibility of a global value, accessed with visibility and set_visibility. See llvm::GlobalValue::VisibilityTypes.
module DLLStorageClass : sig ... endThe DLL storage class of a global value, accessed with dll_storage_class and set_dll_storage_class. See llvm::GlobalValue::DLLStorageClassTypes.
module CallConv : sig ... endThe following calling convention values may be accessed with function_call_conv and set_function_call_conv. Calling conventions are open-ended.
module AttrRepr : sig ... endThe logical representation of an attribute.
module AttrIndex : sig ... endThe position of an attribute. See LLVMAttributeIndex.
module Icmp : sig ... endThe predicate for an integer comparison (icmp) instruction. See the llvm::ICmpInst::Predicate enumeration.
module Fcmp : sig ... endThe predicate for a floating-point comparison (fcmp) instruction. Ordered means that neither operand is a QNAN while unordered means that either operand may be a QNAN. See the llvm::FCmpInst::Predicate enumeration.
module Opcode : sig ... endThe opcodes for LLVM instructions and constant expressions.
module LandingPadClauseTy : sig ... endThe type of a clause of a landingpad instruction. See llvm::LandingPadInst::ClauseType.
module ThreadLocalMode : sig ... endThe thread local mode of a global value, accessed with thread_local_mode and set_thread_local_mode. See llvm::GlobalVariable::ThreadLocalMode.
module AtomicOrdering : sig ... endThe ordering of an atomic load, store, cmpxchg, atomicrmw or fence instruction. See llvm::AtomicOrdering.
module AtomicRMWBinOp : sig ... endThe opcode of an atomicrmw instruction. See llvm::AtomicRMWInst::BinOp.
module ValueKind : sig ... endThe kind of an llvalue, the result of classify_value v. See the various LLVMIsA* functions.
module DiagnosticSeverity : sig ... endThe kind of Diagnostic, the result of Diagnostic.severity d. See llvm::DiagnosticSeverity.
module ModuleFlagBehavior : sig ... endBefore b and At_end a specify positions from the start of the 'b list of a. llpos is used to specify positions in and for forward iteration through the various value lists maintained by the LLVM IR.
After b and At_start a specify positions from the end of the 'b list of a. llrev_pos is used for reverse iteration through the various value lists maintained by the LLVM IR.
enable_pretty_stacktraces () enables 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 of the crash.
install_fatal_error_handler f installs f as LLVM's fatal error handler. The handler will receive the reason for termination as a string. After the handler has been executed, LLVM calls exit(1).
reset_fatal_error_handler () resets LLVM's fatal error handler.
parse_command_line_options ?overview args parses args using the LLVM command line parser. Note that the only stable thing about this function is its signature; you cannot rely on any particular set of command line arguments being interpreted the same way across LLVM versions.
See the function llvm::cl::ParseCommandLineOptions().
module Diagnostic : sig ... endval set_diagnostic_handler : llcontext -> (Diagnostic.t -> unit) option -> unitset_diagnostic_handler c h set the diagnostic handler of c to h. See the method llvm::LLVMContext::setDiagnosticHandler.
val create_context : unit -> llcontextcreate_context () creates a context for storing the "global" state in LLVM. See the constructor llvm::LLVMContext.
val dispose_context : llcontext -> unitdestroy_context () destroys a context. See the destructor llvm::LLVMContext::~LLVMContext.
val global_context : unit -> llcontextSee the function LLVMGetGlobalContext.
mdkind_id context name returns the MDKind ID that corresponds to the name name in the context context. See the function llvm::LLVMContext::getMDKindID.
UnknownAttribute attr is raised when a enum attribute name name is not recognized by LLVM.
val enum_attr_kind : string -> llattrkindenum_attr_kind name returns the kind of enum attributes named name. May raise UnknownAttribute.
val create_enum_attr : llcontext -> string -> int64 -> llattributecreate_enum_attr context value kind creates an enum attribute with the supplied kind and value in context; if the value is not required (as for the majority of attributes), use 0L. May raise UnknownAttribute. See the constructor llvm::Attribute::get.
val create_string_attr : llcontext -> string -> string -> llattributecreate_string_attr context kind value creates a string attribute with the supplied kind and value in context. See the constructor llvm::Attribute::get.
val attr_of_repr : llcontext -> AttrRepr.t -> llattributeattr_of_repr context repr creates an attribute with the supplied representation repr in context.
val repr_of_attr : llattribute -> AttrRepr.trepr_of_attr attr describes the representation of attribute attr.
create_module context id creates a module with the supplied module ID in the context context. Modules are not garbage collected; it is mandatory to call dispose_module to free memory. See the constructor llvm::Module::Module.
val dispose_module : llmodule -> unitdispose_module m destroys a module m and all of the IR objects it contained. All references to subordinate objects are invalidated; referencing them will invoke undefined behavior. See the destructor llvm::Module::~Module.
val target_triple : llmodule -> stringtarget_triple m is the target specifier for the module m, something like i686-apple-darwin8. See the method llvm::Module::getTargetTriple.
val set_target_triple : string -> llmodule -> unittarget_triple triple m changes the target specifier for the module m to the string triple. See the method llvm::Module::setTargetTriple.
val data_layout : llmodule -> stringdata_layout m is the data layout specifier for the module m, something like e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-...-a0:0:64-f80:128:128. See the method llvm::Module::getDataLayout.
val set_data_layout : string -> llmodule -> unitset_data_layout s m changes the data layout specifier for the module m to the string s. See the method llvm::Module::setDataLayout.
val dump_module : llmodule -> unitdump_module m prints the .ll representation of the module m to standard error. See the method llvm::Module::dump.
val print_module : string -> llmodule -> unitprint_module f m prints the .ll representation of the module m to file f. See the method llvm::Module::print.
val string_of_llmodule : llmodule -> stringstring_of_llmodule m returns the .ll representation of the module m as a string. See the method llvm::Module::print.
val set_module_inline_asm : llmodule -> string -> unitset_module_inline_asm m asm sets the inline assembler for the module. See the method llvm::Module::setModuleInlineAsm.
module_context m returns the context of the specified module. See the method llvm::Module::getContext
val get_module_identifier : llmodule -> stringget_module_identifier m returns the module identifier of the specified module. See the method llvm::Module::getModuleIdentifier
val set_module_identifer : llmodule -> string -> unitset_module_identifier m id sets the module identifier of m to id. See the method llvm::Module::setModuleIdentifier
val get_module_flag : llmodule -> string -> llmetadata optionget_module_flag m k Return the corresponding value if key k appears in the module flags of m, otherwise return None See the method llvm::Module::getModuleFlag
val add_module_flag :
llmodule ->
ModuleFlagBehavior.t ->
string ->
llmetadata ->
unitadd_module_flag m b k v Add a module-level flag b, with key k and value v to the flags metadata of module m. It will create the module-level flags named metadata if it doesn't already exist.
Types
val classify_type : lltype -> TypeKind.tclassify_type ty returns the TypeKind.t corresponding to the type ty. See the method llvm::Type::getTypeID.
val type_is_sized : lltype -> booltype_is_sized ty returns whether the type has a size or not. If it doesn't then it is not safe to call the DataLayout:: methods on it.
type_context ty returns the llcontext corresponding to the type ty. See the method llvm::Type::getContext.
val dump_type : lltype -> unitdump_type ty prints the .ll representation of the type ty to standard error. See the method llvm::Type::dump.
val string_of_lltype : lltype -> stringstring_of_lltype ty returns a string describing the type ty.
i1_type c returns an integer type of bitwidth 1 in the context c. See llvm::Type::Int1Ty.
i8_type c returns an integer type of bitwidth 8 in the context c. See llvm::Type::Int8Ty.
i16_type c returns an integer type of bitwidth 16 in the context c. See llvm::Type::Int16Ty.
i32_type c returns an integer type of bitwidth 32 in the context c. See llvm::Type::Int32Ty.
i64_type c returns an integer type of bitwidth 64 in the context c. See llvm::Type::Int64Ty.
integer_type c n returns an integer type of bitwidth n in the context c. See the method llvm::IntegerType::get.
val integer_bitwidth : lltype -> intinteger_bitwidth c ty returns the number of bits in the integer type ty in the context c. See the method llvm::IntegerType::getBitWidth.
float_type c returns the IEEE 32-bit floating point type in the context c. See llvm::Type::FloatTy.
double_type c returns the IEEE 64-bit floating point type in the context c. See llvm::Type::DoubleTy.
x86fp80_type c returns the x87 80-bit floating point type in the context c. See llvm::Type::X86_FP80Ty.
fp128_type c returns the IEEE 128-bit floating point type in the context c. See llvm::Type::FP128Ty.
ppc_fp128_type c returns the PowerPC 128-bit floating point type in the context c. See llvm::Type::PPC_FP128Ty.
function_type ret_ty param_tys returns the function type returning ret_ty and taking param_tys as parameters. See the method llvm::FunctionType::get.
var_arg_function_type ret_ty param_tys is just like function_type ret_ty param_tys except that it returns the function type which also takes a variable number of arguments. See the method llvm::FunctionType::get.
val is_var_arg : lltype -> boolis_var_arg fty returns true if fty is a varargs function type, false otherwise. See the method llvm::FunctionType::isVarArg.
return_type fty gets the return type of the function type fty. See the method llvm::FunctionType::getReturnType.
param_types fty gets the parameter types of the function type fty. See the method llvm::FunctionType::getParamType.
struct_type context tys returns the structure type in the context context containing in the types in the array tys. See the method llvm::StructType::get.
packed_struct_type context ys returns the packed structure type in the context context containing in the types in the array tys. See the method llvm::StructType::get.
val struct_name : lltype -> string optionstruct_name ty returns the name of the named structure type ty, or None if the structure type is not named
named_struct_type context name returns the named structure type name in the context context. See the method llvm::StructType::get.
struct_set_body ty elts ispacked sets the body of the named struct ty to the elts elements. See the moethd llvm::StructType::setBody.
struct_element_types sty returns the constituent types of the struct type sty. See the method llvm::StructType::getElementType.
val is_packed : lltype -> boolis_packed sty returns true if the structure type sty is packed, false otherwise. See the method llvm::StructType::isPacked.
val is_opaque : lltype -> boolis_opaque sty returns true if the structure type sty is opaque. false otherwise. See the method llvm::StructType::isOpaque.
val is_literal : lltype -> boolis_literal sty returns true if the structure type sty is literal. false otherwise. See the method llvm::StructType::isLiteral.
array_type ty n returns the array type containing n elements of type ty. See the method llvm::ArrayType::get.
pointer_type context returns the pointer type in the default address space (0). See the method llvm::PointerType::getUnqual.
qualified_pointer_type context sp returns the pointer type referencing objects in address space sp. See the method llvm::PointerType::get.
vector_type ty n returns the array type containing n elements of the primitive type ty. See the method llvm::ArrayType::get.
element_type ty returns the element type of the pointer, vector, or array type ty. See the method llvm::SequentialType::get.
val array_length : lltype -> intelement_type aty returns the element count of the array type aty. See the method llvm::ArrayType::getNumElements.
val address_space : lltype -> intaddress_space pty returns the address space qualifier of the pointer type pty. See the method llvm::PointerType::getAddressSpace.
val vector_size : lltype -> intelement_type ty returns the element count of the vector type ty. See the method llvm::VectorType::getNumElements.
void_type c creates a type of a function which does not return any value in the context c. See llvm::Type::VoidTy.
label_type c creates a type of a basic block in the context c. See llvm::Type::LabelTy.
x86_mmx_type c returns the x86 64-bit MMX register type in the context c. See llvm::Type::X86_MMXTy.
type_by_name m name returns the specified type from the current module if it exists. See the method llvm::Module::getTypeByName
type_of v returns the type of the value v. See the method llvm::Value::getType.
val classify_value : llvalue -> ValueKind.tclassify_value v returns the kind of the value v.
val value_name : llvalue -> stringvalue_name v returns the name of the value v. For global values, this is the symbol name. For instructions and basic blocks, it is the SSA register name. It is meaningless for constants. See the method llvm::Value::getName.
val set_value_name : string -> llvalue -> unitset_value_name n v sets the name of the value v to n. See the method llvm::Value::setName.
val dump_value : llvalue -> unitdump_value v prints the .ll representation of the value v to standard error. See the method llvm::Value::dump.
val string_of_llvalue : llvalue -> stringstring_of_llvalue v returns a string describing the value v.
val string_of_lldbgrecord : lldbgrecord -> stringstring_of_lldbgrecord r returns a string describing the DbgRecord r.
replace_all_uses_with old new replaces all uses of the value old with the value new. See the method llvm::Value::replaceAllUsesWith.
use_begin v returns the first position in the use list for the value v. use_begin and use_succ can e used to iterate over the use list in order. See the method llvm::Value::use_begin.
use_succ u returns the use list position succeeding u. See the method llvm::use_value_iterator::operator++.
used_value u returns the usee of the use u. See the method llvm::Use::getUsedValue.
iter_uses f v applies function f to each of the users of the value v in order. Tail recursive.
fold_left_uses f init v is f (... (f init u1) ...) uN where u1,...,uN are the users of the value v. Tail recursive.
fold_right_uses f v init is f u1 (... (f uN init) ...) where u1,...,uN are the users of the value v. Not tail recursive.
operand v i returns the operand at index i for the value v. See the method llvm::User::getOperand.
operand_use v i returns the use of the operand at index i for the value v. See the method llvm::User::getOperandUse.
set_operand v i o sets the operand of the value v at the index i to the value o. See the method llvm::User::setOperand.
val num_operands : llvalue -> intnum_operands v returns the number of operands for the value v. See the method llvm::User::getNumOperands.
val indices : llvalue -> int arrayindices i returns the indices for the ExtractValue or InsertValue instruction i. See the llvm::getIndices methods.
val is_constant : llvalue -> boolis_constant v returns true if the value v is a constant, false otherwise. Similar to llvm::isa<Constant>.
const_null ty returns the constant null (zero) of the type ty. See the method llvm::Constant::getNullValue.
const_all_ones ty returns the constant '-1' of the integer or vector type ty. See the method llvm::Constant::getAllOnesValue.
const_pointer_null ty returns the constant null (zero) pointer of the type ty. See the method llvm::ConstantPointerNull::get.
undef ty returns the undefined value of the type ty. See the method llvm::UndefValue::get.
poison ty returns the poison value of the type ty. See the method llvm::PoisonValue::get.
val is_null : llvalue -> boolis_null v returns true if the value v is the null (zero) value. See the method llvm::Constant::isNullValue.
val is_undef : llvalue -> boolis_undef v returns true if the value v is an undefined value, false otherwise. Similar to llvm::isa<UndefValue>.
val is_poison : llvalue -> boolis_poison v returns true if the value v is a poison value, false otherwise. Similar to llvm::isa<PoisonValue>.
constexpr_opcode v returns an Opcode.t corresponding to constexpr value v, or Opcode.Invalid if v is not a constexpr.
val has_metadata : llvalue -> boolhas_metadata i returns whether or not the instruction i has any metadata attached to it. See the function llvm::Instruction::hasMetadata.
metadata i kind optionally returns the metadata associated with the kind kind in the instruction i See the function llvm::Instruction::getMetadata.
set_metadata i kind md sets the metadata md of kind kind in the instruction i. See the function llvm::Instruction::setMetadata.
clear_metadata i kind clears the metadata of kind kind in the instruction i. See the function llvm::Instruction::setMetadata.
mdstring c s returns the MDString of the string s in the context c. See the method llvm::MDNode::get.
mdnode c elts returns the MDNode containing the values elts in the context c. See the method llvm::MDNode::get.
val get_mdstring : llvalue -> string optionget_mdstring v returns the MDString. See the method llvm::MDString::getString
get_mdnode_operands v returns the operands in the MDNode.
get_named_metadata m name returns all the MDNodes belonging to the named metadata (if any). See the method llvm::NamedMDNode::getOperand.
add_named_metadata_operand m name v adds v as the last operand of metadata named name in module m. If the metadata does not exist, it is created. See the methods llvm::Module::getNamedMetadata() and llvm::MDNode::addOperand().
val value_as_metadata : llvalue -> llmetadataObtain a Metadata as a Value. See the method llvm::ValueAsMetadata::get().
val metadata_as_value : llcontext -> llmetadata -> llvalueObtain a Value as a Metadata. See the method llvm::MetadataAsValue::get().
const_int ty i returns the integer constant of type ty and value i. See the method llvm::ConstantInt::get.
const_of_int64 ty i s returns the integer constant of type ty and value i. s indicates whether the integer is signed or not. See the method llvm::ConstantInt::get.
val int64_of_const : llvalue -> Stdlib.Int64.t optionint64_of_const c returns the int64 value of the c constant integer. None is returned if this is not an integer constant, or bitwidth exceeds 64. See the method llvm::ConstantInt::getSExtValue.
const_int_of_string ty s r returns the integer constant of type ty and value s, with the radix r. See the method llvm::ConstantInt::get.
const_float ty n returns the floating point constant of type ty and value n. See the method llvm::ConstantFP::get.
val float_of_const : llvalue -> float optionfloat_of_const c returns the float value of the c constant float. None is returned if this is not an float constant. See the method llvm::ConstantFP::getDoubleValue.
const_float_of_string ty s returns the floating point constant of type ty and value n. See the method llvm::ConstantFP::get.
const_string c s returns the constant i8 array with the values of the characters in the string s in the context c. The array is not null-terminated (but see const_stringz). This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantArray::get.
const_stringz c s returns the constant i8 array with the values of the characters in the string s and a null terminator in the context c. This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantArray::get.
const_array ty elts returns the constant array of type array_type ty (Array.length elts) and containing the values elts. This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantArray::get.
const_struct context elts returns the structured constant of type struct_type (Array.map type_of elts) and containing the values elts in the context context. This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantStruct::getAnon.
const_named_struct namedty elts returns the structured constant of type namedty (which must be a named structure type) and containing the values elts. This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantStruct::get.
const_packed_struct context elts returns the structured constant of type packed_struct_type (Array.map type_of elts) and containing the values elts in the context context. This value can in turn be used as the initializer for a global variable. See the method llvm::ConstantStruct::get.
const_vector elts returns the vector constant of type vector_type (type_of elts.(0)) (Array.length elts) and containing the values elts. See the method llvm::ConstantVector::get.
val string_of_const : llvalue -> string optionstring_of_const c returns Some str if c is a string constant, or None if this is not a string constant.
aggregate_element c idx returns Some elt where elt is the element of constant aggregate c at the specified index idx, or None if idx is out of range or it's not possible to determine the element. See the method llvm::Constant::getAggregateElement.
align_of ty returns the alignof constant for the type ty. This is equivalent to const_ptrtoint (const_gep (const_null (pointer_type {i8,ty})) (const_int i32_type 0) (const_int i32_type 1)) i32_type, but considerably more readable. See the method llvm::ConstantExpr::getAlignOf.
size_of ty returns the sizeof constant for the type ty. This is equivalent to const_ptrtoint (const_gep (const_null (pointer_type ty)) (const_int i32_type 1)) i64_type, but considerably more readable. See the method llvm::ConstantExpr::getSizeOf.
const_neg c returns the arithmetic negation of the constant c. See the method llvm::ConstantExpr::getNeg.
const_nsw_neg c returns the arithmetic negation of the constant c with no signed wrapping. The result is undefined if the negation overflows. See the method llvm::ConstantExpr::getNSWNeg.
const_nuw_neg c returns the arithmetic negation of the constant c with no unsigned wrapping. The result is undefined if the negation overflows. See the method llvm::ConstantExpr::getNUWNeg.
const_not c returns the bitwise inverse of the constant c. See the method llvm::ConstantExpr::getNot.
const_add c1 c2 returns the constant sum of two constants. See the method llvm::ConstantExpr::getAdd.
const_nsw_add c1 c2 returns the constant sum of two constants with no signed wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWAdd.
const_nuw_add c1 c2 returns the constant sum of two constants with no unsigned wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWAdd.
const_sub c1 c2 returns the constant difference, c1 - c2, of two constants. See the method llvm::ConstantExpr::getSub.
const_nsw_sub c1 c2 returns the constant difference of two constants with no signed wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWSub.
const_nuw_sub c1 c2 returns the constant difference of two constants with no unsigned wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWSub.
const_mul c1 c2 returns the constant product of two constants. See the method llvm::ConstantExpr::getMul.
const_nsw_mul c1 c2 returns the constant product of two constants with no signed wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWMul.
const_nuw_mul c1 c2 returns the constant product of two constants with no unsigned wrapping. The result is undefined if the sum overflows. See the method llvm::ConstantExpr::getNSWMul.
const_xor c1 c2 returns the constant bitwise XOR of two integer constants. See the method llvm::ConstantExpr::getXor.
const_gep srcty pc indices returns the constant getElementPtr of pc with source element type srcty and the constant integers indices from the array indices. See the method llvm::ConstantExpr::getGetElementPtr.
const_in_bounds_gep ty pc indices returns the constant getElementPtr of pc with the constant integers indices from the array indices. See the method llvm::ConstantExpr::getInBoundsGetElementPtr.
const_trunc c ty returns the constant truncation of integer constant c to the smaller integer type ty. See the method llvm::ConstantExpr::getTrunc.
const_ptrtoint c ty returns the constant integer conversion of pointer constant c to integer type ty. See the method llvm::ConstantExpr::getPtrToInt.
const_inttoptr c ty returns the constant pointer conversion of integer constant c to pointer type ty. See the method llvm::ConstantExpr::getIntToPtr.
const_bitcast c ty returns the constant bitwise conversion of constant c to type ty of equal size. See the method llvm::ConstantExpr::getBitCast.
const_trunc_or_bitcast c ty returns a constant trunc or bitwise cast conversion of constant c to type ty. See the method llvm::ConstantExpr::getTruncOrBitCast.
const_pointercast c ty returns a constant bitcast or a pointer-to-int cast conversion of constant c to type ty of equal size. See the method llvm::ConstantExpr::getPointerCast.
const_extractelement vec i returns the constant ith element of constant vector vec. i must be a constant i32 value unsigned less than the size of the vector. See the method llvm::ConstantExpr::getExtractElement.
const_insertelement vec v i returns the constant vector with the same elements as constant vector v but the ith element replaced by the constant v. v must be a constant value with the type of the vector elements. i must be a constant i32 value unsigned less than the size of the vector. See the method llvm::ConstantExpr::getInsertElement.
const_shufflevector a b mask returns a constant shufflevector. See the LLVM Language Reference for details on the shufflevector instruction. See the method llvm::ConstantExpr::getShuffleVector.
const_inline_asm ty asm con side align inserts a inline assembly string. See the method llvm::InlineAsm::get.
val block_address : llvalue -> llbasicblock -> llvalueblock_address f bb returns the address of the basic block bb in the function f. See the method llvm::BasicBlock::get.
global_parent g is the enclosing module of the global value g. See the method llvm::GlobalValue::getParent.
val is_declaration : llvalue -> boolis_declaration g returns true if the global value g is a declaration only. Returns false otherwise. See the method llvm::GlobalValue::isDeclaration.
linkage g returns the linkage of the global value g. See the method llvm::GlobalValue::getLinkage.
set_linkage l g sets the linkage of the global value g to l. See the method llvm::GlobalValue::setLinkage.
val unnamed_addr : llvalue -> boolunnamed_addr g returns true if the global value g has the unnamed_addr attribute. Returns false otherwise. See the method llvm::GlobalValue::getUnnamedAddr.
val set_unnamed_addr : bool -> llvalue -> unitset_unnamed_addr b g if b is true, sets the unnamed_addr attribute of the global value g. Unset it otherwise. See the method llvm::GlobalValue::setUnnamedAddr.
val section : llvalue -> stringsection g returns the linker section of the global value g. See the method llvm::GlobalValue::getSection.
val set_section : string -> llvalue -> unitset_section s g sets the linker section of the global value g to s. See the method llvm::GlobalValue::setSection.
val visibility : llvalue -> Visibility.tvisibility g returns the linker visibility of the global value g. See the method llvm::GlobalValue::getVisibility.
val set_visibility : Visibility.t -> llvalue -> unitset_visibility v g sets the linker visibility of the global value g to v. See the method llvm::GlobalValue::setVisibility.
val dll_storage_class : llvalue -> DLLStorageClass.tdll_storage_class g returns the DLL storage class of the global value g. See the method llvm::GlobalValue::getDLLStorageClass.
val set_dll_storage_class : DLLStorageClass.t -> llvalue -> unitset_dll_storage_class v g sets the DLL storage class of the global value g to v. See the method llvm::GlobalValue::setDLLStorageClass.
val alignment : llvalue -> intalignment g returns the required alignment of the global value g. See the method llvm::GlobalValue::getAlignment.
val set_alignment : int -> llvalue -> unitset_alignment n g sets the required alignment of the global value g to n bytes. See the method llvm::GlobalValue::setAlignment.
val global_copy_all_metadata : llvalue -> (llmdkind * llmetadata) arrayglobal_copy_all_metadata g returns all the metadata associated with g, which must be an Instruction or GlobalObject. See the llvm::Instruction::getAllMetadata() and llvm::GlobalObject::getAllMetadata() methods.
declare_global ty name m returns a new global variable of type ty and with name name in module m in the default address space (0). If such a global variable already exists, it is returned. If the type of the existing global differs, then a bitcast to ty is returned.
declare_qualified_global ty name addrspace m returns a new global variable of type ty and with name name in module m in the address space addrspace. If such a global variable already exists, it is returned. If the type of the existing global differs, then a bitcast to ty is returned.
define_global name init m returns a new global with name name and initializer init in module m in the default address space (0). If the named global already exists, it is renamed. See the constructor of llvm::GlobalVariable.
define_qualified_global name init addrspace m returns a new global with name name and initializer init in module m in the address space addrspace. If the named global already exists, it is renamed. See the constructor of llvm::GlobalVariable.
lookup_global name m returns Some g if a global variable with name name exists in module m. If no such global exists, returns None. See the llvm::GlobalVariable constructor.
val delete_global : llvalue -> unitdelete_global gv destroys the global variable gv. See the method llvm::GlobalVariable::eraseFromParent.
global_begin m returns the first position in the global variable list of the module m. global_begin and global_succ can be used to iterate over the global list in order. See the method llvm::Module::global_begin.
global_succ gv returns the global variable list position succeeding Before gv. See the method llvm::Module::global_iterator::operator++.
iter_globals f m applies function f to each of the global variables of module m in order. Tail recursive.
fold_left_globals f init m is f (... (f init g1) ...) gN where g1,...,gN are the global variables of module m. Tail recursive.
global_end m returns the last position in the global variable list of the module m. global_end and global_pred can be used to iterate over the global list in reverse. See the method llvm::Module::global_end.
global_pred gv returns the global variable list position preceding After gv. See the method llvm::Module::global_iterator::operator--.
rev_iter_globals f m applies function f to each of the global variables of module m in reverse order. Tail recursive.
fold_right_globals f m init is f g1 (... (f gN init) ...) where g1,...,gN are the global variables of module m. Tail recursive.
val is_global_constant : llvalue -> boolis_global_constant gv returns true if the global variabile gv is a constant. Returns false otherwise. See the method llvm::GlobalVariable::isConstant.
val set_global_constant : bool -> llvalue -> unitset_global_constant c gv sets the global variable gv to be a constant if c is true and not if c is false. See the method llvm::GlobalVariable::setConstant.
global_initializer gv If global variable gv has an initializer it is returned, otherwise returns None. See the method llvm::GlobalVariable::getInitializer.
set_initializer c gv sets the initializer for the global variable gv to the constant c. See the method llvm::GlobalVariable::setInitializer.
val remove_initializer : llvalue -> unitremove_initializer gv unsets the initializer for the global variable gv. See the method llvm::GlobalVariable::setInitializer.
val is_thread_local : llvalue -> boolis_thread_local gv returns true if the global variable gv is thread-local and false otherwise. See the method llvm::GlobalVariable::isThreadLocal.
val set_thread_local : bool -> llvalue -> unitset_thread_local c gv sets the global variable gv to be thread local if c is true and not otherwise. See the method llvm::GlobalVariable::setThreadLocal.
val thread_local_mode : llvalue -> ThreadLocalMode.tis_thread_local gv returns the thread local mode of the global variable gv. See the method llvm::GlobalVariable::getThreadLocalMode.
val set_thread_local_mode : ThreadLocalMode.t -> llvalue -> unitset_thread_local c gv sets the thread local mode of the global variable gv. See the method llvm::GlobalVariable::setThreadLocalMode.
val is_externally_initialized : llvalue -> boolis_externally_initialized gv returns true if the global variable gv is externally initialized and false otherwise. See the method llvm::GlobalVariable::isExternallyInitialized.
val set_externally_initialized : bool -> llvalue -> unitset_externally_initialized c gv sets the global variable gv to be externally initialized if c is true and not otherwise. See the method llvm::GlobalVariable::setExternallyInitialized.
add_alias m vt sp a n inserts an alias in the module m with the value type vt the address space sp the aliasee a with the name n. See the constructor for llvm::GlobalAlias.
declare_function name ty m returns a new function of type ty and with name name in module m. If such a function already exists, it is returned. If the type of the existing function differs, then a bitcast to ty is returned.
define_function name ty m creates a new function with name name and type ty in module m. If the named function already exists, it is renamed. An entry basic block is created in the function. See the constructor of llvm::GlobalVariable.
lookup_function name m returns Some f if a function with name name exists in module m. If no such function exists, returns None. See the method llvm::Module constructor.
val delete_function : llvalue -> unitdelete_function f destroys the function f. See the method llvm::Function::eraseFromParent.
function_begin m returns the first position in the function list of the module m. function_begin and function_succ can be used to iterate over the function list in order. See the method llvm::Module::begin.
function_succ gv returns the function list position succeeding Before gv. See the method llvm::Module::iterator::operator++.
iter_functions f m applies function f to each of the functions of module m in order. Tail recursive.
fold_left_function f init m is f (... (f init f1) ...) fN where f1,...,fN are the functions of module m. Tail recursive.
function_end m returns the last position in the function list of the module m. function_end and function_pred can be used to iterate over the function list in reverse. See the method llvm::Module::end.
function_pred gv returns the function list position preceding After gv. See the method llvm::Module::iterator::operator--.
rev_iter_functions f fn applies function f to each of the functions of module m in reverse order. Tail recursive.
fold_right_functions f m init is f (... (f init fN) ...) f1 where f1,...,fN are the functions of module m. Tail recursive.
val is_intrinsic : llvalue -> boolis_intrinsic f returns true if the function f is an intrinsic. See the method llvm::Function::isIntrinsic.
val function_call_conv : llvalue -> intfunction_call_conv f returns the calling convention of the function f. See the method llvm::Function::getCallingConv.
val set_function_call_conv : int -> llvalue -> unitset_function_call_conv cc f sets the calling convention of the function f to the calling convention numbered cc. See the method llvm::Function::setCallingConv.
val gc : llvalue -> string optiongc f returns Some name if the function f has a garbage collection algorithm specified and None otherwise. See the method llvm::Function::getGC.
val set_gc : string option -> llvalue -> unitset_gc gc f sets the collection algorithm for the function f to gc. See the method llvm::Function::setGC.
val add_function_attr : llvalue -> llattribute -> AttrIndex.t -> unitadd_function_attr f a i adds attribute a to the function f at position i.
val function_attrs : llvalue -> AttrIndex.t -> llattribute arrayfunction_attrs f i returns the attributes for the function f at position i.
val remove_enum_function_attr : llvalue -> llattrkind -> AttrIndex.t -> unitremove_enum_function_attr f k i removes enum attribute with kind k from the function f at position i.
val remove_string_function_attr : llvalue -> string -> AttrIndex.t -> unitremove_string_function_attr f k i removes string attribute with kind k from the function f at position i.
params f returns the parameters of function f. See the method llvm::Function::getArgumentList.
param f n returns the nth parameter of function f. See the method llvm::Function::getArgumentList.
param_parent p returns the parent function that owns the parameter. See the method llvm::Argument::getParent.
param_begin f returns the first position in the parameter list of the function f. param_begin and param_succ can be used to iterate over the parameter list in order. See the method llvm::Function::arg_begin.
param_succ bb returns the parameter list position succeeding Before bb. See the method llvm::Function::arg_iterator::operator++.
iter_params f fn applies function f to each of the parameters of function fn in order. Tail recursive.
fold_left_params f init fn is f (... (f init b1) ...) bN where b1,...,bN are the parameters of function fn. Tail recursive.
param_end f returns the last position in the parameter list of the function f. param_end and param_pred can be used to iterate over the parameter list in reverse. See the method llvm::Function::arg_end.
param_pred gv returns the function list position preceding After gv. See the method llvm::Function::arg_iterator::operator--.
rev_iter_params f fn applies function f to each of the parameters of function fn in reverse order. Tail recursive.
fold_right_params f fn init is f (... (f init bN) ...) b1 where b1,...,bN are the parameters of function fn. Tail recursive.
val basic_blocks : llvalue -> llbasicblock arraybasic_blocks fn returns the basic blocks of the function f. See the method llvm::Function::getBasicBlockList.
val entry_block : llvalue -> llbasicblockentry_block fn returns the entry basic block of the function f. See the method llvm::Function::getEntryBlock.
val delete_block : llbasicblock -> unitdelete_block bb deletes the basic block bb. See the method llvm::BasicBlock::eraseFromParent.
val remove_block : llbasicblock -> unitremove_block bb removes the basic block bb from its parent function. See the method llvm::BasicBlock::removeFromParent.
val move_block_before : llbasicblock -> llbasicblock -> unitmove_block_before pos bb moves the basic block bb before pos. See the method llvm::BasicBlock::moveBefore.
val move_block_after : llbasicblock -> llbasicblock -> unitmove_block_after pos bb moves the basic block bb after pos. See the method llvm::BasicBlock::moveAfter.
val append_block : llcontext -> string -> llvalue -> llbasicblockappend_block c name f creates a new basic block named name at the end of function f in the context c. See the constructor of llvm::BasicBlock.
val insert_block : llcontext -> string -> llbasicblock -> llbasicblockinsert_block c name bb creates a new basic block named name before the basic block bb in the context c. See the constructor of llvm::BasicBlock.
val block_parent : llbasicblock -> llvalueblock_parent bb returns the parent function that owns the basic block. See the method llvm::BasicBlock::getParent.
val block_begin : llvalue -> (llvalue, llbasicblock) llposblock_begin f returns the first position in the basic block list of the function f. block_begin and block_succ can be used to iterate over the basic block list in order. See the method llvm::Function::begin.
val block_succ : llbasicblock -> (llvalue, llbasicblock) llposblock_succ bb returns the basic block list position succeeding Before bb. See the method llvm::Function::iterator::operator++.
val iter_blocks : (llbasicblock -> unit) -> llvalue -> unititer_blocks f fn applies function f to each of the basic blocks of function fn in order. Tail recursive.
val fold_left_blocks : ('a -> llbasicblock -> 'a) -> 'a -> llvalue -> 'afold_left_blocks f init fn is f (... (f init b1) ...) bN where b1,...,bN are the basic blocks of function fn. Tail recursive.
val block_end : llvalue -> (llvalue, llbasicblock) llrev_posblock_end f returns the last position in the basic block list of the function f. block_end and block_pred can be used to iterate over the basic block list in reverse. See the method llvm::Function::end.
val block_pred : llbasicblock -> (llvalue, llbasicblock) llrev_posblock_pred bb returns the basic block list position preceding After bb. See the method llvm::Function::iterator::operator--.
val block_terminator : llbasicblock -> llvalue optionblock_terminator bb returns the terminator of the basic block bb.
val rev_iter_blocks : (llbasicblock -> unit) -> llvalue -> unitrev_iter_blocks f fn applies function f to each of the basic blocks of function fn in reverse order. Tail recursive.
val fold_right_blocks : (llbasicblock -> 'a -> 'a) -> llvalue -> 'a -> 'afold_right_blocks f fn init is f (... (f init bN) ...) b1 where b1,...,bN are the basic blocks of function fn. Tail recursive.
val value_of_block : llbasicblock -> llvaluevalue_of_block bb losslessly casts bb to an llvalue.
val value_is_block : llvalue -> boolvalue_is_block v returns true if the value v is a basic block and false otherwise. Similar to llvm::isa<BasicBlock>.
val block_of_value : llvalue -> llbasicblockblock_of_value v losslessly casts v to an llbasicblock.
val instr_parent : llvalue -> llbasicblockinstr_parent i is the enclosing basic block of the instruction i. See the method llvm::Instruction::getParent.
val delete_instruction : llvalue -> unitdelete_instruction i deletes the instruction i. * See the method llvm::Instruction::eraseFromParent.
val instr_begin : llbasicblock -> (llbasicblock, llvalue) llposinstr_begin bb returns the first position in the instruction list of the basic block bb. instr_begin and instr_succ can be used to iterate over the instruction list in order. See the method llvm::BasicBlock::begin.
val instr_succ : llvalue -> (llbasicblock, llvalue) llposinstr_succ i returns the instruction list position succeeding Before i. See the method llvm::BasicBlock::iterator::operator++.
val iter_instrs : (llvalue -> unit) -> llbasicblock -> unititer_instrs f bb applies function f to each of the instructions of basic block bb in order. Tail recursive.
val fold_left_instrs : ('a -> llvalue -> 'a) -> 'a -> llbasicblock -> 'afold_left_instrs f init bb is f (... (f init g1) ...) gN where g1,...,gN are the instructions of basic block bb. Tail recursive.
val instr_end : llbasicblock -> (llbasicblock, llvalue) llrev_posinstr_end bb returns the last position in the instruction list of the basic block bb. instr_end and instr_pred can be used to iterate over the instruction list in reverse. See the method llvm::BasicBlock::end.
val instr_pred : llvalue -> (llbasicblock, llvalue) llrev_posinstr_pred i returns the instruction list position preceding After i. See the method llvm::BasicBlock::iterator::operator--.
val fold_right_instrs : (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'afold_right_instrs f bb init is f (... (f init fN) ...) f1 where f1,...,fN are the instructions of basic block bb. Tail recursive.
inst_opcode i returns the Opcode.t corresponding to instruction i, or Opcode.Invalid if i is not an instruction.
icmp_predicate i returns the Icmp.t corresponding to an icmp instruction i.
fcmp_predicate i returns the fcmp.t corresponding to an fcmp instruction i.
inst_clone i returns a copy of instruction i, The instruction has no parent, and no name. See the method llvm::Instruction::clone.
val instruction_call_conv : llvalue -> intinstruction_call_conv ci is the calling convention for the call or invoke instruction ci, which may be one of the values from the module CallConv. See the method llvm::CallInst::getCallingConv and llvm::InvokeInst::getCallingConv.
val set_instruction_call_conv : int -> llvalue -> unitset_instruction_call_conv cc ci sets the calling convention for the call or invoke instruction ci to the integer cc, which can be one of the values from the module CallConv. See the method llvm::CallInst::setCallingConv and llvm::InvokeInst::setCallingConv.
val add_call_site_attr : llvalue -> llattribute -> AttrIndex.t -> unitadd_call_site_attr f a i adds attribute a to the call instruction ci at position i.
val call_site_attrs : llvalue -> AttrIndex.t -> llattribute arraycall_site_attr f i returns the attributes for the call instruction ci at position i.
val remove_enum_call_site_attr : llvalue -> llattrkind -> AttrIndex.t -> unitremove_enum_call_site_attr f k i removes enum attribute with kind k from the call instruction ci at position i.
val remove_string_call_site_attr : llvalue -> string -> AttrIndex.t -> unitremove_string_call_site_attr f k i removes string attribute with kind k from the call instruction ci at position i.
val num_arg_operands : llvalue -> intnum_arg_operands ci returns the number of arguments for the call or invoke instruction ci. See the method llvm::CallInst::getNumArgOperands.
val is_tail_call : llvalue -> boolis_tail_call ci is true if the call instruction ci is flagged as eligible for tail call optimization, false otherwise. See the method llvm::CallInst::isTailCall.
val set_tail_call : bool -> llvalue -> unitset_tail_call tc ci flags the call instruction ci as eligible for tail call optimization if tc is true, clears otherwise. See the method llvm::CallInst::setTailCall.
val get_normal_dest : llvalue -> llbasicblockget_normal_dest ii is the normal destination basic block of an invoke instruction. See the method llvm::InvokeInst::getNormalDest().
val get_unwind_dest : llvalue -> llbasicblockget_unwind_dest ii is the unwind destination basic block of an invoke instruction. See the method llvm::InvokeInst::getUnwindDest().
val is_volatile : llvalue -> boolis_volatile i is true if the load or store instruction i is marked as volatile. See the methods llvm::LoadInst::isVolatile and llvm::StoreInst::isVolatile.
val set_volatile : bool -> llvalue -> unitset_volatile v i marks the load or store instruction i as volatile if v is true, unmarks otherwise. See the methods llvm::LoadInst::setVolatile and llvm::StoreInst::setVolatile.
val is_terminator : llvalue -> boolis_terminator v returns true if the instruction v is a terminator.
val successor : llvalue -> int -> llbasicblocksuccessor v i returns the successor at index i for the value v. See the method llvm::Instruction::getSuccessor.
val set_successor : llvalue -> int -> llbasicblock -> unitset_successor v i o sets the successor of the value v at the index i to the value o. See the method llvm::Instruction::setSuccessor.
val num_successors : llvalue -> intnum_successors v returns the number of successors for the value v. See the method llvm::Instruction::getNumSuccessors.
val successors : llvalue -> llbasicblock arraysuccessors v returns the successors of v.
val iter_successors : (llbasicblock -> unit) -> llvalue -> unititer_successors f v applies function f to each successor v in order. Tail recursive.
val fold_successors : (llbasicblock -> 'a -> 'a) -> llvalue -> 'a -> 'afold_successors f v init is f (... (f init vN) ...) v1 where v1,...,vN are the successors of v. Tail recursive.
val is_conditional : llvalue -> boolis_conditional v returns true if the branch instruction v is conditional. See the method llvm::BranchInst::isConditional.
condition v return the condition of the branch instruction v. See the method llvm::BranchInst::getCondition.
set_condition v c sets the condition of the branch instruction v to the value c. See the method llvm::BranchInst::setCondition.
val get_branch :
llvalue ->
[ `Conditional of llvalue * llbasicblock * llbasicblock
| `Unconditional of llbasicblock ]
optionget_branch c returns a description of the branch instruction c.
val add_incoming : (llvalue * llbasicblock) -> llvalue -> unitadd_incoming (v, bb) pn adds the value v to the phi node pn for use with branches from bb. See the method llvm::PHINode::addIncoming.
val incoming : llvalue -> (llvalue * llbasicblock) listincoming pn returns the list of value-block pairs for phi node pn. See the method llvm::PHINode::getIncomingValue.
builder context creates an instruction builder with no position in the context context. It is invalid to use this builder until its position is set with position_before or position_at_end. See the constructor for llvm::LLVMBuilder.
val builder_at : llcontext -> (llbasicblock, llvalue) llpos -> llbuilderbuilder_at ip creates an instruction builder positioned at ip. See the constructor for llvm::LLVMBuilder.
builder_before ins creates an instruction builder positioned before the instruction isn. See the constructor for llvm::LLVMBuilder.
val builder_at_end : llcontext -> llbasicblock -> llbuilderbuilder_at_end bb creates an instruction builder positioned at the end of the basic block bb. See the constructor for llvm::LLVMBuilder.
val position_builder : (llbasicblock, llvalue) llpos -> llbuilder -> unitposition_builder ip bb moves the instruction builder bb to the position ip. See the constructor for llvm::LLVMBuilder.
val position_builder_before_dbg_records :
(llbasicblock, llvalue) llpos ->
llbuilder ->
unitposition_builder_before_dbg_records ip bb before_dbg_records moves the instruction builder bb to the position ip, before any debug records there. See the constructor for llvm::LLVMBuilder.
position_before ins b moves the instruction builder b to before the instruction isn. See the method llvm::LLVMBuilder::SetInsertPoint.
position_before_dbg_records ins b moves the instruction builder b to before the instruction isn and any debug records attached to it. See the method llvm::LLVMBuilder::SetInsertPoint.
val position_at_end : llbasicblock -> llbuilder -> unitposition_at_end bb b moves the instruction builder b to the end of the basic block bb. See the method llvm::LLVMBuilder::SetInsertPoint.
val insertion_block : llbuilder -> llbasicblockinsertion_block b returns the basic block that the builder b is positioned to insert into. Raises Not_Found if the instruction builder is uninitialized. See the method llvm::LLVMBuilder::GetInsertBlock.
insert_into_builder i name b inserts the specified instruction i at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::Insert.
set_current_debug_location b md sets the current debug location md in the builder b. See the method llvm::IRBuilder::SetDebugLocation.
val clear_current_debug_location : llbuilder -> unitclear_current_debug_location b clears the current debug location in the builder b.
current_debug_location b returns the current debug location, or None if none is currently set. See the method llvm::IRBuilder::GetDebugLocation.
set_inst_debug_location b i sets the current debug location of the builder b to the instruction i. See the method llvm::IRBuilder::SetInstDebugLocation.
build_ret_void b creates a ret void instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateRetVoid.
build_ret v b creates a ret %v instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateRet.
build_aggregate_ret vs b creates a ret {...} { %v1, %v2, ... } instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAggregateRet.
val build_br : llbasicblock -> llbuilder -> llvaluebuild_br bb b creates a br %bb instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateBr.
val build_cond_br :
llvalue ->
llbasicblock ->
llbasicblock ->
llbuilder ->
llvaluebuild_cond_br cond tbb fbb b creates a br %cond, %tbb, %fbb instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateCondBr.
val build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvaluebuild_switch case elsebb count b creates an empty switch %case, %elsebb instruction at the position specified by the instruction builder b with space reserved for count cases. See the method llvm::LLVMBuilder::CreateSwitch.
build_malloc ty name b creates an malloc instruction at the position specified by the instruction builder b. See the method llvm::IRBuilderBase::CreateMalloc.
build_array_malloc ty val name b creates an array malloc instruction at the position specified by the instruction builder b. See the method llvm::CallInst::CreateArrayMalloc.
build_free p b creates a free instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFree.
val add_case : llvalue -> llvalue -> llbasicblock -> unitadd_case sw onval bb causes switch instruction sw to branch to bb when its input matches the constant onval. See the method llvm::SwitchInst::addCase. *
val switch_default_dest : llvalue -> llbasicblockswitch_default_dest sw returns the default destination of the switch instruction. See the method llvm:;SwitchInst::getDefaultDest. *
build_indirect_br addr count b creates a indirectbr %addr instruction at the position specified by the instruction builder b with space reserved for count destinations. See the method llvm::LLVMBuilder::CreateIndirectBr.
val add_destination : llvalue -> llbasicblock -> unitadd_destination br bb adds the basic block bb as a possible branch location for the indirectbr instruction br. See the method llvm::IndirectBrInst::addDestination. *
val build_invoke :
lltype ->
llvalue ->
llvalue array ->
llbasicblock ->
llbasicblock ->
string ->
llbuilder ->
llvaluebuild_invoke fnty fn args tobb unwindbb name b creates an %name = invoke %fn(args) to %tobb unwind %unwindbb instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateInvoke.
build_landingpad ty persfn numclauses name b creates an landingpad instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateLandingPad.
val is_cleanup : llvalue -> boolis_cleanup lp returns true if landingpad instruction lp is a cleanup. See the method llvm::LandingPadInst::isCleanup.
val set_cleanup : llvalue -> bool -> unitset_cleanup lp sets the cleanup flag in the landingpadinstruction. See the method llvm::LandingPadInst::setCleanup.
add_clause lp clause adds the clause to the landingpadinstruction. See the method llvm::LandingPadInst::addClause.
build_resume exn b builds a resume exn instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateResume
build_unreachable b creates an unreachable instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateUnwind.
build_add x y name b creates a %name = add %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAdd.
build_nsw_add x y name b creates a %name = nsw add %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNSWAdd.
build_nuw_add x y name b creates a %name = nuw add %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNUWAdd.
build_fadd x y name b creates a %name = fadd %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFAdd.
build_sub x y name b creates a %name = sub %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSub.
build_nsw_sub x y name b creates a %name = nsw sub %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNSWSub.
build_nuw_sub x y name b creates a %name = nuw sub %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNUWSub.
build_fsub x y name b creates a %name = fsub %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFSub.
build_mul x y name b creates a %name = mul %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateMul.
build_nsw_mul x y name b creates a %name = nsw mul %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNSWMul.
build_nuw_mul x y name b creates a %name = nuw mul %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateNUWMul.
build_fmul x y name b creates a %name = fmul %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFMul.
build_udiv x y name b creates a %name = udiv %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateUDiv.
build_sdiv x y name b creates a %name = sdiv %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSDiv.
build_exact_sdiv x y name b creates a %name = exact sdiv %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateExactSDiv.
build_fdiv x y name b creates a %name = fdiv %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFDiv.
build_urem x y name b creates a %name = urem %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateURem.
build_SRem x y name b creates a %name = srem %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSRem.
build_frem x y name b creates a %name = frem %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFRem.
build_shl x y name b creates a %name = shl %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateShl.
build_lshr x y name b creates a %name = lshr %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateLShr.
build_ashr x y name b creates a %name = ashr %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAShr.
build_and x y name b creates a %name = and %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAnd.
build_or x y name b creates a %name = or %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateOr.
build_xor x y name b creates a %name = xor %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateXor.
build_neg x name b creates a %name = sub 0, %x instruction at the position specified by the instruction builder b. -0.0 is used for floating point types to compute the correct sign. See the method llvm::LLVMBuilder::CreateNeg.
build_nsw_neg x name b creates a %name = nsw sub 0, %x instruction at the position specified by the instruction builder b. -0.0 is used for floating point types to compute the correct sign. See the method llvm::LLVMBuilder::CreateNeg.
build_nuw_neg x name b creates a %name = nuw sub 0, %x instruction at the position specified by the instruction builder b. -0.0 is used for floating point types to compute the correct sign. See the method llvm::LLVMBuilder::CreateNeg.
build_fneg x name b creates a %name = fsub 0, %x instruction at the position specified by the instruction builder b. -0.0 is used for floating point types to compute the correct sign. See the method llvm::LLVMBuilder::CreateFNeg.
build_xor x name b creates a %name = xor %x, -1 instruction at the position specified by the instruction builder b. -1 is the correct "all ones" value for the type of x. See the method llvm::LLVMBuilder::CreateXor.
build_alloca ty name b creates a %name = alloca %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAlloca.
build_array_alloca ty n name b creates a %name = alloca %ty, %n instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateAlloca.
build_load ty v name b creates a %name = load %ty, %v instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateLoad.
build_store v p b creates a store %v, %p instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateStore.
val build_atomicrmw :
AtomicRMWBinOp.t ->
llvalue ->
llvalue ->
AtomicOrdering.t ->
bool ->
string ->
llbuilder ->
llvaluebuild_atomicrmw op ptr val o st b creates an atomicrmw instruction with operation op performed on pointer ptr and value val with ordering o and singlethread flag set to st at the position specified by the instruction builder b. See the method llvm::IRBuilder::CreateAtomicRMW.
build_gep srcty p indices name b creates a %name = getelementptr srcty, %p, indices... instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateGetElementPtr.
build_in_bounds_gep srcty p indices name b creates a %name = gelementptr inbounds srcty, %p, indices... instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateInBoundsGetElementPtr.
build_struct_gep srcty p idx name b creates a %name = getelementptr srcty, %p, 0, idx instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateStructGetElementPtr.
build_global_string str name b creates a series of instructions that adds a global string at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateGlobalString.
build_global_stringptr str name b creates a series of instructions that adds a global string pointer at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateGlobalStringPtr.
build_trunc v ty name b creates a %name = trunc %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateTrunc.
build_zext v ty name b creates a %name = zext %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateZExt.
build_sext v ty name b creates a %name = sext %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSExt.
build_fptoui v ty name b creates a %name = fptoui %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFPToUI.
build_fptosi v ty name b creates a %name = fptosi %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFPToSI.
build_uitofp v ty name b creates a %name = uitofp %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateUIToFP.
build_sitofp v ty name b creates a %name = sitofp %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSIToFP.
build_fptrunc v ty name b creates a %name = fptrunc %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFPTrunc.
build_fpext v ty name b creates a %name = fpext %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFPExt.
build_ptrtoint v ty name b creates a %name = prtotint %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreatePtrToInt.
build_inttoptr v ty name b creates a %name = inttoptr %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateIntToPtr.
build_bitcast v ty name b creates a %name = bitcast %p to %ty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateBitCast.
build_zext_or_bitcast v ty name b creates a zext or bitcast instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateZExtOrBitCast.
build_sext_or_bitcast v ty name b creates a sext or bitcast instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSExtOrBitCast.
build_trunc_or_bitcast v ty name b creates a trunc or bitcast instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateZExtOrBitCast.
build_pointercast v ty name b creates a bitcast or pointer-to-int instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreatePointerCast.
build_intcast v ty name b creates a zext, bitcast, or trunc instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateIntCast.
build_fpcast v ty name b creates a fpext, bitcast, or fptrunc instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFPCast.
build_icmp pred x y name b creates a %name = icmp %pred %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateICmp.
build_fcmp pred x y name b creates a %name = fcmp %pred %x, %y instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFCmp.
val build_phi : (llvalue * llbasicblock) list -> string -> llbuilder -> llvaluebuild_phi incoming name b creates a %name = phi %incoming instruction at the position specified by the instruction builder b. incoming is a list of (llvalue, llbasicblock) tuples. See the method llvm::LLVMBuilder::CreatePHI.
build_empty_phi ty name b creates a %name = phi %ty instruction at the position specified by the instruction builder b. ty is the type of the instruction. See the method llvm::LLVMBuilder::CreatePHI.
build_call fnty fn args name b creates a %name = call %fn(args...) instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateCall.
build_select cond thenv elsev name b creates a %name = select %cond, %thenv, %elsev instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateSelect.
build_va_arg valist argty name b creates a %name = va_arg %valist, %argty instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateVAArg.
build_extractelement vec i name b creates a %name = extractelement %vec, %i instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateExtractElement.
build_insertelement vec elt i name b creates a %name = insertelement %vec, %elt, %i instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateInsertElement.
build_shufflevector veca vecb mask name b creates a %name = shufflevector %veca, %vecb, %mask instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateShuffleVector.
build_extractvalue agg idx name b creates a %name = extractvalue %agg, %idx instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateExtractValue.
build_insertvalue agg val idx name b creates a %name = insertvalue %agg, %val, %idx instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateInsertValue.
build_is_null val name b creates a %name = icmp eq %val, null instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateIsNull.
build_is_not_null val name b creates a %name = icmp ne %val, null instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateIsNotNull.
build_ptrdiff elemty lhs rhs name b creates a series of instructions that measure the difference between two pointer values in multiples of elemty at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreatePtrDiff.
build_freeze x name b creates a %name = freeze %x instruction at the position specified by the instruction builder b. See the method llvm::LLVMBuilder::CreateFreeze.
module MemoryBuffer : sig ... end