[OCaml] PR19859: Add functions to query and modify branches.

Patch by Gabriel Radanne <drupyog@zoho.com>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220818 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Zotov
2014-10-28 19:47:02 +00:00
parent 715eb502c3
commit 686e157176
4 changed files with 152 additions and 2 deletions

View File

@@ -1451,6 +1451,43 @@ CAMLprim value llvm_set_volatile(value IsVolatile,
return Val_unit;
}
/*--.. Operations on terminators ...........................................--*/
/* llvalue -> int -> llbasicblock */
CAMLprim LLVMBasicBlockRef llvm_successor(LLVMValueRef V, value I) {
return LLVMGetSuccessor(V, Int_val(I));
}
/* llvalue -> int -> llvalue -> unit */
CAMLprim value llvm_set_successor(LLVMValueRef U, value I, LLVMBasicBlockRef B) {
LLVMSetSuccessor(U, Int_val(I), B);
return Val_unit;
}
/* llvalue -> int */
CAMLprim value llvm_num_successors(LLVMValueRef V) {
return Val_int(LLVMGetNumSuccessors(V));
}
/*--.. Operations on branch ................................................--*/
/* llvalue -> llvalue */
CAMLprim LLVMValueRef llvm_condition(LLVMValueRef V) {
return LLVMGetCondition(V);
}
/* llvalue -> llvalue -> unit */
CAMLprim value llvm_set_condition(LLVMValueRef B, LLVMValueRef C) {
LLVMSetCondition(B, C);
return Val_unit;
}
/* llvalue -> bool */
CAMLprim value llvm_is_conditional(LLVMValueRef V) {
return Val_bool(LLVMIsConditional(V));
}
/*--... Operations on phi nodes ............................................--*/
/* (llvalue * llbasicblock) -> llvalue -> unit */