[PATCH] D101639: Add build_fence to OCaml bindings
Francesco Bertolaccini via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 4 23:29:47 PDT 2021
frabert updated this revision to Diff 342953.
frabert added a comment.
Remove [name] parameter
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101639/new/
https://reviews.llvm.org/D101639
Files:
llvm/bindings/ocaml/llvm/llvm.ml
llvm/bindings/ocaml/llvm/llvm.mli
llvm/bindings/ocaml/llvm/llvm_ocaml.c
llvm/test/Bindings/OCaml/core.ml
Index: llvm/test/Bindings/OCaml/core.ml
===================================================================
--- llvm/test/Bindings/OCaml/core.ml
+++ llvm/test/Bindings/OCaml/core.ml
@@ -1119,6 +1119,9 @@
* CHECK: %build_shufflevector = shufflevector <4 x i32> %Vec1, <4 x i32> %Vec2, <4 x i32> <i32 1, i32 1, i32 0, i32 0>
* CHECK: %build_insertvalue0 = insertvalue{{.*}}%bl, i32 1, 0
* CHECK: %build_extractvalue = extractvalue{{.*}}%build_insertvalue1, 1
+ * CHECK: fence seq_cst
+ * CHECK: fence acquire
+ * CHECK: fence syncscope("singlethread") release
*)
let ci = build_call fn [| p2; p1 |] "build_call" atentry in
insist (CallConv.c = instruction_call_conv ci);
@@ -1171,7 +1174,11 @@
"build_insertvalue0" atentry in
let agg1 = build_insertvalue agg0 (const_int i8_type 2) 1
"build_insertvalue1" atentry in
- ignore (build_extractvalue agg1 1 "build_extractvalue" atentry)
+ ignore (build_extractvalue agg1 1 "build_extractvalue" atentry);
+
+ ignore (build_fence AtomicOrdering.SequentiallyConsistent false atentry);
+ ignore (build_fence AtomicOrdering.Acquire false atentry);
+ ignore (build_fence AtomicOrdering.Release true atentry)
end;
group "metadata"; begin
Index: llvm/bindings/ocaml/llvm/llvm_ocaml.c
===================================================================
--- llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -2457,6 +2457,11 @@
return LLVMBuildFreeze(Builder_val(B), X, String_val(Name));
}
+/* AtomicOrdering.t -> bool -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_fence(value Ord, value ST, value B) {
+ return LLVMBuildFence(Builder_val(B), Int_val(Ord), Bool_val(ST), "");
+}
+
/*===-- Memory buffers ----------------------------------------------------===*/
/* string -> llmemorybuffer
Index: llvm/bindings/ocaml/llvm/llvm.mli
===================================================================
--- llvm/bindings/ocaml/llvm/llvm.mli
+++ llvm/bindings/ocaml/llvm/llvm.mli
@@ -2597,6 +2597,12 @@
See the method [llvm::LLVMBuilder::CreateFreeze]. *)
val build_freeze : llvalue -> string -> llbuilder -> llvalue
+(** [build_fence o st b] creates a
+ [%fence %o]
+ instruction with ordering [o] and singlethread flag set to [st] at the
+ position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateFence]. *)
+val build_fence : AtomicOrdering.t -> bool -> llbuilder -> llvalue
(** {6 Memory buffers} *)
Index: llvm/bindings/ocaml/llvm/llvm.ml
===================================================================
--- llvm/bindings/ocaml/llvm/llvm.ml
+++ llvm/bindings/ocaml/llvm/llvm.ml
@@ -1348,6 +1348,8 @@
= "llvm_build_extractvalue"
external build_insertvalue : llvalue -> llvalue -> int -> string -> llbuilder ->
llvalue = "llvm_build_insertvalue"
+external build_fence : AtomicOrdering.t -> bool -> llbuilder -> llvalue
+ = "llvm_build_fence"
external build_is_null : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_is_null"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101639.342953.patch
Type: text/x-patch
Size: 3206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210505/c5843900/attachment.bin>
More information about the llvm-commits
mailing list