diff options
author | Torok Edwin <edwintorok@gmail.com> | 2011-10-06 12:13:20 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2011-10-06 12:13:20 +0000 |
commit | 4917ec9ec775d7bc7fbc3362b4c576c32b7617f4 (patch) | |
tree | 4fddaddd85044a6cfccd5e06a72974c89addd3e5 /bindings | |
parent | 4f661ab0fb87f97c4a12912249c3c366df882102 (diff) |
add binding to read icmp predicate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/ocaml/llvm/llvm.ml | 2 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm.mli | 2 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm_ocaml.c | 13 |
3 files changed, 17 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml index f68ab8d842..1f7809e4da 100644 --- a/bindings/ocaml/llvm/llvm.ml +++ b/bindings/ocaml/llvm/llvm.ml @@ -705,6 +705,8 @@ external instr_end : llbasicblock -> (llbasicblock, llvalue) llrev_pos external instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos = "llvm_instr_pred" +external icmp_predicate : llvalue -> Icmp.t option = "llvm_instr_icmp_predicate" + let rec iter_instrs_range f i e = if i = e then () else match i with diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli index b4b9622b63..a5e5c850d6 100644 --- a/bindings/ocaml/llvm/llvm.mli +++ b/bindings/ocaml/llvm/llvm.mli @@ -1435,6 +1435,8 @@ val instr_pred : llvalue -> (llbasicblock, llvalue) llrev_pos val fold_right_instrs: (llvalue -> 'a -> 'a) -> llbasicblock -> 'a -> 'a +val icmp_predicate : llvalue -> Icmp.t option + (** {7 Operations on call sites} *) (** [instruction_call_conv ci] is the calling convention for the call or invoke diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index 14bdbdd068..d6849cd193 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -1010,6 +1010,19 @@ DEFINE_ITERATORS(instr, Instruction, LLVMBasicBlockRef, LLVMValueRef, LLVMGetInstructionParent) +/* llvalue -> ICmp.t */ +CAMLprim value llvm_instr_icmp_predicate(LLVMValueRef Val) { + CAMLparam0(); + int x = LLVMGetICmpPredicate(Val); + if (x) { + value Option = alloc(1, 0); + Field(Option, 0) = Val_int(x - LLVMIntEQ); + CAMLreturn(Option); + } + CAMLreturn(Val_int(0)); +} + + /*--... Operations on call sites ...........................................--*/ /* llvalue -> int */ |