X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=bindings%2Focaml%2Fllvm%2Fllvm_ocaml.c;h=d8682880033b1880b8b4e1de6e7a8f4cea351716;hp=4b146332c943170f165b3429b027e4973a3ec740;hb=13fd7205fa891fbb1976778774ac8eb63d642186;hpb=e0129b55d24b9aa4539683378a60a4d51535ebce diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index 4b146332c94..d8682880033 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -25,14 +25,16 @@ #include "caml/fail.h" #include "caml/callback.h" -static void llvm_raise(value Prototype, char *Message) { - CAMLparam1(Prototype); - CAMLlocal1(CamlMessage); - - CamlMessage = copy_string(Message); +value llvm_string_of_message(char* Message) { + value String = caml_copy_string(Message); LLVMDisposeMessage(Message); - raise_with_arg(Prototype, CamlMessage); + return String; +} + +void llvm_raise(value Prototype, char *Message) { + CAMLparam1(Prototype); + raise_with_arg(Prototype, llvm_string_of_message(Message)); CAMLnoreturn; } @@ -955,6 +957,17 @@ CAMLprim value llvm_set_visibility(value Viz, LLVMValueRef Global) { return Val_unit; } +/* llvalue -> DLLStorageClass.t */ +CAMLprim value llvm_dll_storage_class(LLVMValueRef Global) { + return Val_int(LLVMGetDLLStorageClass(Global)); +} + +/* DLLStorageClass.t -> llvalue -> unit */ +CAMLprim value llvm_set_dll_storage_class(value Viz, LLVMValueRef Global) { + LLVMSetDLLStorageClass(Global, Int_val(Viz)); + return Val_unit; +} + /* llvalue -> int */ CAMLprim value llvm_alignment(LLVMValueRef Global) { return Val_int(LLVMGetAlignment(Global)); @@ -1577,11 +1590,12 @@ CAMLprim value llvm_position_builder(value Pos, value B) { } /* llbuilder -> llbasicblock */ -CAMLprim LLVMBasicBlockRef llvm_insertion_block(value B) { +CAMLprim value llvm_insertion_block(value B) { + CAMLparam0(); LLVMBasicBlockRef InsertBlock = LLVMGetInsertBlock(Builder_val(B)); if (!InsertBlock) - raise_not_found(); - return InsertBlock; + caml_raise_not_found(); + CAMLreturn((value) InsertBlock); } /* llvalue -> string -> llbuilder -> unit */