aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bindings/ocaml/analysis/llvm_analysis.mli21
-rw-r--r--bindings/ocaml/bitreader/llvm_bitreader.mli13
-rw-r--r--bindings/ocaml/bitwriter/llvm_bitwriter.mli11
-rw-r--r--bindings/ocaml/executionengine/llvm_executionengine.mli70
-rw-r--r--bindings/ocaml/llvm/llvm.ml1
-rw-r--r--bindings/ocaml/llvm/llvm.mli606
6 files changed, 373 insertions, 349 deletions
diff --git a/bindings/ocaml/analysis/llvm_analysis.mli b/bindings/ocaml/analysis/llvm_analysis.mli
index 7992ad1d0d..a97bd7e9e2 100644
--- a/bindings/ocaml/analysis/llvm_analysis.mli
+++ b/bindings/ocaml/analysis/llvm_analysis.mli
@@ -5,32 +5,31 @@
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
- *===----------------------------------------------------------------------===
- *
- * This interface provides an ocaml API for LLVM IR analyses, the classes in
- * the Analysis library.
- *
*===----------------------------------------------------------------------===*)
+(** Intermediate representation analysis.
+
+ This interface provides an ocaml API for LLVM IR analyses, the classes in
+ the Analysis library. *)
(** [verify_module m] returns [None] if the module [m] is valid, and
[Some reason] if it is invalid. [reason] is a string containing a
- human-readable validation report. See [llvm::verifyModule]. **)
+ human-readable validation report. See [llvm::verifyModule]. *)
external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
(** [verify_function f] returns [None] if the function [f] is valid, and
[Some reason] if it is invalid. [reason] is a string containing a
- human-readable validation report. See [llvm::verifyFunction]. **)
+ human-readable validation report. See [llvm::verifyFunction]. *)
external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
(** [verify_module m] returns if the module [m] is valid, but prints a
- validation report to [stderr] and aborts the program if it is invalid. See
- [llvm::verifyModule]. **)
+ validation report to [stderr] and aborts the program if it is invalid. See
+ [llvm::verifyModule]. *)
external assert_valid_module : Llvm.llmodule -> unit
= "llvm_assert_valid_module"
(** [verify_function f] returns if the function [f] is valid, but prints a
- validation report to [stderr] and aborts the program if it is invalid. See
- [llvm::verifyFunction]. **)
+ validation report to [stderr] and aborts the program if it is invalid. See
+ [llvm::verifyFunction]. *)
external assert_valid_function : Llvm.llvalue -> unit
= "llvm_assert_valid_function"
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.mli b/bindings/ocaml/bitreader/llvm_bitreader.mli
index f6fc7b8dcd..15b389bb83 100644
--- a/bindings/ocaml/bitreader/llvm_bitreader.mli
+++ b/bindings/ocaml/bitreader/llvm_bitreader.mli
@@ -5,26 +5,25 @@
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
- *===----------------------------------------------------------------------===
- *
- * This interface provides an ocaml API for the LLVM bitcode reader, the
- * classes in the Bitreader library.
- *
*===----------------------------------------------------------------------===*)
+(** Bitcode reader.
+
+ This interface provides an ocaml API for the LLVM bitcode reader, the
+ classes in the Bitreader library. *)
exception Error of string
(** [read_bitcode_file path] reads the bitcode for a new module [m] from the
file at [path]. Returns [Success m] if successful, and [Failure msg]
otherwise, where [msg] is a description of the error encountered.
- See the function [llvm::getBitcodeModuleProvider]. **)
+ See the function [llvm::getBitcodeModuleProvider]. *)
external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
= "llvm_get_module_provider"
(** [parse_bitcode mb] parses the bitcode for a new module [m] from the memory
buffer [mb]. Returns [Success m] if successful, and [Failure msg] otherwise,
where [msg] is a description of the error encountered.
- See the function [llvm::ParseBitcodeFile]. **)
+ See the function [llvm::ParseBitcodeFile]. *)
external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_bitcode"
diff --git a/bindings/ocaml/bitwriter/llvm_bitwriter.mli b/bindings/ocaml/bitwriter/llvm_bitwriter.mli
index 847eefc247..2f782a1d9f 100644
--- a/bindings/ocaml/bitwriter/llvm_bitwriter.mli
+++ b/bindings/ocaml/bitwriter/llvm_bitwriter.mli
@@ -5,15 +5,14 @@
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
- *===----------------------------------------------------------------------===
- *
- * This interface provides an ocaml API for the LLVM bitcode writer, the
- * classes in the Bitwriter library.
- *
*===----------------------------------------------------------------------===*)
+(** Bitcode writer.
+
+ This interface provides an ocaml API for the LLVM bitcode writer, the
+ classes in the Bitwriter library. *)
(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at
- [path]. Returns [true] if successful, [false] otherwise. **)
+ [path]. Returns [true] if successful, [false] otherwise. *)
external write_bitcode_file : Llvm.llmodule -> string -> bool
= "llvm_write_bitcode_file"
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli
index 0ce5721ed6..d3037fe856 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.mli
+++ b/bindings/ocaml/executionengine/llvm_executionengine.mli
@@ -5,78 +5,76 @@
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
- *===----------------------------------------------------------------------===
- *
- * This interface provides an ocaml API for LLVM execution engine (JIT/
- * interpreter), the classes in the ExecutionEngine library.
- *
*===----------------------------------------------------------------------===*)
+(** JIT Interpreter.
-exception Error of string
+ This interface provides an ocaml API for LLVM execution engine (JIT/
+ interpreter), the classes in the ExecutionEngine library. *)
+exception Error of string
module GenericValue: sig
(** [GenericValue.t] is a boxed union type used to portably pass arguments to
and receive values from the execution engine. It supports only a limited
selection of types; for more complex argument types, it is necessary to
generate a stub function by hand or to pass parameters by reference.
- See the struct [llvm::GenericValue]. **)
+ See the struct [llvm::GenericValue]. *)
type t
(** [of_float fpty n] boxes the float [n] in a float-valued generic value
- according to the floating point type [fpty]. See the fields
- [llvm::GenericValue::DoubleVal] and [llvm::GenericValue::FloatVal]. **)
+ according to the floating point type [fpty]. See the fields
+ [llvm::GenericValue::DoubleVal] and [llvm::GenericValue::FloatVal]. *)
val of_float: Llvm.lltype -> float -> t
(** [of_pointer v] boxes the pointer value [v] in a generic value. See the
- field [llvm::GenericValue::PointerVal]. **)
+ field [llvm::GenericValue::PointerVal]. *)
val of_pointer: 'a -> t
(** [of_int32 n w] boxes the int32 [i] in a generic value with the bitwidth
- [w]. See the field [llvm::GenericValue::IntVal]. **)
+ [w]. See the field [llvm::GenericValue::IntVal]. *)
val of_int32: Llvm.lltype -> int32 -> t
(** [of_int n w] boxes the int [i] in a generic value with the bitwidth
- [w]. See the field [llvm::GenericValue::IntVal]. **)
+ [w]. See the field [llvm::GenericValue::IntVal]. *)
val of_int: Llvm.lltype -> int -> t
(** [of_natint n w] boxes the native int [i] in a generic value with the
- bitwidth [w]. See the field [llvm::GenericValue::IntVal]. **)
+ bitwidth [w]. See the field [llvm::GenericValue::IntVal]. *)
val of_nativeint: Llvm.lltype -> nativeint -> t
(** [of_int64 n w] boxes the int64 [i] in a generic value with the bitwidth
- [w]. See the field [llvm::GenericValue::IntVal]. **)
+ [w]. See the field [llvm::GenericValue::IntVal]. *)
val of_int64: Llvm.lltype -> int64 -> t
(** [as_float fpty gv] unboxes the floating point-valued generic value [gv] of
floating point type [fpty]. See the fields [llvm::GenericValue::DoubleVal]
- and [llvm::GenericValue::FloatVal]. **)
+ and [llvm::GenericValue::FloatVal]. *)
val as_float: Llvm.lltype -> t -> float
(** [as_pointer gv] unboxes the pointer-valued generic value [gv]. See the
- field [llvm::GenericValue::PointerVal]. **)
+ field [llvm::GenericValue::PointerVal]. *)
val as_pointer: t -> 'a
(** [as_int32 gv] unboxes the integer-valued generic value [gv] as an [int32].
Is invalid if [gv] has a bitwidth greater than 32 bits. See the field
- [llvm::GenericValue::IntVal]. **)
+ [llvm::GenericValue::IntVal]. *)
val as_int32: t -> int32
(** [as_int gv] unboxes the integer-valued generic value [gv] as an [int].
Is invalid if [gv] has a bitwidth greater than the host bit width (but the
most significant bit may be lost). See the field
- [llvm::GenericValue::IntVal]. **)
+ [llvm::GenericValue::IntVal]. *)
val as_int: t -> int
(** [as_natint gv] unboxes the integer-valued generic value [gv] as a
[nativeint]. Is invalid if [gv] has a bitwidth greater than
- [nativeint]. See the field [llvm::GenericValue::IntVal]. **)
+ [nativeint]. See the field [llvm::GenericValue::IntVal]. *)
val as_nativeint: t -> nativeint
(** [as_int64 gv] returns the integer-valued generic value [gv] as an [int64].
Is invalid if [gv] has a bitwidth greater than [int64]. See the field
- [llvm::GenericValue::IntVal]. **)
+ [llvm::GenericValue::IntVal]. *)
val as_int64: t -> int64
end
@@ -84,69 +82,69 @@ end
module ExecutionEngine: sig
(** An execution engine is either a JIT compiler or an interpreter, capable of
directly loading an LLVM module and executing its functions without first
- invoking a static compiler and generating a native executable. **)
+ invoking a static compiler and generating a native executable. *)
type t
(** [create mp] creates a new execution engine, taking ownership of the
module provider [mp] if successful. Creates a JIT if possible, else falls
back to an interpreter. Raises [Error msg] if an error occurrs. The
execution engine is not garbage collected and must be destroyed with
- [dispose ee]. See the function [llvm::ExecutionEngine::create]. **)
+ [dispose ee]. See the function [llvm::ExecutionEngine::create]. *)
val create: Llvm.llmoduleprovider -> t
(** [create_interpreter mp] creates a new interpreter, taking ownership of the
module provider [mp] if successful. Raises [Error msg] if an error
occurrs. The execution engine is not garbage collected and must be
destroyed with [dispose ee].
- See the function [llvm::ExecutionEngine::create]. **)
+ See the function [llvm::ExecutionEngine::create]. *)
val create_interpreter: Llvm.llmoduleprovider -> t
(** [create_jit mp] creates a new JIT (just-in-time compiler), taking
ownership of the module provider [mp] if successful. Raises [Error msg] if
an error occurrs. The execution engine is not garbage collected and must
be destroyed with [dispose ee].
- See the function [llvm::ExecutionEngine::create]. **)
+ See the function [llvm::ExecutionEngine::create]. *)
val create_jit: Llvm.llmoduleprovider -> t
(** [dispose ee] releases the memory used by the execution engine and must be
- invoked to avoid memory leaks. **)
+ invoked to avoid memory leaks. *)
val dispose: t -> unit
(** [add_module_provider mp ee] adds the module provider [mp] to the execution
- engine [ee]. **)
+ engine [ee]. *)
val add_module_provider: Llvm.llmoduleprovider -> t -> unit
(** [remove_module_provider mp ee] removes the module provider [mp] from the
execution engine [ee], disposing of [mp] and the module referenced by
- [mp]. Raises [Error msg] if an error occurs. **)
+ [mp]. Raises [Error msg] if an error occurs. *)
val remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
- (** [find_function n ee] finds the function named [n] defined in any of the
+ (** [find_function n ee] finds the function named [n] defined in any of the
modules owned by the execution engine [ee]. Returns [None] if the function
- is not found and [Some f] otherwise. **)
+ is not found and [Some f] otherwise. *)
val find_function: string -> t -> Llvm.llvalue option
(** [run_function f args ee] synchronously executes the function [f] with the
- arguments [args], which must be compatible with the parameter types. **)
+ arguments [args], which must be compatible with the parameter types. *)
val run_function: Llvm.llvalue -> GenericValue.t array -> t ->
GenericValue.t
(** [run_static_ctors ee] executes the static constructors of each module in
- the execution engine [ee]. **)
+ the execution engine [ee]. *)
val run_static_ctors: t -> unit
(** [run_static_dtors ee] executes the static destructors of each module in
- the execution engine [ee]. **)
+ the execution engine [ee]. *)
val run_static_dtors: t -> unit
- (** [run_function_as_main f args env ee] executes the function [f] as a main
+ (** [run_function_as_main f args env ee] executes the function [f] as a main
function, passing it [argv] and [argc] according to the string array
- [args], and [envp] as specified by the array [env]. Returns the integer
- return value of the function. **)
+ [args], and [envp] as specified by the array [env]. Returns the integer
+ return value of the function. *)
val run_function_as_main: Llvm.llvalue -> string array ->
(string * string) array -> t -> int
(** [free_machine_code f ee] releases the memory in the execution engine [ee]
- used to store the machine code for the function [f]. **)
+ used to store the machine code for the function [f]. *)
val free_machine_code: Llvm.llvalue -> t -> unit
end
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 9d138eb08d..d69487a2df 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -120,7 +120,6 @@ external define_type_name : string -> lltype -> llmodule -> bool
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
-
(*===-- Types -------------------------------------------------------------===*)
external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index 3ed9d27329..477a0c6cb8 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -5,51 +5,53 @@
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
- *===----------------------------------------------------------------------===
- *
- * This interface provides an ocaml API for the LLVM intermediate
- * representation, the classes in the VMCore library.
- *
*===----------------------------------------------------------------------===*)
+(** Core API.
+
+ This interface provides an ocaml API for the LLVM intermediate
+ representation, the classes in the VMCore library. *)
+
+
+(** {6 Abstract types}
-(* These abstract types correlate directly to the LLVM VMCore classes. *)
+ These abstract types correlate directly to the LLVM VMCore classes. *)
(** The top-level container for all other LLVM Intermediate Representation (IR)
- objects. See the [llvm::Module] class. **)
+ objects. See the [llvm::Module] class. *)
type llmodule
(** Each value in the LLVM IR has a type, an instance of [lltype]. See the
- [llvm::Type] class. **)
-type lltype
+ [llvm::Type] class. *)
+type lltype
-(** When building recursive types using [refine_type], [lltype] values may
+(** When building recursive types using {!refine_type}, [lltype] values may
become invalid; use [lltypehandle] to resolve this problem. See the
- [llvm::AbstractTypeHolder] class. **)
+ [llvm::AbstractTypeHolder] class. *)
type lltypehandle
(** 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. **)
+ This type covers a wide range of subclasses. *)
type llvalue
-(** A basic block in LLVM IR. See the [llvm::BasicBlock] class. **)
+(** A basic block in LLVM IR. See the [llvm::BasicBlock] class. *)
type llbasicblock
(** Used to generate instructions in the LLVM IR. See the [llvm::LLVMBuilder]
- class. **)
+ class. *)
type llbuilder
(** Used to provide a module to JIT or interpreter.
- See the [llvm::ModuleProvider] class. **)
+ See the [llvm::ModuleProvider] class. *)
type llmoduleprovider
(** Used to efficiently handle large buffers of read-only binary data.
- See the [llvm::MemoryBuffer] class. **)
+ See the [llvm::MemoryBuffer] class. *)
type llmemorybuffer
-(** The kind of an [lltype], the result of [classify_type ty]. See the
- [llvm::Type::TypeID] enumeration. **)
+(** The kind of an [lltype], the result of [classify_type ty]. See the
+ [llvm::Type::TypeID] enumeration. *)
module TypeKind : sig
type t =
Void
@@ -68,8 +70,8 @@ module TypeKind : sig
| Vector
end
-(** The linkage of a global value, accessed with [linkage gv] and
- [set_linkage l gv]. See [llvm::GlobalValue::LinkageTypes]. **)
+(** The linkage of a global value, accessed with {!linkage} and
+ {!set_linkage}. See [llvm::GlobalValue::LinkageTypes]. *)
module Linkage : sig
type t =
External
@@ -83,8 +85,8 @@ module Linkage : sig
| Ghost
end
-(** The linker visibility of a global value, accessed with [visibility gv] and
- [set_visibility v gv]. See [llvm::GlobalValue::VisibilityTypes]. **)
+(** The linker visibility of a global value, accessed with {!visibility} and
+ {!set_visibility}. See [llvm::GlobalValue::VisibilityTypes]. *)
module Visibility : sig
type t =
Default
@@ -92,24 +94,24 @@ module Visibility : sig
| Protected
end
-(* The following calling convention values may be accessed with
- [function_call_conv f] and [set_function_call_conv conv f]. Calling
- conventions are open-ended. *)
+(** The following calling convention values may be accessed with
+ {!function_call_conv} and {!set_function_call_conv}. Calling
+ conventions are open-ended. *)
module CallConv : sig
- val c : int (** [c] is the C calling convention. **)
+ val c : int (** [c] is the C calling convention. *)
val fast : int (** [fast] is the calling convention to allow LLVM
maximum optimization opportunities. Use only with
- internal linkage. **)
+ internal linkage. *)
val cold : int (** [cold] is the calling convention for
- callee-save. **)
+ callee-save. *)
val x86_stdcall : int (** [x86_stdcall] is the familiar stdcall calling
- convention from C. **)
+ convention from C. *)
val x86_fastcall : int (** [x86_fastcall] is the familiar fastcall calling
- convention from C. **)
+ convention from C. *)
end
(** The predicate for an integer comparison ([icmp]) instruction.
- See the [llvm::ICmpInst::Predicate] enumeration. **)
+ See the [llvm::ICmpInst::Predicate] enumeration. *)
module Icmp : sig
type t =
| Eq
@@ -125,7 +127,7 @@ module Icmp : sig
end
(** The predicate for a floating-point comparison ([fcmp]) instruction.
- See the [llvm::FCmpInst::Predicate] enumeration. **)
+ See the [llvm::FCmpInst::Predicate] enumeration. *)
module Fcmp : sig
type t =
| False
@@ -146,47 +148,50 @@ module Fcmp : sig
| True
end
+
+(** {6 Exceptions} *)
+
exception IoError of string
-(*===-- Modules -----------------------------------------------------------===*)
+(** {6 Modules} *)
(** [create_module id] creates a module with the supplied module ID. Modules are
- not garbage collected; it is mandatory to call [dispose_module m] to free
+ not garbage collected; it is mandatory to call {!dispose_module} to free
memory. See the constructor [llvm::Module::Module]. *)
external create_module : string -> llmodule = "llvm_create_module"
(** [dispose_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]. **)
+ [llvm::Module::~Module]. *)
external dispose_module : llmodule -> unit = "llvm_dispose_module"
(** [target_triple m] is the target specifier for the module [m], something like
- [i686-apple-darwin8]. See the method [llvm::Module::getTargetTriple]. **)
+ [i686-apple-darwin8]. See the method [llvm::Module::getTargetTriple]. *)
external target_triple: llmodule -> string
= "llvm_target_triple"
(** [target_triple triple m] changes the target specifier for the module [m] to
- the string [triple]. See the method [llvm::Module::setTargetTriple]. **)
+ the string [triple]. See the method [llvm::Module::setTargetTriple]. *)
external set_target_triple: string -> llmodule -> unit
= "llvm_set_target_triple"
(** [data_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]. **)
+ method [llvm::Module::getDataLayout]. *)
external data_layout: llmodule -> string
= "llvm_data_layout"
(** [set_data_layout s m] changes the data layout specifier for the module [m]
- to the string [s]. See the method [llvm::Module::setDataLayout]. **)
+ to the string [s]. See the method [llvm::Module::setDataLayout]. *)
external set_data_layout: string -> llmodule -> unit
= "llvm_set_data_layout"
(** [define_type_name name ty m] adds a named type to the module's symbol table.
Returns [true] if successful. If such a name already exists, then no entry
is added and [false] is returned. See the [llvm::Module::addTypeName]
- method. **)
+ method. *)
external define_type_name : string -> lltype -> llmodule -> bool
= "llvm_add_type_name"
@@ -196,446 +201,455 @@ external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
-(*===-- Types -------------------------------------------------------------===*)
+(** {6 Types} *)
-(** [classify_type ty] returns the [type_kind] corresponding to the type [ty].
- See the method [llvm::Type::getTypeID]. **)
+(** [classify_type ty] returns the {!TypeKind.t} corresponding to the type [ty].
+ See the method [llvm::Type::getTypeID]. *)
external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
-(** [string_of_lltype ty] returns a string describing the type [ty]. **)
+(** [string_of_lltype ty] returns a string describing the type [ty]. *)
val string_of_lltype : lltype -> string
-(*--... Operations on integer types ........................................--*)
+(** {7 Operations on integer types} *)
-(** The 1-bit integer type. See [llvm::Type::Int1Ty]. **)
-val i1_type : lltype
+(** The 1-bit integer type. See [llvm::Type::Int1Ty]. *)
+val i1_type : lltype
-(** The 8-bit integer type. See [llvm::Type::Int8Ty]. **)
-val i8_type : lltype
+(** The 8-bit integer type. See [llvm::Type::Int8Ty]. *)
+val i8_type : lltype
-(** The 16-bit integer type. See [llvm::Type::Int16Ty]. **)
+(** The 16-bit integer type. See [llvm::Type::Int16Ty]. *)
val i16_type : lltype
-(** The 32-bit integer type. See [llvm::Type::Int32Ty]. **)
+(** The 32-bit integer type. See [llvm::Type::Int32Ty]. *)
val i32_type : lltype
-(** The 64-bit integer type. See [llvm::Type::Int64Ty]. **)
+(** The 64-bit integer type. See [llvm::Type::Int64Ty]. *)
val i64_type : lltype
(** [integer_type n] returns an integer type of bitwidth [n].
- See the method [llvm::IntegerType::get]. **)
+ See the method [llvm::IntegerType::get]. *)
external integer_type : int -> lltype = "llvm_integer_type"
-(** [integer_bitwidth ty] returns the number of bits in the integer type [ty]..
- See the method [llvm::IntegerType::getBitWidth]. **)
+(** [integer_bitwidth ty] returns the number of bits in the integer type [ty].
+ See the method [llvm::IntegerType::getBitWidth]. *)
external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth"
-(*--... Operations on real types ...........................................--*)
-(** The IEEE 32-bit floating point type. See [llvm::Type::FloatTy]. **)
+(** {7 Operations on real types} *)
+
+(** The IEEE 32-bit floating point type. See [llvm::Type::FloatTy]. *)
val float_type : lltype
-(** The IEEE 64-bit floating point type. See [llvm::Type::DoubleTy]. **)
+(** The IEEE 64-bit floating point type. See [llvm::Type::DoubleTy]. *)
val double_type : lltype
-(** The x87 80-bit floating point type. See [llvm::Type::X86_FP80Ty]. **)
+(** The x87 80-bit floating point type. See [llvm::Type::X86_FP80Ty]. *)
val x86fp80_type : lltype
-(** The IEEE 128-bit floating point type. See [llvm::Type::FP128Ty]. **)
+(** The IEEE 128-bit floating point type. See [llvm::Type::FP128Ty]. *)
val fp128_type : lltype
-(** The PowerPC 128-bit floating point type. See [llvm::Type::PPC_FP128Ty]. **)
+(** The PowerPC 128-bit floating point type. See [llvm::Type::PPC_FP128Ty]. *)
val ppc_fp128_type : lltype
-(*--... Operations on function types .......................................--*)
+
+(** {7 Operations on function types} *)
(** [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]. **)
+ See the method [llvm::FunctionType::get]. *)
external function_type : lltype -> lltype array -> lltype = "llvm_function_type"
(** [va_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]. **)
+ See the method [llvm::FunctionType::get]. *)
external var_arg_function_type : lltype -> lltype array -> lltype
= "llvm_var_arg_function_type"
(** [is_var_arg fty] returns [true] if [fty] is a varargs function type, [false]
- otherwise. See the method [llvm::FunctionType::isVarArg]. **)
+ otherwise. See the method [llvm::FunctionType::isVarArg]. *)
external is_var_arg : lltype -> bool = "llvm_is_var_arg"
(** [return_type fty] gets the return type of the function type [fty].
- See the method [llvm::FunctionType::getReturnType]. **)
+ See the method [llvm::FunctionType::getReturnType]. *)
external return_type : lltype -> lltype = "LLVMGetReturnType"
(** [param_types fty] gets the parameter types of the function type [fty].
- See the method [llvm::FunctionType::getParamType]. **)
+ See the method [llvm::FunctionType::getParamType]. *)
external param_types : lltype -> lltype array = "llvm_param_types"
-(*--... Operations on struct types .........................................--*)
+
+(** {7 Operations on struct types} *)
(** [struct_type tys] returns the structure type containing in the types in the
- array [tys]. See the method [llvm::StructType::get]. **)
+ array [tys]. See the method [llvm::StructType::get]. *)
external struct_type : lltype array -> lltype = "llvm_struct_type"
(** [struct_type tys] returns the packed structure type containing in the types
- in the array [tys]. See the method [llvm::StructType::get]. **)
+ in the array [tys]. See the method [llvm::StructType::get]. *)
external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
(** [element_types sty] returns the constituent types of the struct type [sty].
- See the method [llvm::StructType::getElementType]. **)
+ See the method [llvm::StructType::getElementType]. *)
external element_types : lltype -> lltype array = "llvm_element_types"
(** [is_packed sty] returns [true] if the structure type [sty] is packed,
- [false] otherwise. See the method [llvm::StructType::isPacked]. **)
+ [false] otherwise. See the method [llvm::StructType::isPacked]. *)
external is_packed : lltype -> bool = "llvm_is_packed"
-(*--... Operations on pointer, vector, and array types .....................--*)
+
+(** {7 Operations on pointer, vector, and array types} *)
(** [array_type ty n] returns the array type containing [n] elements of type
- [ty]. See the method [llvm::ArrayType::get]. **)
+ [ty]. See the method [llvm::ArrayType::get]. *)
external array_type : lltype -> int -> lltype = "llvm_array_type"
(** [pointer_type ty] returns the pointer type referencing objects of type
[ty] in the default address space (0).
- See the method [llvm::PointerType::getUnqual]. **)
+ See the method [llvm::PointerType::getUnqual]. *)
external pointer_type : lltype -> lltype = "llvm_pointer_type"
(** [qualified_pointer_type ty as] returns the pointer type referencing objects
of type [ty] in address space [as].
- See the method [llvm::PointerType::get]. **)
+ See the method [llvm::PointerType::get]. *)
external qualified_pointer_type : lltype -> int -> lltype
= "llvm_qualified_pointer_type"
(** [vector_type ty n] returns the array type containing [n] elements of the
- primitive type [ty]. See the method [llvm::ArrayType::get]. **)
+ primitive type [ty]. See the method [llvm::ArrayType::get]. *)
external vector_type : lltype -> int -> lltype = "llvm_vector_type"
(** [element_type ty] returns the element type of the pointer, vector, or array
- type [ty]. See the method [llvm::SequentialType::get]. **)
+ type [ty]. See the method [llvm::SequentialType::get]. *)
external element_type : lltype -> lltype = "LLVMGetElementType"
(** [element_type aty] returns the element count of the array type [aty].
- See the method [llvm::ArrayType::getNumElements]. **)
+ See the method [llvm::ArrayType::getNumElements]. *)
external array_length : lltype -> int = "llvm_array_length"
(** [address_space pty] returns the address space qualifier of the pointer type
- [pty]. See the method [llvm::PointerType::getAddressSpace]. **)
+ [pty]. See the method [llvm::PointerType::getAddressSpace]. *)
external address_space : lltype -> int = "llvm_address_space"
(** [element_type ty] returns the element count of the vector type [ty].
- See the method [llvm::VectorType::getNumElements]. **)
+ See the method [llvm::VectorType::getNumElements]. *)
external vector_size : lltype -> int = "llvm_vector_size"
-(*--... Operations on other types ..........................................--*)
+
+(** {7 Operations on other types} *)
(** [opaque_type ()] creates a new opaque type distinct from any other.
Opaque types are useful for building recursive types in combination with
- [refine_type opaque_ty ty].
- See [llvm::OpaqueType::get]. **)
+ {!refine_type} [opaque_ty ty].
+ See [llvm::OpaqueType::get]. *)
external opaque_type : unit -> lltype = "llvm_opaque_type"
(** [void_type] is the type of a function which does not return any value.
- See [llvm::Type::VoidTy]. **)
+ See [llvm::Type::VoidTy]. *)
val void_type : lltype
-(** [label_type] is the type of a basic block. See [llvm::Type::LabelTy]. **)
+(** [label_type] is the type of a basic block. See [llvm::Type::LabelTy]. *)
val label_type : lltype
-(*--... Operations on type handles .........................................--*)
+(** {7 Operations on type handles} *)
(** [handle_to_type ty] creates a handle to the type [ty]. If [ty] is later
- refined as a result of a call to [refine_type], the handle will be updated;
+ refined as a result of a call to {!refine_type}, the handle will be updated;
any bare [lltype] references will become invalid.
- See the class [llvm::PATypeHolder]. **)
+ See the class [llvm::PATypeHolder]. *)
external handle_to_type : lltype -> lltypehandle = "llvm_handle_to_type"
(** [type_of_handle tyh] resolves the type handle [tyh].
- See the method [llvm::PATypeHolder::get()]. **)
+ See the method [llvm::PATypeHolder::get()]. *)
external type_of_handle : lltypehandle -> lltype = "llvm_type_of_handle"
(** [refine_type opaque_ty ty] replaces the abstract type [opaque_ty] with the
- concrete type [ty] in all users. Warning: This may invalidate [lltype]
- values! Use [lltypehandle] to manipulate potentially abstract types. See the
- method [llvm::Type::refineAbstractType]. **)
+ concrete type [ty] in all users. Warning: This may invalidate {!lltype}
+ values! Use {!lltypehandle} to manipulate potentially abstract types. See
+ the method [llvm::Type::refineAbstractType]. *)
external refine_type : lltype -> lltype -> unit = "llvm_refine_type"
-(*===-- Values ------------------------------------------------------------===*)
+(* {6 Values} *)
(** [type_of v] returns the type of the value [v].
- See the method [llvm::Value::getType]. **)
+ See the method [llvm::Value::getType]. *)
external type_of : llvalue -> lltype = "llvm_type_of"
(** [value_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]. **)
+ See the method [llvm::Value::getName]. *)
external value_name : llvalue -> string = "llvm_value_name"
-(** [set_value_name n v] sets the name of the value [v] to [n]. See the method
- [llvm::Value::setName]. **)
+(** [set_value_name n v] sets the name of the value [v] to [n]. See the method
+ [llvm::Value::setName]. *)
external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
(** [dump_value v] prints the .ll representation of the value [v] to standard
- error. See the method [llvm::Value::dump]. **)
+ error. See the method [llvm::Value::dump]. *)
external dump_value : llvalue -> unit = "llvm_dump_value"
-(*--... Operations on constants of (mostly) any type .......................--*)
+
+(** {7 Operations on constants of (mostly) any type} *)
(** [is_constant v] returns [true] if the value [v] is a constant, [false]
- otherwise. Similar to [llvm::isa<Constant>]. **)
+ otherwise. Similar to [llvm::isa<Constant>]. *)
external is_constant : llvalue -> bool = "llvm_is_constant"
(** [const_null ty] returns the constant null (zero) of the type [ty].
- See the method [llvm::Constant::getNullValue]. **)
+ See the method [llvm::Constant::getNullValue]. *)
external const_null : lltype -> llvalue = "LLVMConstNull"
(** [const_all_ones ty] returns the constant '-1' of the integer or vector type
- [ty]. See the method [llvm::Constant::getAllOnesValue]. **)
+ [ty]. See the method [llvm::Constant::getAllOnesValue]. *)
external const_all_ones : (*int|vec*)lltype -> llvalue = "LLVMConstAllOnes"
(** [undef ty] returns the undefined value of the type [ty].
- See the method [llvm::UndefValue::get]. **)
+ See the method [llvm::UndefValue::get]. *)
external undef : lltype -> llvalue = "LLVMGetUndef"
(** [is_null v] returns [true] if the value [v] is the null (zero) value.
- See the method [llvm::Constant::isNullValue]. **)
+ See the method [llvm::Constant::isNullValue]. *)
external is_null : llvalue -> bool = "llvm_is_null"
(** [is_undef v] returns [true] if the value [v] is an undefined value, [false]
- otherwise. Similar to [llvm::isa<UndefValue>]. **)
+ otherwise. Similar to [llvm::isa<UndefValue>]. *)
external is_undef : llvalue -> bool = "llvm_is_undef"
-(*--... Operations on scalar constants .....................................--*)
+
+(** {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]. **)
+ 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]. **)
+ [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]. **)
+ value [n]. See the method [llvm::ConstantInt::get]. *)
external con