[llvm] ece6d8e - [OCaml] Add missing TypeKinds, Opcode, and AtomicRMWBinOps

Josh Berdine via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 08:42:52 PDT 2021


Author: Josh Berdine
Date: 2021-03-16T15:32:38Z
New Revision: ece6d8e72eaab1ce6b37c4f658d75ed787181174

URL: https://github.com/llvm/llvm-project/commit/ece6d8e72eaab1ce6b37c4f658d75ed787181174
DIFF: https://github.com/llvm/llvm-project/commit/ece6d8e72eaab1ce6b37c4f658d75ed787181174.diff

LOG: [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

Added: 
    

Modified: 
    llvm/bindings/ocaml/llvm/llvm.ml
    llvm/bindings/ocaml/llvm/llvm.mli
    llvm/bindings/ocaml/llvm/llvm_ocaml.c

Removed: 
    


################################################################################
diff  --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml
index 723ac66ffd05..b1065d770867 100644
--- a/llvm/bindings/ocaml/llvm/llvm.ml
+++ b/llvm/bindings/ocaml/llvm/llvm.ml
@@ -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

diff  --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli
index ba9e6c1f2120..19ff22ef33e8 100644
--- a/llvm/bindings/ocaml/llvm/llvm.mli
+++ b/llvm/bindings/ocaml/llvm/llvm.mli
@@ -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].

diff  --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
index 5845783278d9..1d68eb5e6d42 100644
--- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -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);
 }
 


        


More information about the llvm-commits mailing list