module Llvm:sig..end
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.
type llcontext
llvm::LLVMContext class.type llmodule
llvm::Module class.type lltype
lltype. See the
llvm::Type class.type llvalue
llvalues. See the llvm::Value class.
This type covers a wide range of subclasses.type lluse
llvm::Use class.type llbasicblock
llvm::BasicBlock class.type llbuilder
llvm::LLVMBuilder
class.type llattrkind
type llattribute
llvm::Attribute class.type llmemorybuffer
llvm::MemoryBuffer class.type llmdkind
module TypeKind:sig..end
lltype, the result of classify_type ty.
module Linkage:sig..end
Llvm.linkage and
Llvm.set_linkage.
module Visibility:sig..end
Llvm.visibility and
Llvm.set_visibility.
module DLLStorageClass:sig..end
Llvm.dll_storage_class and
Llvm.set_dll_storage_class.
module CallConv:sig..end
Llvm.function_call_conv and Llvm.set_function_call_conv.
module AttrRepr:sig..end
module AttrIndex:sig..end
module Icmp:sig..end
icmp) instruction.
module Fcmp:sig..end
fcmp) instruction.
module Opcode:sig..end
module LandingPadClauseTy:sig..end
landingpad instruction.
module ThreadLocalMode:sig..end
Llvm.thread_local_mode
and Llvm.set_thread_local_mode.
module AtomicOrdering:sig..end
load, store, cmpxchg, atomicrmw or
fence instruction.
module AtomicRMWBinOp:sig..end
atomicrmw instruction.
module ValueKind:sig..end
llvalue, the result of classify_value v.
module DiagnosticSeverity:sig..end
Diagnostic, the result of Diagnostic.severity d.
type ('a, 'b) llpos =
| |
At_end of |
| |
Before of |
Before 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.type ('a, 'b) llrev_pos =
| |
At_start of |
| |
After of |
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.exception FeatureDisabled of string
exception IoError of string
val enable_pretty_stacktrace : unit -> unitenable_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.val install_fatal_error_handler : (string -> unit) -> unitinstall_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).val reset_fatal_error_handler : unit -> unitreset_fatal_error_handler () resets LLVM's fatal error handler.val parse_command_line_options : ?overview:string -> string array -> unitparse_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..end
val 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 -> llcontextLLVMGetGlobalContext.val mdkind_id : llcontext -> string -> llmdkindmdkind_id context name returns the MDKind ID that corresponds to the
name name in the context context. See the function
llvm::LLVMContext::getMDKindID.exception UnknownAttribute of string
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.val create_module : llcontext -> string -> llmodulecreate_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 Llvm.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.val module_context : llmodule -> llcontextmodule_context m returns the context of the specified module.
See the method llvm::Module::getContextval classify_type : lltype -> TypeKind.tclassify_type ty returns the Llvm.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.val type_context : lltype -> llcontexttype_context ty returns the Llvm.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.val i1_type : llcontext -> lltypei1_type c returns an integer type of bitwidth 1 in the context c. See
llvm::Type::Int1Ty.val i8_type : llcontext -> lltypei8_type c returns an integer type of bitwidth 8 in the context c. See
llvm::Type::Int8Ty.val i16_type : llcontext -> lltypei16_type c returns an integer type of bitwidth 16 in the context c. See
llvm::Type::Int16Ty.val i32_type : llcontext -> lltypei32_type c returns an integer type of bitwidth 32 in the context c. See
llvm::Type::Int32Ty.val i64_type : llcontext -> lltypei64_type c returns an integer type of bitwidth 64 in the context c. See
llvm::Type::Int64Ty.val integer_type : llcontext -> int -> lltypeinteger_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.val float_type : llcontext -> lltypefloat_type c returns the IEEE 32-bit floating point type in the context
c. See llvm::Type::FloatTy.val double_type : llcontext -> lltypedouble_type c returns the IEEE 64-bit floating point type in the context
c. See llvm::Type::DoubleTy.val x86fp80_type : llcontext -> lltypex86fp80_type c returns the x87 80-bit floating point type in the context
c. See llvm::Type::X86_FP80Ty.val fp128_type : llcontext -> lltypefp128_type c returns the IEEE 128-bit floating point type in the context
c. See llvm::Type::FP128Ty.val ppc_fp128_type : llcontext -> lltypeppc_fp128_type c returns the PowerPC 128-bit floating point type in the
context c. See llvm::Type::PPC_FP128Ty.val function_type : lltype -> lltype array -> lltypefunction_type ret_ty param_tys returns the function type returning
ret_ty and taking param_tys as parameters.
See the method llvm::FunctionType::get.val var_arg_function_type : lltype -> lltype array -> lltypevar_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.val return_type : lltype -> lltypereturn_type fty gets the return type of the function type fty.
See the method llvm::FunctionType::getReturnType.val param_types : lltype -> lltype arrayparam_types fty gets the parameter types of the function type fty.
See the method llvm::FunctionType::getParamType.val struct_type : llcontext -> lltype array -> lltypestruct_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.val packed_struct_type : llcontext -> lltype array -> lltypepacked_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 namedval named_struct_type : llcontext -> string -> lltypenamed_struct_type context name returns the named structure type name
in the context context.
See the method llvm::StructType::get.val struct_set_body : lltype -> lltype array -> bool -> unitstruct_set_body ty elts ispacked sets the body of the named struct ty
to the elts elements.
See the moethd llvm::StructType::setBody.val struct_element_types : lltype -> lltype arraystruct_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 subtypes : lltype -> lltype arraysubtypes ty returns ty's subtypesval array_type : lltype -> int -> lltypearray_type ty n returns the array type containing n elements of type
ty. See the method llvm::ArrayType::get.val pointer_type : lltype -> lltypepointer_type ty returns the pointer type referencing objects of type
ty in the default address space (0).
See the method llvm::PointerType::getUnqual.val qualified_pointer_type : lltype -> int -> lltypequalified_pointer_type ty as returns the pointer type referencing objects
of type ty in address space as.
See the method llvm::PointerType::get.val vector_type : lltype -> int -> lltypevector_type ty n returns the array type containing n elements of the
primitive type ty. See the method llvm::ArrayType::get.val element_type : lltype -> lltypeelement_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.val void_type : llcontext -> lltypevoid_type c creates a type of a function which does not return any
value in the context c. See llvm::Type::VoidTy.val label_type : llcontext -> lltypelabel_type c creates a type of a basic block in the context c. See
llvm::Type::LabelTy.val x86_mmx_type : llcontext -> lltypex86_mmx_type c returns the x86 64-bit MMX register type in the
context c. See llvm::Type::X86_MMXTy.val type_by_name : llmodule -> string -> lltype optiontype_by_name m name returns the specified type from the current module
if it exists.
See the method llvm::Module::getTypeByNameval type_of : llvalue -> lltypetype_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 replace_all_uses_with : llvalue -> llvalue -> unitreplace_all_uses_with old new replaces all uses of the value old
with the value new. See the method llvm::Value::replaceAllUsesWith.val use_begin : llvalue -> lluse optionuse_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.val use_succ : lluse -> lluse optionuse_succ u returns the use list position succeeding u.
See the method llvm::use_value_iterator::operator++.val user : lluse -> llvalueuser u returns the user of the use u.
See the method llvm::Use::getUser.val used_value : lluse -> llvalueused_value u returns the usee of the use u.
See the method llvm::Use::getUsedValue.val iter_uses : (lluse -> unit) -> llvalue -> unititer_uses f v applies function f to each of the users of the value v
in order. Tail recursive.val fold_left_uses : ('a -> lluse -> 'a) -> 'a -> llvalue -> 'afold_left_uses f init v is f (... (f init u1) ...) uN where
u1,...,uN are the users of the value v. Tail recursive.val fold_right_uses : (lluse -> 'a -> 'a) -> llvalue -> 'a -> 'afold_right_uses f v init is f u1 (... (f uN init) ...) where
u1,...,uN are the users of the value v. Not tail recursive.val operand : llvalue -> int -> llvalueoperand v i returns the operand at index i for the value v. See the
method llvm::User::getOperand.val operand_use : llvalue -> int -> lluseoperand_use v i returns the use of the operand at index i for the value v. See the
method llvm::User::getOperandUse.val set_operand : llvalue -> int -> llvalue -> unitset_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 is_constant : llvalue -> boolis_constant v returns true if the value v is a constant, false
otherwise. Similar to llvm::isa<Constant>.val const_null : lltype -> llvalueconst_null ty returns the constant null (zero) of the type ty.
See the method llvm::Constant::getNullValue.val const_all_ones : lltype -> llvalueconst_all_ones ty returns the constant '-1' of the integer or vector type
ty. See the method llvm::Constant::getAllOnesValue.val const_pointer_null : lltype -> llvalueconst_pointer_null ty returns the constant null (zero) pointer of the type
ty. See the method llvm::ConstantPointerNull::get.val undef : lltype -> llvalueundef ty returns the undefined value of the type ty.
See the method llvm::UndefValue::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 constexpr_opcode : llvalue -> Opcode.tconstexpr_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.val metadata : llvalue -> llmdkind -> llvalue optionmetadata i kind optionally returns the metadata associated with the
kind kind in the instruction i See the function
llvm::Instruction::getMetadata.val set_metadata : llvalue -> llmdkind -> llvalue -> unitset_metadata i kind md sets the metadata md of kind kind in the
instruction i. See the function llvm::Instruction::setMetadata.val clear_metadata : llvalue -> llmdkind -> unitclear_metadata i kind clears the metadata of kind kind in the
instruction i. See the function llvm::Instruction::setMetadata.val mdstring : llcontext -> string -> llvaluemdstring c s returns the MDString of the string s in the context c.
See the method llvm::MDNode::get.val mdnode : llcontext -> llvalue array -> llvaluemdnode c elts returns the MDNode containing the values elts in the
context c.
See the method llvm::MDNode::get.val mdnull : llcontext -> llvaluemdnull c returns a null MDNode in context c.val get_mdstring : llvalue -> string optionget_mdstring v returns the MDString.
See the method llvm::MDString::getStringval get_mdnode_operands : llvalue -> llvalue arrayget_mdnode_operands v returns the operands in the MDNode.val get_named_metadata : llmodule -> string -> llvalue arrayget_named_metadata m name returns all the MDNodes belonging to the named
metadata (if any).
See the method llvm::NamedMDNode::getOperand.val add_named_metadata_operand : llmodule -> string -> llvalue -> unitadd_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 const_int : lltype -> int -> llvalueconst_int ty i returns the integer constant of type ty and value i.
See the method llvm::ConstantInt::get.val const_of_int64 : lltype -> Int64.t -> bool -> llvalueconst_of_int64 ty i returns the integer constant of type ty and value
i. See the method llvm::ConstantInt::get.val int64_of_const : llvalue -> 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.val const_int_of_string : lltype -> string -> int -> llvalueconst_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.val const_float : lltype -> float -> llvalueconst_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.val const_float_of_string : lltype -> string -> llvalueconst_float_of_string ty s returns the floating point constant of type
ty and value n. See the method llvm::ConstantFP::get.val const_string : llcontext -> string -> llvalueconst_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 Llvm.const_stringz). This value can in turn be used
as the initializer for a global variable. See the method
llvm::ConstantArray::get.val const_stringz : llcontext -> string -> llvalueconst_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.val const_array : lltype -> llvalue array -> llvalueconst_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.val const_struct : llcontext -> llvalue array -> llvalueconst_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.val const_named_struct : lltype -> llvalue array -> llvalueconst_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.val const_packed_struct : llcontext -> llvalue array -> llvalueconst_packed_struct context elts returns the structured constant of
type Llvm.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.val const_vector : llvalue array -> llvalueconst_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.val const_element : llvalue -> int -> llvalueconst_element c returns a constant for a specified index's element.
See the method ConstantDataSequential::getElementAsConstant.val align_of : lltype -> llvaluealign_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.val size_of : lltype -> llvaluesize_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.val const_neg : llvalue -> llvalueconst_neg c returns the arithmetic negation of the constant c.
See the method llvm::ConstantExpr::getNeg.val const_nsw_neg : llvalue -> llvalueconst_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.val const_nuw_neg : llvalue -> llvalueconst_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.val const_fneg : llvalue -> llvalueconst_fneg c returns the arithmetic negation of the constant float c.
See the method llvm::ConstantExpr::getFNeg.val const_not : llvalue -> llvalueconst_not c returns the bitwise inverse of the constant c.
See the method llvm::ConstantExpr::getNot.val const_add : llvalue -> llvalue -> llvalueconst_add c1 c2 returns the constant sum of two constants.
See the method llvm::ConstantExpr::getAdd.val const_nsw_add : llvalue -> llvalue -> llvalueconst_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.val const_nuw_add : llvalue -> llvalue -> llvalueconst_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.val const_fadd : llvalue -> llvalue -> llvalueconst_fadd c1 c2 returns the constant sum of two constant floats.
See the method llvm::ConstantExpr::getFAdd.val const_sub : llvalue -> llvalue -> llvalueconst_sub c1 c2 returns the constant difference, c1 - c2, of two
constants. See the method llvm::ConstantExpr::getSub.val const_nsw_sub : llvalue -> llvalue -> llvalueconst_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.val const_nuw_sub : llvalue -> llvalue -> llvalueconst_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.val const_fsub : llvalue -> llvalue -> llvalueconst_fsub c1 c2 returns the constant difference, c1 - c2, of two
constant floats. See the method llvm::ConstantExpr::getFSub.val const_mul : llvalue -> llvalue -> llvalueconst_mul c1 c2 returns the constant product of two constants.
See the method llvm::ConstantExpr::getMul.val const_nsw_mul : llvalue -> llvalue -> llvalueconst_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.val const_nuw_mul : llvalue -> llvalue -> llvalueconst_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.val const_fmul : llvalue -> llvalue -> llvalueconst_fmul c1 c2 returns the constant product of two constants floats.
See the method llvm::ConstantExpr::getFMul.val const_udiv : llvalue -> llvalue -> llvalueconst_udiv c1 c2 returns the constant quotient c1 / c2 of two unsigned
integer constants.
See the method llvm::ConstantExpr::getUDiv.val const_sdiv : llvalue -> llvalue -> llvalueconst_sdiv c1 c2 returns the constant quotient c1 / c2 of two signed
integer constants.
See the method llvm::ConstantExpr::getSDiv.val const_exact_sdiv : llvalue -> llvalue -> llvalueconst_exact_sdiv c1 c2 returns the constant quotient c1 / c2 of two
signed integer constants. The result is undefined if the result is rounded
or overflows. See the method llvm::ConstantExpr::getExactSDiv.val const_fdiv : llvalue -> llvalue -> llvalueconst_fdiv c1 c2 returns the constant quotient c1 / c2 of two floating
point constants.
See the method llvm::ConstantExpr::getFDiv.val const_urem : llvalue -> llvalue -> llvalueconst_urem c1 c2 returns the constant remainder c1 MOD c2 of two
unsigned integer constants.
See the method llvm::ConstantExpr::getURem.val const_srem : llvalue -> llvalue -> llvalueconst_srem c1 c2 returns the constant remainder c1 MOD c2 of two
signed integer constants.
See the method llvm::ConstantExpr::getSRem.val const_frem : llvalue -> llvalue -> llvalueconst_frem c1 c2 returns the constant remainder c1 MOD c2 of two
signed floating point constants.
See the method llvm::ConstantExpr::getFRem.val const_and : llvalue -> llvalue -> llvalueconst_and c1 c2 returns the constant bitwise AND of two integer
constants.
See the method llvm::ConstantExpr::getAnd.val const_or : llvalue -> llvalue -> llvalueconst_or c1 c2 returns the constant bitwise OR of two integer
constants.
See the method llvm::ConstantExpr::getOr.val const_xor : llvalue -> llvalue -> llvalueconst_xor c1 c2 returns the constant bitwise XOR of two integer
constants.
See the method llvm::ConstantExpr::getXor.val const_icmp : Icmp.t -> llvalue -> llvalue -> llvalueconst_icmp pred c1 c2 returns the constant comparison of two integer
constants, c1 pred c2.
See the method llvm::ConstantExpr::getICmp.val const_fcmp : Fcmp.t -> llvalue -> llvalue -> llvalueconst_fcmp pred c1 c2 returns the constant comparison of two floating
point constants, c1 pred c2.
See the method llvm::ConstantExpr::getFCmp.val const_shl : llvalue -> llvalue -> llvalueconst_shl c1 c2 returns the constant integer c1 left-shifted by the
constant integer c2.
See the method llvm::ConstantExpr::getShl.val const_lshr : llvalue -> llvalue -> llvalueconst_lshr c1 c2 returns the constant integer c1 right-shifted by the
constant integer c2 with zero extension.
See the method llvm::ConstantExpr::getLShr.val const_ashr : llvalue -> llvalue -> llvalueconst_ashr c1 c2 returns the constant integer c1 right-shifted by the
constant integer c2 with sign extension.
See the method llvm::ConstantExpr::getAShr.val const_gep : llvalue -> llvalue array -> llvalueconst_gep pc indices returns the constant getElementPtr of pc with the
constant integers indices from the array indices.
See the method llvm::ConstantExpr::getGetElementPtr.val const_in_bounds_gep : llvalue -> llvalue array -> llvalueconst_in_bounds_gep pc indices returns the constant getElementPtr of pc
with the constant integers indices from the array indices.
See the method llvm::ConstantExpr::getInBoundsGetElementPtr.val const_trunc : llvalue -> lltype -> llvalueconst_trunc c ty returns the constant truncation of integer constant c
to the smaller integer type ty.
See the method llvm::ConstantExpr::getTrunc.val const_sext : llvalue -> lltype -> llvalueconst_sext c ty returns the constant sign extension of integer constant
c to the larger integer type ty.
See the method llvm::ConstantExpr::getSExt.val const_zext : llvalue -> lltype -> llvalueconst_zext c ty returns the constant zero extension of integer constant
c to the larger integer type ty.
See the method llvm::ConstantExpr::getZExt.val const_fptrunc : llvalue -> lltype -> llvalueconst_fptrunc c ty returns the constant truncation of floating point
constant c to the smaller floating point type ty.
See the method llvm::ConstantExpr::getFPTrunc.val const_fpext : llvalue -> lltype -> llvalueconst_fpext c ty returns the constant extension of floating point constant
c to the larger floating point type ty.
See the method llvm::ConstantExpr::getFPExt.val const_uitofp : llvalue -> lltype -> llvalueconst_uitofp c ty returns the constant floating point conversion of
unsigned integer constant c to the floating point type ty.
See the method llvm::ConstantExpr::getUIToFP.val const_sitofp : llvalue -> lltype -> llvalueconst_sitofp c ty returns the constant floating point conversion of
signed integer constant c to the floating point type ty.
See the method llvm::ConstantExpr::getSIToFP.val const_fptoui : llvalue -> lltype -> llvalueconst_fptoui c ty returns the constant unsigned integer conversion of
floating point constant c to integer type ty.
See the method llvm::ConstantExpr::getFPToUI.val const_fptosi : llvalue -> lltype -> llvalueconst_fptoui c ty returns the constant unsigned integer conversion of
floating point constant c to integer type ty.
See the method llvm::ConstantExpr::getFPToSI.val const_ptrtoint : llvalue -> lltype -> llvalueconst_ptrtoint c ty returns the constant integer conversion of
pointer constant c to integer type ty.
See the method llvm::ConstantExpr::getPtrToInt.val const_inttoptr : llvalue -> lltype -> llvalueconst_inttoptr c ty returns the constant pointer conversion of
integer constant c to pointer type ty.
See the method llvm::ConstantExpr::getIntToPtr.val const_bitcast : llvalue -> lltype -> llvalueconst_bitcast c ty returns the constant bitwise conversion of constant c
to type ty of equal size.
See the method llvm::ConstantExpr::getBitCast.val const_zext_or_bitcast : llvalue -> lltype -> llvalueconst_zext_or_bitcast c ty returns a constant zext or bitwise cast
conversion of constant c to type ty.
See the method llvm::ConstantExpr::getZExtOrBitCast.val const_sext_or_bitcast : llvalue -> lltype -> llvalueconst_sext_or_bitcast c ty returns a constant sext or bitwise cast
conversion of constant c to type ty.
See the method llvm::ConstantExpr::getSExtOrBitCast.val const_trunc_or_bitcast : llvalue -> lltype -> llvalueconst_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.val const_pointercast : llvalue -> lltype -> llvalueconst_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.val const_intcast : llvalue -> lltype -> is_signed:bool -> llvalueconst_intcast c ty ~is_signed returns a constant sext/zext, bitcast,
or trunc for integer -> integer casts of constant c to type ty.
When converting a narrower value to a wider one, whether sext or zext
will be used is controlled by is_signed.
See the method llvm::ConstantExpr::getIntegerCast.val const_fpcast : llvalue -> lltype -> llvalueconst_fpcast c ty returns a constant fpext, bitcast, or fptrunc for fp ->
fp casts of constant c to type ty.
See the method llvm::ConstantExpr::getFPCast.val const_select : llvalue -> llvalue -> llvalue -> llvalueconst_select cond t f returns the constant conditional which returns value
t if the boolean constant cond is true and the value f otherwise.
See the method llvm::ConstantExpr::getSelect.val const_extractelement : llvalue -> llvalue -> llvalueconst_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.val const_insertelement : llvalue -> llvalue -> llvalue -> llvalueconst_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.val const_shufflevector : llvalue -> llvalue -> llvalue -> llvalueconst_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.val const_extractvalue : llvalue -> int array -> llvalueconst_extractvalue agg idxs returns the constant idxsth value of
constant aggregate agg. Each idxs must be less than the size of the
aggregate. See the method llvm::ConstantExpr::getExtractValue.val const_insertvalue : llvalue -> llvalue -> int array -> llvalueconst_insertvalue agg val idxs inserts the value val in the specified
indexs idxs in the aggegate agg. Each idxs must be less than the size
of the aggregate. See the method llvm::ConstantExpr::getInsertValue.val const_inline_asm : lltype -> string -> string -> bool -> bool -> llvalueconst_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.val global_parent : llvalue -> llmoduleglobal_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.val linkage : llvalue -> Linkage.tlinkage g returns the linkage of the global value g.
See the method llvm::GlobalValue::getLinkage.val set_linkage : Linkage.t -> llvalue -> unitset_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 declare_global : lltype -> string -> llmodule -> llvaluedeclare_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.val declare_qualified_global : lltype -> string -> int -> llmodule -> llvaluedeclare_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.val define_global : string -> llvalue -> llmodule -> llvaluedefine_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.val define_qualified_global : string -> llvalue -> int -> llmodule -> llvaluedefine_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.val lookup_global : string -> llmodule -> llvalue optionlookup_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.val global_begin : llmodule -> (llmodule, llvalue) llposglobal_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.val global_succ : llvalue -> (llmodule, llvalue) llposglobal_succ gv returns the global variable list position succeeding
Before gv.
See the method llvm::Module::global_iterator::operator++.val iter_globals : (llvalue -> unit) -> llmodule -> unititer_globals f m applies function f to each of the global variables of
module m in order. Tail recursive.val fold_left_globals : ('a -> llvalue -> 'a) -> 'a -> llmodule -> 'afold_left_globals f init m is f (... (f init g1) ...) gN where
g1,...,gN are the global variables of module m. Tail recursive.val global_end : llmodule -> (llmodule, llvalue) llrev_posglobal_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.val global_pred : llvalue -> (llmodule, llvalue) llrev_posglobal_pred gv returns the global variable list position preceding
After gv.
See the method llvm::Module::global_iterator::operator--.val rev_iter_globals : (llvalue -> unit) -> llmodule -> unitrev_iter_globals f m applies function f to each of the global variables
of module m in reverse order. Tail recursive.val fold_right_globals : (llvalue -> 'a -> 'a) -> llmodule -> 'a -> 'afold_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.val global_initializer : llvalue -> llvalueglobal_initializer gv returns the initializer for the global variable
gv. See the method llvm::GlobalVariable::getInitializer.val set_initializer : llvalue -> llvalue -> unitset_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.val add_alias : llmodule -> lltype -> llvalue -> string -> llvalueadd_alias m t a n inserts an alias in the module m with the type t and
the aliasee a with the name n.
See the constructor for llvm::GlobalAlias.val declare_function : string -> lltype -> llmodule -> llvaluedeclare_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.val define_function : string -> lltype -> llmodule -> llvaluedefine_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.val lookup_function : string -> llmodule -> llvalue optionlookup_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.val function_begin : llmodule -> (llmodule, llvalue) llposfunction_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.val function_succ : llvalue -> (llmodule, llvalue) llposfunction_succ gv returns the function list position succeeding
Before gv.
See the method llvm::Module::iterator::operator++.val iter_functions : (llvalue -> unit) -> llmodule -> unititer_functions f m applies function f to each of the functions of module
m in order. Tail recursive.val fold_left_functions : ('a -> llvalue -> 'a) -> 'a -> llmodule -> 'afold_left_function f init m is f (... (f init f1) ...) fN where
f1,...,fN are the functions of module m. Tail recursive.val function_end : llmodule -> (llmodule, llvalue) llrev_posfunction_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.val function_pred : llvalue -> (llmodule, llvalue) llrev_posfunction_pred gv returns the function list position preceding After gv.
See the method llvm::Module::iterator::operator--.val rev_iter_functions : (llvalue -> unit) -> llmodule -> unitrev_iter_functions f fn applies function f to each of the functions of
module m in reverse order. Tail recursive.val fold_right_functions : (llvalue -> 'a -> 'a) -> llmodule -> 'a -> 'afold_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.val params : llvalue -> llvalue arrayparams f returns the parameters of function f.
See the method llvm::Function::getArgumentList.val param : llvalue -> int -> llvalueparam f n returns the nth parameter of function f.
See the method llvm::Function::getArgumentList.val param_parent : llvalue -> llvalueparam_parent p returns the parent function that owns the parameter.
See the method llvm::Argument::getParent.val param_begin : llvalue -> (llvalue, llvalue) llposparam_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.val param_succ : llvalue -> (llvalue, llvalue) llposparam_succ bb returns the parameter list position succeeding
Before bb.
See the method llvm::