[PATCH] D52204: [OCaml] Add OCaml APIs for Invoke arguments and destinations

whitequark via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 18:51:23 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342433: [OCaml] Add OCaml APIs for Invoke arguments and destinations (authored by whitequark, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D52204

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


Index: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
===================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
@@ -1599,6 +1599,11 @@
 
 /*--... Operations on call instructions (only) .............................--*/
 
+/* llvalue -> int */
+CAMLprim value llvm_num_arg_operands(LLVMValueRef V) {
+  return Val_int(LLVMGetNumArgOperands(V));
+}
+
 /* llvalue -> bool */
 CAMLprim value llvm_is_tail_call(LLVMValueRef CallInst) {
   return Val_bool(LLVMIsTailCall(CallInst));
Index: llvm/trunk/bindings/ocaml/llvm/llvm.ml
===================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.ml
+++ llvm/trunk/bindings/ocaml/llvm/llvm.ml
@@ -1052,9 +1052,12 @@
 let remove_string_call_site_attr f k i =
   llvm_remove_string_call_site_attr f k (AttrIndex.to_int i)
 
-(*--... Operations on call instructions (only) .............................--*)
+(*--... Operations on call and invoke instructions (only) ..................--*)
+external num_arg_operands : llvalue -> int = "llvm_num_arg_operands"
 external is_tail_call : llvalue -> bool = "llvm_is_tail_call"
 external set_tail_call : bool -> llvalue -> unit = "llvm_set_tail_call"
+external get_normal_dest : llvalue -> llbasicblock = "LLVMGetNormalDest"
+external get_unwind_dest : llvalue -> llbasicblock = "LLVMGetUnwindDest"
 
 (*--... Operations on load/store instructions (only) .......................--*)
 external is_volatile : llvalue -> bool = "llvm_is_volatile"
Index: llvm/trunk/bindings/ocaml/llvm/llvm.mli
===================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.mli
+++ llvm/trunk/bindings/ocaml/llvm/llvm.mli
@@ -1832,7 +1832,12 @@
 val remove_string_call_site_attr : llvalue -> string -> AttrIndex.t -> unit
 
 
-(** {7 Operations on call instructions (only)} *)
+(** {7 Operations on call and invoke instructions (only)} *)
+
+(** [num_arg_operands ci] returns the number of arguments for the call or
+    invoke instruction [ci].  See the method
+    [llvm::CallInst::getNumArgOperands]. *)
+val num_arg_operands : llvalue -> int
 
 (** [is_tail_call ci] is [true] if the call instruction [ci] is flagged as
     eligible for tail call optimization, [false] otherwise.
@@ -1844,6 +1849,14 @@
     See the method [llvm::CallInst::setTailCall]. *)
 val set_tail_call : bool -> llvalue -> unit
 
+(** [get_normal_dest ii] is the normal destination basic block of an invoke
+    instruction. See the method [llvm::InvokeInst::getNormalDest()]. *)
+val get_normal_dest : llvalue -> llbasicblock
+
+(** [get_unwind_dest ii] is the unwind destination basic block of an invoke
+    instruction. See the method [llvm::InvokeInst::getUnwindDest()]. *)
+val get_unwind_dest : llvalue -> llbasicblock
+
 
 (** {7 Operations on load/store instructions (only)} *)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52204.165880.patch
Type: text/x-patch
Size: 2921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/93459ce7/attachment.bin>


More information about the llvm-commits mailing list