[PATCH] D98578: [OCaml] Add missing TypeKinds, Opcode, and AtomicRMWBinOps

Josh Berdine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 13 04:41:34 PST 2021


jberdine created this revision.
jberdine added a reviewer: whitequark.
jberdine requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98578

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


Index: llvm/bindings/ocaml/llvm/llvm_ocaml.c
===================================================================
--- llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -1534,7 +1534,7 @@
   if (!LLVMIsAInstruction(Inst))
       failwith("Not an instruction");
   o = LLVMGetInstructionOpcode(Inst);
-  assert (o <= LLVMCallBr);
+  assert (o <= LLVMFreeze);
   return Val_int(o);
 }
 
Index: llvm/bindings/ocaml/llvm/llvm.mli
===================================================================
--- llvm/bindings/ocaml/llvm/llvm.mli
+++ llvm/bindings/ocaml/llvm/llvm.mli
@@ -77,6 +77,8 @@
   | Metadata
   | X86_mmx
   | Token
+  | ScalableVector
+  | BFloat
 end
 
 (** The linkage of a global value, accessed with {!linkage} and
@@ -268,6 +270,7 @@
   | CatchSwitch
   | FNeg
   | CallBr
+  | Freeze
 end
 
 (** The type of a clause of a [landingpad] instruction.
@@ -319,6 +322,8 @@
   | Min
   | UMax
   | UMin
+  | FAdd
+  | FSub
 end
 
 (** The kind of an [llvalue], the result of [classify_value v].
Index: llvm/bindings/ocaml/llvm/llvm.ml
===================================================================
--- llvm/bindings/ocaml/llvm/llvm.ml
+++ llvm/bindings/ocaml/llvm/llvm.ml
@@ -42,6 +42,8 @@
   | Metadata
   | X86_mmx
   | Token
+  | ScalableVector
+  | BFloat
 end
 
 module Linkage = struct
@@ -246,6 +248,7 @@
   | CatchSwitch
   | FNeg
   | CallBr
+  | Freeze
 end
 
 module LandingPadClauseTy = struct
@@ -288,6 +291,8 @@
   | Min
   | UMax
   | UMin
+  | FAdd
+  | FSub
 end
 
 module ValueKind = struct


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98578.330442.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210313/d5f9f9bb/attachment.bin>


More information about the llvm-commits mailing list