summaryrefslogtreecommitdiff
path: root/bindings/ocaml
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2014-06-07 15:15:10 +0000
committerPeter Zotov <whitequark@whitequark.org>2014-06-07 15:15:10 +0000
commitc49250087a7273bd02f23ab569c240ea2ae7f9cf (patch)
tree5d4da951036383442247e3371ae9d4d4d5992a36 /bindings/ocaml
parent68caf1727f809804b4fcfcefd475490fef9d304d (diff)
downloadllvm-c49250087a7273bd02f23ab569c240ea2ae7f9cf.tar.gz
llvm-c49250087a7273bd02f23ab569c240ea2ae7f9cf.tar.bz2
llvm-c49250087a7273bd02f23ab569c240ea2ae7f9cf.tar.xz
[OCaml] Introduce an llmdkind abstract type.
Patch by Gabriel Radanne. While this commit technically breaks API, no code should have supplied the integer IDs directly, and thus no code should break. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/ocaml')
-rw-r--r--bindings/ocaml/llvm/llvm.ml9
-rw-r--r--bindings/ocaml/llvm/llvm.mli9
2 files changed, 11 insertions, 7 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index d36f360bf6..39875a5ed4 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -16,6 +16,7 @@ type lluse
type llbasicblock
type llbuilder
type llmemorybuffer
+type llmdkind
module TypeKind = struct
type t =
@@ -299,7 +300,7 @@ type ('a, 'b) llrev_pos =
external create_context : unit -> llcontext = "llvm_create_context"
external dispose_context : llcontext -> unit = "llvm_dispose_context"
external global_context : unit -> llcontext = "llvm_global_context"
-external mdkind_id : llcontext -> string -> int = "llvm_mdkind_id"
+external mdkind_id : llcontext -> string -> llmdkind = "llvm_mdkind_id"
(*===-- Modules -----------------------------------------------------------===*)
external create_module : llcontext -> string -> llmodule = "llvm_create_module"
@@ -442,9 +443,9 @@ external constexpr_opcode : llvalue -> Opcode.t = "llvm_constexpr_get_opcode"
(*--... Operations on instructions .........................................--*)
external has_metadata : llvalue -> bool = "llvm_has_metadata"
-external metadata : llvalue -> int -> llvalue option = "llvm_metadata"
-external set_metadata : llvalue -> int -> llvalue -> unit = "llvm_set_metadata"
-external clear_metadata : llvalue -> int -> unit = "llvm_clear_metadata"
+external metadata : llvalue -> llmdkind -> llvalue option = "llvm_metadata"
+external set_metadata : llvalue -> llmdkind -> llvalue -> unit = "llvm_set_metadata"
+external clear_metadata : llvalue -> llmdkind -> unit = "llvm_clear_metadata"
(*--... Operations on metadata .......,.....................................--*)
external mdstring : llcontext -> string -> llvalue = "llvm_mdstring"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index e996121793..4907d4426d 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -48,6 +48,9 @@ type llbuilder
See the [llvm::MemoryBuffer] class. *)
type llmemorybuffer
+(** The kind id of metadata attached to an instruction. *)
+type llmdkind
+
(** The kind of an [lltype], the result of [classify_type ty]. See the
[llvm::Type::TypeID] enumeration. *)
module TypeKind : sig
@@ -770,15 +773,15 @@ val has_metadata : llvalue -> bool
(** [metadata i kind] optionally returns the metadata associated with the
kind [kind] in the instruction [i] See the function
[llvm::Instruction::getMetadata]. *)
-val metadata : llvalue -> int -> llvalue option
+val metadata : llvalue -> llmdkind -> llvalue option
(** [set_metadata i kind md] sets the metadata [md] of kind [kind] in the
instruction [i]. See the function [llvm::Instruction::setMetadata]. *)
-val set_metadata : llvalue -> int -> llvalue -> unit
+val set_metadata : llvalue -> llmdkind -> llvalue -> unit
(** [clear_metadata i kind] clears the metadata of kind [kind] in the
instruction [i]. See the function [llvm::Instruction::setMetadata]. *)
-val clear_metadata : llvalue -> int -> unit
+val clear_metadata : llvalue -> llmdkind -> unit
(** {7 Operations on metadata} *)