diff options
Diffstat (limited to 'bindings/ocaml/llvm/llvm_ocaml.c')
-rw-r--r-- | bindings/ocaml/llvm/llvm_ocaml.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index dd37e3e978..342d890e74 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -536,6 +536,29 @@ CAMLprim value llvm_set_function_call_conv(value Id, LLVMValueRef Fn) { return Val_unit; } +/* llvalue -> string option */ +CAMLprim value llvm_collector(LLVMValueRef Fn) { + const char *Collector; + CAMLparam0(); + CAMLlocal2(Name, Option); + + if ((Collector = LLVMGetCollector(Fn))) { + Name = copy_string(Collector); + + Option = alloc(1, 0); + Field(Option, 0) = Name; + CAMLreturn(Option); + } else { + CAMLreturn(Val_int(0)); + } +} + +/* string option -> llvalue -> unit */ +CAMLprim value llvm_set_collector(value GC, LLVMValueRef Fn) { + LLVMSetCollector(Fn, GC == Val_int(0)? 0 : String_val(Field(GC, 0))); + return Val_unit; +} + /*--... Operations on basic blocks .........................................--*/ /* llvalue -> llbasicblock array */ |