[OCaml] Add missing TypeKinds, Opcode, and AtomicRMWBinOps

There are several enum values that have been added to LLVM-C that are
missing from the OCaml bindings. The types defined in
bindings/ocaml/llvm/llvm.ml should be in sync with the corresponding
enum definitions in include/llvm-c/Core.h. The enum values are passed
from C to OCaml unmodified, and clients of the OCaml bindings
interpret them as tags of the corresponding OCaml types. So the only
changes needed are to add the missing constructors to the type
definitions, and to change the name of the maximum opcode in an
assertion.

Differential Revision: https://reviews.llvm.org/D98578
This commit is contained in:
Josh Berdine 2021-03-12 22:50:21 +00:00
parent ff2dd8a212
commit ece6d8e72e
3 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,9 @@ module TypeKind = struct
| Metadata
| X86_mmx
| Token
| ScalableVector
| BFloat
| X86_amx
end
module Linkage = struct
@ -246,6 +249,7 @@ module Opcode = struct
| CatchSwitch
| FNeg
| CallBr
| Freeze
end
module LandingPadClauseTy = struct
@ -288,6 +292,8 @@ module AtomicRMWBinOp = struct
| Min
| UMax
| UMin
| FAdd
| FSub
end
module ValueKind = struct

View File

@ -77,6 +77,9 @@ module TypeKind : sig
| Metadata
| X86_mmx
| Token
| ScalableVector
| BFloat
| X86_amx
end
(** The linkage of a global value, accessed with {!linkage} and
@ -268,6 +271,7 @@ module Opcode : sig
| CatchSwitch
| FNeg
| CallBr
| Freeze
end
(** The type of a clause of a [landingpad] instruction.
@ -319,6 +323,8 @@ module AtomicRMWBinOp : sig
| Min
| UMax
| UMin
| FAdd
| FSub
end
(** The kind of an [llvalue], the result of [classify_value v].

View File

@ -1541,7 +1541,7 @@ CAMLprim value llvm_instr_get_opcode(LLVMValueRef Inst) {
if (!LLVMIsAInstruction(Inst))
failwith("Not an instruction");
o = LLVMGetInstructionOpcode(Inst);
assert (o <= LLVMCallBr);
assert(o <= LLVMFreeze);
return Val_int(o);
}