diff options
| author | whitequark <whitequark@whitequark.org> | 2018-09-18 01:47:18 +0000 |
|---|---|---|
| committer | whitequark <whitequark@whitequark.org> | 2018-09-18 01:47:18 +0000 |
| commit | c296d1764c7effd666dc460dc9ccfa382fe3b4ee (patch) | |
| tree | 2accb69a130d59902bd46e065c6549cb4de99e78 /llvm/bindings | |
| parent | 1c33d14bcd6f8b4670fa62536eee5f3191677298 (diff) | |
| download | bcm5719-llvm-c296d1764c7effd666dc460dc9ccfa382fe3b4ee.tar.gz bcm5719-llvm-c296d1764c7effd666dc460dc9ccfa382fe3b4ee.zip | |
[OCaml] Add OCaml APIs for Invoke arguments and destinations
Summary:
This patch adds OCaml APIs for LLVMGetNormalDest and LLVMGetUnwindDest
on InvokeInsts, as well as LLVMGetNumArgOperands on CallInsts and
InvokeInsts.
Reviewers: whitequark
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D52204
llvm-svn: 342433
Diffstat (limited to 'llvm/bindings')
| -rw-r--r-- | llvm/bindings/ocaml/llvm/llvm.ml | 5 | ||||
| -rw-r--r-- | llvm/bindings/ocaml/llvm/llvm.mli | 15 | ||||
| -rw-r--r-- | llvm/bindings/ocaml/llvm/llvm_ocaml.c | 5 |
3 files changed, 23 insertions, 2 deletions
diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml index 928c82fb863..83b6b874bbc 100644 --- a/llvm/bindings/ocaml/llvm/llvm.ml +++ b/llvm/bindings/ocaml/llvm/llvm.ml @@ -1052,9 +1052,12 @@ let remove_enum_call_site_attr f k i = 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" diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli index a3a3d963c81..67a1c1aad14 100644 --- a/llvm/bindings/ocaml/llvm/llvm.mli +++ b/llvm/bindings/ocaml/llvm/llvm.mli @@ -1832,7 +1832,12 @@ val remove_enum_call_site_attr : llvalue -> llattrkind -> AttrIndex.t -> unit 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 @@ val is_tail_call : llvalue -> bool 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)} *) diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c index 893ffa43b45..9ebb48aa034 100644 --- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c +++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c @@ -1599,6 +1599,11 @@ CAMLprim value llvm_remove_string_call_site_attr(LLVMValueRef F, value Kind, /*--... 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)); |

