+
+(** {7 Operations on scalar constants} *)
+
+(** [const_int ty i] returns the integer constant of type [ty] and value [i].
+ See the method [llvm::ConstantInt::get]. *)
+external const_int : lltype -> int -> llvalue = "llvm_const_int"
+
+(** [const_of_int64 ty i] returns the integer constant of type [ty] and value
+ [i]. See the method [llvm::ConstantInt::get]. *)
+external const_of_int64 : lltype -> Int64.t -> bool -> llvalue
+ = "llvm_const_of_int64"
+
+(** [const_float ty n] returns the floating point constant of type [ty] and
+ value [n]. See the method [llvm::ConstantInt::get]. *)
+external const_float : lltype -> float -> llvalue = "llvm_const_float"
+
+
+(** {7 Operations on composite constants} *)
+
+(** [const_string s] returns the constant [i8] array with the values of the
+ characters in the string [s]. 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]. *)
+external const_string : string -> llvalue = "llvm_const_string"
+
+(** [const_stringz s] returns the constant [i8] array with the values of the
+ characters in the string [s] and a null terminator. This value can in turn
+ be used as the initializer for a global variable.
+ See the method [llvm::ConstantArray::get]. *)
+external const_stringz : string -> llvalue = "llvm_const_stringz"
+
+(** [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]. *)
+external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array"
+
+(** [const_struct elts] returns the structured constant of type
+ [struct_type (Array.map type_of elts)] 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]. *)
+external const_struct : llvalue array -> llvalue = "llvm_const_struct"
+
+(** [const_packed_struct elts] returns the structured constant of type
+ {!packed_struct_type} [(Array.map type_of elts)] 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]. *)
+external const_packed_struct : llvalue array -> llvalue
+ = "llvm_const_packed_struct"
+
+(** [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]. *)
+external const_vector : llvalue array -> llvalue = "llvm_const_vector"
+
+
+(** {7 Constant expressions} *)
+
+(** [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 i64_type 1)) i64_type], but considerably more readable.
+ See the method [llvm::ConstantExpr::getSizeOf]. *)
+external size_of : lltype -> llvalue = "LLVMSizeOf"
+
+(** [const_neg c] returns the arithmetic negation of the constant [c].
+ See the method [llvm::ConstantExpr::getNeg]. *)
+external const_neg : llvalue -> llvalue = "LLVMConstNeg"
+
+(** [const_not c] returns the bitwise inverse of the constant [c].
+ See the method [llvm::ConstantExpr::getNot]. *)
+external const_not : llvalue -> llvalue = "LLVMConstNot"
+
+(** [const_add c1 c2] returns the constant sum of two constants.
+ See the method [llvm::ConstantExpr::getAdd]. *)
+external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
+
+(** [const_sub c1 c2] returns the constant difference, [c1 - c2], of two
+ constants. See the method [llvm::ConstantExpr::getSub]. *)
+external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
+
+(** [const_mul c1 c2] returns the constant product of two constants.
+ See the method [llvm::ConstantExpr::getMul]. *)
+external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
+
+(** [const_udiv c1 c2] returns the constant quotient [c1 / c2] of two unsigned
+ integer constants.
+ See the method [llvm::ConstantExpr::getUDiv]. *)
+external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
+
+(** [const_sdiv c1 c2] returns the constant quotient [c1 / c2] of two signed
+ integer constants.
+ See the method [llvm::ConstantExpr::]. *)
+external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
+
+(** [const_fdiv c1 c2] returns the constant quotient [c1 / c2] of two floating
+ point constants.
+ See the method [llvm::ConstantExpr::getFDiv]. *)
+external const_fdiv : llvalue -> llvalue -> llvalue = "LLVMConstFDiv"
+
+(** [const_udiv c1 c2] returns the constant remainder [c1 MOD c2] of two
+ unsigned integer constants.
+ See the method [llvm::ConstantExpr::getURem]. *)
+external const_urem : llvalue -> llvalue -> llvalue = "LLVMConstURem"
+
+(** [const_sdiv c1 c2] returns the constant remainder [c1 MOD c2] of two
+ signed integer constants.
+ See the method [llvm::ConstantExpr::getSRem]. *)
+external const_srem : llvalue -> llvalue -> llvalue = "LLVMConstSRem"
+
+(** [const_frem c1 c2] returns the constant remainder [c1 MOD c2] of two
+ signed floating point constants.
+ See the method [llvm::ConstantExpr::getFRem]. *)
+external const_frem : llvalue -> llvalue -> llvalue = "LLVMConstFRem"
+
+(** [const_and c1 c2] returns the constant bitwise [AND] of two integer
+ constants.
+ See the method [llvm::ConstantExpr::getAnd]. *)
+external const_and : llvalue -> llvalue -> llvalue = "LLVMConstAnd"
+
+(** [const_or c1 c2] returns the constant bitwise [OR] of two integer
+ constants.
+ See the method [llvm::ConstantExpr::getOr]. *)
+external const_or : llvalue -> llvalue -> llvalue = "LLVMConstOr"
+
+(** [const_xor c1 c2] returns the constant bitwise [XOR] of two integer
+ constants.
+ See the method [llvm::ConstantExpr::getXor]. *)
+external const_xor : llvalue -> llvalue -> llvalue = "LLVMConstXor"
+
+(** [const_icmp pred c1 c2] returns the constant comparison of two integer
+ constants, [c1 pred c2].
+ See the method [llvm::ConstantExpr::getICmp]. *)
+external const_icmp : Icmp.t -> llvalue -> llvalue -> llvalue
+ = "llvm_const_icmp"
+
+(** [const_fcmp pred c1 c2] returns the constant comparison of two floating
+ point constants, [c1 pred c2].
+ See the method [llvm::ConstantExpr::getFCmp]. *)
+external const_fcmp : Fcmp.t -> llvalue -> llvalue -> llvalue
+ = "llvm_const_fcmp"
+
+(** [const_shl c1 c2] returns the constant integer [c1] left-shifted by the
+ constant integer [c2].
+ See the method [llvm::ConstantExpr::getShl]. *)
+external const_shl : llvalue -> llvalue -> llvalue = "LLVMConstShl"
+
+(** [const_lshr c1 c2] returns the constant integer [c1] right-shifted by the
+ constant integer [c2] with zero extension.
+ See the method [llvm::ConstantExpr::getLShr]. *)
+external const_lshr : llvalue -> llvalue -> llvalue = "LLVMConstLShr"
+
+(** [const_ashr c1 c2] returns the constant integer [c1] right-shifted by the
+ constant integer [c2] with sign extension.
+ See the method [llvm::ConstantExpr::getAShr]. *)
+external const_ashr : llvalue -> llvalue -> llvalue = "LLVMConstAShr"
+
+(** [const_gep pc indices] returns the constant [getElementPtr] of [p1] with the
+ constant integers indices from the array [indices].
+ See the method [llvm::ConstantExpr::getGetElementPtr]. *)
+external const_gep : llvalue -> llvalue array -> llvalue = "llvm_const_gep"
+
+(** [const_trunc c ty] returns the constant truncation of integer constant [c]
+ to the smaller integer type [ty].
+ See the method [llvm::ConstantExpr::getTrunc]. *)
+external const_trunc : llvalue -> lltype -> llvalue = "LLVMConstTrunc"
+
+(** [const_sext c ty] returns the constant sign extension of integer constant
+ [c] to the larger integer type [ty].
+ See the method [llvm::ConstantExpr::getSExt]. *)
+external const_sext : llvalue -> lltype -> llvalue = "LLVMConstSExt"
+
+(** [const_zext c ty] returns the constant zero extension of integer constant
+ [c] to the larger integer type [ty].
+ See the method [llvm::ConstantExpr::getZExt]. *)
+external const_zext : llvalue -> lltype -> llvalue = "LLVMConstZExt"
+
+(** [const_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]. *)
+external const_fptrunc : llvalue -> lltype -> llvalue = "LLVMConstFPTrunc"
+
+(** [const_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]. *)
+external const_fpext : llvalue -> lltype -> llvalue = "LLVMConstFPExt"
+
+(** [const_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]. *)
+external const_uitofp : llvalue -> lltype -> llvalue = "LLVMConstUIToFP"
+
+(** [const_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]. *)
+external const_sitofp : llvalue -> lltype -> llvalue = "LLVMConstSIToFP"
+
+(** [const_fptoui c ty] returns the constant unsigned integer conversion of
+ floating point constant [c] to integer type [ty].
+ See the method [llvm::ConstantExpr::getFPToUI]. *)
+external const_fptoui : llvalue -> lltype -> llvalue = "LLVMConstFPToUI"
+
+(** [const_fptoui c ty] returns the constant unsigned integer conversion of
+ floating point constant [c] to integer type [ty].
+ See the method [llvm::ConstantExpr::getFPToSI]. *)
+external const_fptosi : llvalue -> lltype -> llvalue = "LLVMConstFPToSI"
+
+(** [const_ptrtoint c ty] returns the constant integer conversion of
+ pointer constant [c] to integer type [ty].
+ See the method [llvm::ConstantExpr::getPtrToInt]. *)
+external const_ptrtoint : llvalue -> lltype -> llvalue = "LLVMConstPtrToInt"
+
+(** [const_inttoptr c ty] returns the constant pointer conversion of
+ integer constant [c] to pointer type [ty].
+ See the method [llvm::ConstantExpr::getIntToPtr]. *)
+external const_inttoptr : llvalue -> lltype -> llvalue = "LLVMConstIntToPtr"
+
+(** [const_bitcast c ty] returns the constant bitwise conversion of constant [c]
+ to type [ty] of equal size.
+ See the method [llvm::ConstantExpr::getBitCast]. *)
+external const_bitcast : llvalue -> lltype -> llvalue = "LLVMConstBitCast"
+
+(** [const_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]. *)
+external const_select : llvalue -> llvalue -> llvalue -> llvalue
+ = "LLVMConstSelect"
+
+(** [const_extractelement vec i] returns the constant [i]th 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]. *)
+external const_extractelement : llvalue -> llvalue -> llvalue
+ = "LLVMConstExtractElement"
+
+(** [const_insertelement vec v i] returns the constant vector with the same
+ elements as constant vector [v] but the [i]th 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]. *)
+external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue
+ = "LLVMConstInsertElement"
+
+(** [const_shufflevector a b mask] returns a constant [shufflevector].
+ See the LLVM Language Reference for details on the [sufflevector]
+ instruction.
+ See the method [llvm::ConstantExpr::getShuffleVector]. *)
+external const_shufflevector : llvalue -> llvalue -> llvalue -> llvalue
+ = "LLVMConstShuffleVector"
+
+
+(** {7 Operations on global variables, functions, and aliases (globals)} *)
+
+(** [global_parent g] is the enclosing module of the global value [g].
+ See the method [llvm::GlobalValue::getParent]. *)
+external global_parent : llvalue -> llmodule = "LLVMGetGlobalParent"
+
+(** [is_declaration g] returns [true] if the global value [g] is a declaration
+ only. Returns [false] otherwise.
+ See the method [llvm::GlobalValue::isDeclaration]. *)