[llvm] r220843 - [OCaml] Drop support for 3.12.1 and earlier.
Peter Zotov
whitequark at whitequark.org
Wed Oct 29 01:15:55 PDT 2014
Author: whitequark
Date: Wed Oct 29 03:15:54 2014
New Revision: 220843
URL: http://llvm.org/viewvc/llvm-project?rev=220843&view=rev
Log:
[OCaml] Drop support for 3.12.1 and earlier.
In practice this means:
* Always using -g flag.
* Embedding -cclib -lstdc++ into the corresponding cma/cmxa file.
This also moves -lstdc++ in a single place.
* Using caml_named_value instead of a homegrown mechanism.
Modified:
llvm/trunk/bindings/ocaml/Makefile.ocaml
llvm/trunk/bindings/ocaml/all_backends/Makefile
llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c
llvm/trunk/bindings/ocaml/analysis/llvm_analysis.ml
llvm/trunk/bindings/ocaml/analysis/llvm_analysis.mli
llvm/trunk/bindings/ocaml/backends/META.llvm_backend.in
llvm/trunk/bindings/ocaml/backends/backend_ocaml.c
llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c
llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml
llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli
llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c
llvm/trunk/bindings/ocaml/executionengine/Makefile
llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c
llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml
llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli
llvm/trunk/bindings/ocaml/irreader/irreader_ocaml.c
llvm/trunk/bindings/ocaml/irreader/llvm_irreader.ml
llvm/trunk/bindings/ocaml/linker/linker_ocaml.c
llvm/trunk/bindings/ocaml/linker/llvm_linker.ml
llvm/trunk/bindings/ocaml/llvm/META.llvm.in
llvm/trunk/bindings/ocaml/llvm/Makefile
llvm/trunk/bindings/ocaml/llvm/llvm.ml
llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
llvm/trunk/bindings/ocaml/target/llvm_target.ml
llvm/trunk/bindings/ocaml/target/target_ocaml.c
llvm/trunk/bindings/ocaml/transforms/ipo/Makefile
llvm/trunk/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c
llvm/trunk/bindings/ocaml/transforms/vectorize/Makefile
llvm/trunk/test/Makefile
Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/trunk/bindings/ocaml/Makefile.ocaml Wed Oct 29 03:15:54 2014
@@ -61,11 +61,11 @@ ifneq ($(ObjectsO),)
OCAMLAFLAGS += $(patsubst %,-cclib %, \
$(filter-out -L$(LibDir),-l$(LIBRARYNAME) \
$(shell $(LLVM_CONFIG) --ldflags)) \
- $(UsedLibs))
+ $(UsedLibs) $(ExtraLibs))
else
OCAMLAFLAGS += $(patsubst %,-cclib %, \
$(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) --ldflags)) \
- $(UsedLibs))
+ $(UsedLibs) $(ExtraLibs))
endif
endif
@@ -481,6 +481,7 @@ printcamlvars::
$(Echo) "DestSharedLib: " '$(DestSharedLib)'
$(Echo) "UsedLibs : " '$(UsedLibs)'
$(Echo) "UsedLibNames : " '$(UsedLibNames)'
+ $(Echo) "ExtraLibs : " '$(ExtraLibs)'
.PHONY: printcamlvars build-cmis \
clean-a clean-cmis clean-cma clean-cmxa \
Modified: llvm/trunk/bindings/ocaml/all_backends/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/all_backends/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/all_backends/Makefile (original)
+++ llvm/trunk/bindings/ocaml/all_backends/Makefile Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-##===- bindings/ocaml/all_backends/Makefile ----------------------*- Makefile -*-===##
+##===- bindings/ocaml/all_backends/Makefile ----------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
#
-# This is the makefile for the Objective Caml Llvm_backends interface.
+# This is the makefile for the Objective Caml Llvm_all_backends interface.
#
##===----------------------------------------------------------------------===##
Modified: llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/analysis/analysis_ocaml.c Wed Oct 29 03:15:54 2014
@@ -20,7 +20,6 @@
#include "caml/mlvalues.h"
#include "caml/memory.h"
-
/* Llvm.llmodule -> string option */
CAMLprim value llvm_verify_module(LLVMModuleRef M) {
CAMLparam0();
Modified: llvm/trunk/bindings/ocaml/analysis/llvm_analysis.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/analysis/llvm_analysis.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/analysis/llvm_analysis.ml (original)
+++ llvm/trunk/bindings/ocaml/analysis/llvm_analysis.ml Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_analysis.ml - LLVM OCaml Interface -----------------*- C++ -*-===*
+(*===-- llvm_analysis.ml - LLVM OCaml Interface ---------------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
Modified: llvm/trunk/bindings/ocaml/analysis/llvm_analysis.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/analysis/llvm_analysis.mli?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/analysis/llvm_analysis.mli (original)
+++ llvm/trunk/bindings/ocaml/analysis/llvm_analysis.mli Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_analysis.mli - LLVM OCaml Interface ----------------*- C++ -*-===*
+(*===-- llvm_analysis.mli - LLVM OCaml Interface --------------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
Modified: llvm/trunk/bindings/ocaml/backends/META.llvm_backend.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/backends/META.llvm_backend.in?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/backends/META.llvm_backend.in (original)
+++ llvm/trunk/bindings/ocaml/backends/META.llvm_backend.in Wed Oct 29 03:15:54 2014
@@ -5,4 +5,3 @@ requires = "llvm"
archive(byte) = "llvm_ at TARGET@.cma"
archive(native) = "llvm_ at TARGET@.cmxa"
directory = "."
-linkopts = "-ccopt -lstdc++"
\ No newline at end of file
Modified: llvm/trunk/bindings/ocaml/backends/backend_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/backends/backend_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/backends/backend_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/backends/backend_ocaml.c Wed Oct 29 03:15:54 2014
@@ -19,10 +19,11 @@
#include "caml/alloc.h"
#include "caml/memory.h"
-// TODO: Figure out how to call these only for targets which support them.
-// LLVMInitialize ## target ## AsmPrinter();
-// LLVMInitialize ## target ## AsmParser();
-// LLVMInitialize ## target ## Disassembler();
+/* TODO: Figure out how to call these only for targets which support them.
+ * LLVMInitialize ## target ## AsmPrinter();
+ * LLVMInitialize ## target ## AsmParser();
+ * LLVMInitialize ## target ## Disassembler();
+ */
#define INITIALIZER1(target) \
CAMLprim value llvm_initialize_ ## target(value Unit) { \
Modified: llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c Wed Oct 29 03:15:54 2014
@@ -16,17 +16,7 @@
#include "caml/alloc.h"
#include "caml/fail.h"
#include "caml/memory.h"
-
-
-/* Can't use the recommended caml_named_value mechanism for backwards
- compatibility reasons. This is largely equivalent. */
-static value llvm_bitreader_error_exn;
-
-CAMLprim value llvm_register_bitreader_exns(value Error) {
- llvm_bitreader_error_exn = Field(Error, 0);
- register_global_root(&llvm_bitreader_error_exn);
- return Val_unit;
-}
+#include "caml/callback.h"
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
@@ -36,38 +26,29 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
-
-/*===-- Modules -----------------------------------------------------------===*/
+/*===-- BitReader --------------------------------------------------------===*/
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
-CAMLprim value llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
- CAMLparam0();
- CAMLlocal2(Variant, MessageVal);
+CAMLprim LLVMModuleRef llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
+ LLVMModuleRef M;
char *Message;
- LLVMModuleRef M;
if (LLVMGetBitcodeModuleInContext(C, MemBuf, &M, &Message))
- llvm_raise(llvm_bitreader_error_exn, Message);
+ llvm_raise(*caml_named_value("Llvm_bitreader.Error"), Message);
- CAMLreturn((value) M);
+ return M;
}
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
-CAMLprim value llvm_parse_bitcode(LLVMContextRef C,
- LLVMMemoryBufferRef MemBuf) {
- CAMLparam0();
- CAMLlocal2(Variant, MessageVal);
+CAMLprim LLVMModuleRef llvm_parse_bitcode(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
LLVMModuleRef M;
char *Message;
if (LLVMParseBitcodeInContext(C, MemBuf, &M, &Message))
- llvm_raise(llvm_bitreader_error_exn, Message);
+ llvm_raise(*caml_named_value("Llvm_bitreader.Error"), Message);
- CAMLreturn((value) M);
+ return M;
}
Modified: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml (original)
+++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_bitreader.ml - LLVM OCaml Interface ----------------*- C++ -*-===*
+(*===-- llvm_bitreader.ml - LLVM OCaml Interface --------------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
@@ -7,14 +7,13 @@
*
*===----------------------------------------------------------------------===*)
-
exception Error of string
-external register_exns : exn -> unit = "llvm_register_bitreader_exns"
-let _ = register_exns (Error "")
-
-external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
- = "llvm_get_module"
+let () = Callback.register_exception "Llvm_bitreader.Error" (Error "")
-external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
- = "llvm_parse_bitcode"
+external get_module
+ : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_get_module"
+external parse_bitcode
+ : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_parse_bitcode"
Modified: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli (original)
+++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_bitreader.mli - LLVM OCaml Interface ---------------*- C++ -*-===*
+(*===-- llvm_bitreader.mli - LLVM OCaml Interface -------------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
@@ -20,7 +20,6 @@ exception Error of string
encountered. See the function [llvm::getBitcodeModule]. *)
val get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
-
(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the
memory buffer [mb] in the context [context]. Returns [m] if successful, or
raises [Error msg] otherwise, where [msg] is a description of the error
Modified: llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c Wed Oct 29 03:15:54 2014
@@ -21,25 +21,25 @@
#include "caml/mlvalues.h"
#include "caml/memory.h"
-/*===-- Modules -----------------------------------------------------------===*/
+/*===-- BitWriter ---------------------------------------------------------===*/
/* Llvm.llmodule -> string -> bool */
-CAMLprim value llvm_write_bitcode_file(value M, value Path) {
- int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path));
- return Val_bool(res == 0);
+CAMLprim value llvm_write_bitcode_file(LLVMModuleRef M, value Path) {
+ int Result = LLVMWriteBitcodeToFile(M, String_val(Path));
+ return Val_bool(Result == 0);
}
/* ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool */
-CAMLprim value llvm_write_bitcode_to_fd(value U, value M, value FD) {
+CAMLprim value llvm_write_bitcode_to_fd(value U, LLVMModuleRef M, value FD) {
int Unbuffered;
- int res;
+ int Result;
if (U == Val_int(0)) {
Unbuffered = 0;
} else {
- Unbuffered = Bool_val(Field(U,0));
+ Unbuffered = Bool_val(Field(U, 0));
}
- res = LLVMWriteBitcodeToFD((LLVMModuleRef) M, Int_val(FD), 0, Unbuffered);
- return Val_bool(res == 0);
+ Result = LLVMWriteBitcodeToFD(M, Int_val(FD), 0, Unbuffered);
+ return Val_bool(Result == 0);
}
Modified: llvm/trunk/bindings/ocaml/executionengine/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/executionengine/Makefile (original)
+++ llvm/trunk/bindings/ocaml/executionengine/Makefile Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-##===- bindings/ocaml/executionengine/Makefile --------------*- Makefile -*-===##
+##===- bindings/ocaml/executionengine/Makefile -------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
Modified: llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/executionengine/executionengine_ocaml.c Wed Oct 29 03:15:54 2014
@@ -15,37 +15,15 @@
|* *|
\*===----------------------------------------------------------------------===*/
+#include <string.h>
+#include <assert.h>
#include "llvm-c/ExecutionEngine.h"
#include "llvm-c/Target.h"
#include "caml/alloc.h"
#include "caml/custom.h"
#include "caml/fail.h"
#include "caml/memory.h"
-#include <string.h>
-#include <assert.h>
-
-/* Force the LLVM interpreter and JIT to be linked in. */
-void llvm_initialize(void) {
- LLVMLinkInInterpreter();
- LLVMLinkInMCJIT();
-}
-
-/* unit -> bool */
-CAMLprim value llvm_initialize_native_target(value Unit) {
- return Val_bool(!LLVMInitializeNativeTarget() &&
- !LLVMInitializeNativeAsmParser() &&
- !LLVMInitializeNativeAsmPrinter());
-}
-
-/* Can't use the recommended caml_named_value mechanism for backwards
- compatibility reasons. This is largely equivalent. */
-static value llvm_ee_error_exn;
-
-CAMLprim value llvm_register_ee_exns(value Error) {
- llvm_ee_error_exn = Field(Error, 0);
- register_global_root(&llvm_ee_error_exn);
- return Val_unit;
-}
+#include "caml/callback.h"
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
@@ -55,13 +33,9 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
-
/*--... Operations on generic values .......................................--*/
#define Genericvalue_val(v) (*(LLVMGenericValueRef *)(Data_custom_val(v)))
@@ -71,15 +45,13 @@ static void llvm_finalize_generic_value(
}
static struct custom_operations generic_value_ops = {
- (char *) "LLVMGenericValue",
+ (char *) "Llvm_executionengine.GenericValue.t",
llvm_finalize_generic_value,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
- custom_deserialize_default
-#ifdef custom_compare_ext_default
- , custom_compare_ext_default
-#endif
+ custom_deserialize_default,
+ custom_compare_ext_default
};
static value alloc_generic_value(LLVMGenericValueRef Ref) {
@@ -173,12 +145,22 @@ CAMLprim value llvm_genericvalue_as_nati
/*--... Operations on execution engines ....................................--*/
+/* unit -> bool */
+CAMLprim value llvm_initialize_native_target(value Unit) {
+ LLVMLinkInInterpreter();
+ LLVMLinkInMCJIT();
+
+ return Val_bool(!LLVMInitializeNativeTarget() &&
+ !LLVMInitializeNativeAsmParser() &&
+ !LLVMInitializeNativeAsmPrinter());
+}
+
/* llmodule -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleRef M) {
LLVMExecutionEngineRef Interp;
char *Error;
if (LLVMCreateExecutionEngineForModule(&Interp, M, &Error))
- llvm_raise(llvm_ee_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
return Interp;
}
@@ -188,7 +170,7 @@ llvm_ee_create_interpreter(LLVMModuleRef
LLVMExecutionEngineRef Interp;
char *Error;
if (LLVMCreateInterpreterForModule(&Interp, M, &Error))
- llvm_raise(llvm_ee_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
return Interp;
}
@@ -198,7 +180,7 @@ llvm_ee_create_jit(LLVMModuleRef M, valu
LLVMExecutionEngineRef JIT;
char *Error;
if (LLVMCreateJITCompilerForModule(&JIT, M, Int_val(OptLevel), &Error))
- llvm_raise(llvm_ee_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
return JIT;
}
@@ -207,16 +189,18 @@ CAMLprim LLVMExecutionEngineRef
llvm_ee_create_mcjit(LLVMModuleRef M, value OptRecord) {
LLVMExecutionEngineRef MCJIT;
char *Error;
- struct LLVMMCJITCompilerOptions Options = {
- .OptLevel = Int_val(Field(OptRecord, 0)),
- .CodeModel = Int_val(Field(OptRecord, 1)),
- .NoFramePointerElim = Int_val(Field(OptRecord, 2)),
- .EnableFastISel = Int_val(Field(OptRecord, 3)),
- .MCJMM = NULL
- };
+ struct LLVMMCJITCompilerOptions Options;
+
+ LLVMInitializeMCJITCompilerOptions(&Options, sizeof(Options));
+ Options.OptLevel = Int_val(Field(OptRecord, 0));
+ Options.CodeModel = Int_val(Field(OptRecord, 1));
+ Options.NoFramePointerElim = Int_val(Field(OptRecord, 2));
+ Options.EnableFastISel = Int_val(Field(OptRecord, 3));
+ Options.MCJMM = NULL;
+
if (LLVMCreateMCJITCompilerForModule(&MCJIT, M, &Options,
sizeof(Options), &Error))
- llvm_raise(llvm_ee_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
return MCJIT;
}
@@ -238,7 +222,7 @@ CAMLprim LLVMModuleRef llvm_ee_remove_mo
LLVMModuleRef RemovedModule;
char *Error;
if (LLVMRemoveModule(EE, M, &RemovedModule, &Error))
- llvm_raise(llvm_ee_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_executionengine.Error"), Error);
return RemovedModule;
}
@@ -350,9 +334,9 @@ extern value llvm_alloc_data_layout(LLVM
CAMLprim value llvm_ee_get_data_layout(LLVMExecutionEngineRef EE) {
value DataLayout;
LLVMTargetDataRef OrigDataLayout;
- OrigDataLayout = LLVMGetExecutionEngineTargetData(EE);
-
char* TargetDataCStr;
+
+ OrigDataLayout = LLVMGetExecutionEngineTargetData(EE);
TargetDataCStr = LLVMCopyStringRepOfTargetData(OrigDataLayout);
DataLayout = llvm_alloc_data_layout(LLVMCreateTargetData(TargetDataCStr));
LLVMDisposeMessage(TargetDataCStr);
Modified: llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml (original)
+++ llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.ml Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_executionengine.ml - LLVM OCaml Interface ----------*- C++ -*-===*
+(*===-- llvm_executionengine.ml - LLVM OCaml Interface --------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
@@ -7,21 +7,18 @@
*
*===----------------------------------------------------------------------===*)
-
exception Error of string
-external register_exns: exn -> unit
- = "llvm_register_ee_exns"
-
+let () = Callback.register_exception "Llvm_executionengine.Error" (Error "")
module CodeModel = struct
type t =
- | Default
- | JIT_default
- | Small
- | Kernel
- | Medium
- | Large
+ | Default
+ | JIT_default
+ | Small
+ | Kernel
+ | Medium
+ | Large
end
module GenericValue = struct
@@ -71,14 +68,6 @@ module ExecutionEngine = struct
no_framepointer_elim = false;
enable_fast_isel = false }
- (* FIXME: Ocaml is not running this setup code unless we use 'val' in the
- interface, which causes the emission of a stub for each function;
- using 'external' in the module allows direct calls into
- ocaml_executionengine.c. This is hardly fatal, but it is unnecessary
- overhead on top of the two stubs that are already invoked for each
- call into LLVM. *)
- let _ = register_exns (Error "")
-
external create: Llvm.llmodule -> t
= "llvm_ee_create"
external create_interpreter: Llvm.llmodule -> t
Modified: llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli (original)
+++ llvm/trunk/bindings/ocaml/executionengine/llvm_executionengine.mli Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm_executionengine.mli - LLVM OCaml Interface ---------*- C++ -*-===*
+(*===-- llvm_executionengine.mli - LLVM OCaml Interface -------*- OCaml -*-===*
*
* The LLVM Compiler Infrastructure
*
@@ -10,19 +10,19 @@
(** JIT Interpreter.
This interface provides an OCaml API for LLVM execution engine (JIT/
- interpreter), the classes in the ExecutionEngine library. *)
+ interpreter), the classes in the [ExecutionEngine] library. *)
exception Error of string
(** The JIT code model. See [llvm::CodeModel::Model]. *)
module CodeModel : sig
type t =
- | Default
- | JIT_default
- | Small
- | Kernel
- | Medium
- | Large
+ | Default
+ | JIT_default
+ | Small
+ | Kernel
+ | Medium
+ | Large
end
module GenericValue: sig
Modified: llvm/trunk/bindings/ocaml/irreader/irreader_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/irreader/irreader_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/irreader/irreader_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/irreader/irreader_ocaml.c Wed Oct 29 03:15:54 2014
@@ -16,16 +16,7 @@
#include "caml/alloc.h"
#include "caml/fail.h"
#include "caml/memory.h"
-
-/* Can't use the recommended caml_named_value mechanism for backwards
- compatibility reasons. This is largely equivalent. */
-static value llvm_irreader_error_exn;
-
-CAMLprim value llvm_register_irreader_exns(value Error) {
- llvm_irreader_error_exn = Field(Error, 0);
- register_global_root(&llvm_irreader_error_exn);
- return Val_unit;
-}
+#include "caml/callback.h"
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
@@ -35,14 +26,10 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
-
-/*===-- Modules -----------------------------------------------------------===*/
+/*===-- IRReader ----------------------------------------------------------===*/
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
CAMLprim value llvm_parse_ir(LLVMContextRef C,
@@ -53,7 +40,7 @@ CAMLprim value llvm_parse_ir(LLVMContext
char *Message;
if (LLVMParseIRInContext(C, MemBuf, &M, &Message))
- llvm_raise(llvm_irreader_error_exn, Message);
+ llvm_raise(*caml_named_value("Llvm_irreader.Error"), Message);
CAMLreturn((value) M);
}
Modified: llvm/trunk/bindings/ocaml/irreader/llvm_irreader.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/irreader/llvm_irreader.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/irreader/llvm_irreader.ml (original)
+++ llvm/trunk/bindings/ocaml/irreader/llvm_irreader.ml Wed Oct 29 03:15:54 2014
@@ -10,8 +10,7 @@
exception Error of string
-external register_exns : exn -> unit = "llvm_register_irreader_exns"
-let _ = register_exns (Error "")
+let _ = Callback.register_exception "Llvm_irreader.Error" (Error "")
external parse_ir : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_ir"
Modified: llvm/trunk/bindings/ocaml/linker/linker_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/linker/linker_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/linker/linker_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/linker/linker_ocaml.c Wed Oct 29 03:15:54 2014
@@ -19,14 +19,7 @@
#include "caml/alloc.h"
#include "caml/memory.h"
#include "caml/fail.h"
-
-static value llvm_linker_error_exn;
-
-CAMLprim value llvm_register_linker_exns(value Error) {
- llvm_linker_error_exn = Field(Error, 0);
- register_global_root(&llvm_linker_error_exn);
- return Val_unit;
-}
+#include "caml/callback.h"
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
@@ -36,19 +29,15 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
-/* llmodule -> llmodule -> Mode.t -> unit
- raises Error msg on error */
+/* llmodule -> llmodule -> Mode.t -> unit */
CAMLprim value llvm_link_modules(LLVMModuleRef Dst, LLVMModuleRef Src, value Mode) {
char* Message;
if (LLVMLinkModules(Dst, Src, Int_val(Mode), &Message))
- llvm_raise(llvm_linker_error_exn, Message);
+ llvm_raise(*caml_named_value("Llvm_linker.Error"), Message);
return Val_unit;
}
Modified: llvm/trunk/bindings/ocaml/linker/llvm_linker.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/linker/llvm_linker.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/linker/llvm_linker.ml (original)
+++ llvm/trunk/bindings/ocaml/linker/llvm_linker.ml Wed Oct 29 03:15:54 2014
@@ -9,8 +9,7 @@
exception Error of string
-external register_exns : exn -> unit = "llvm_register_linker_exns"
-let _ = register_exns (Error "")
+let () = Callback.register_exception "Llvm_linker.Error" (Error "")
module Mode = struct
type t =
@@ -19,4 +18,4 @@ module Mode = struct
end
external link_modules : Llvm.llmodule -> Llvm.llmodule -> Mode.t -> unit
- = "llvm_link_modules"
\ No newline at end of file
+ = "llvm_link_modules"
Modified: llvm/trunk/bindings/ocaml/llvm/META.llvm.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/META.llvm.in?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/META.llvm.in (original)
+++ llvm/trunk/bindings/ocaml/llvm/META.llvm.in Wed Oct 29 03:15:54 2014
@@ -4,7 +4,6 @@ description = "LLVM OCaml bindings"
archive(byte) = "llvm.cma"
archive(native) = "llvm.cmxa"
directory = "."
-linkopts = "-ccopt -lstdc++"
package "analysis" (
requires = "llvm"
Modified: llvm/trunk/bindings/ocaml/llvm/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/Makefile (original)
+++ llvm/trunk/bindings/ocaml/llvm/Makefile Wed Oct 29 03:15:54 2014
@@ -15,6 +15,7 @@ LEVEL := ../../..
LIBRARYNAME := llvm
UsedComponents := core
UsedOcamlLibs := llvm
+ExtraLibs := -lstdc++
include ../Makefile.ocaml
Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-(*===-- llvm/llvm.ml - LLVM Ocaml Interface --------------------------------===*
+(*===-- llvm/llvm.ml - LLVM OCaml Interface -------------------------------===*
*
* The LLVM Compiler Infrastructure
*
@@ -278,8 +278,7 @@ end
exception IoError of string
-external register_exns : exn -> unit = "llvm_register_core_exns"
-let _ = register_exns (IoError "")
+let () = Callback.register_exception "Llvm.IoError" (IoError "")
external install_fatal_error_handler : (string -> unit) -> unit
= "llvm_install_fatal_error_handler"
Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Oct 29 03:15:54 2014
@@ -15,27 +15,15 @@
|* *|
\*===----------------------------------------------------------------------===*/
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
#include "llvm-c/Core.h"
#include "caml/alloc.h"
#include "caml/custom.h"
#include "caml/memory.h"
#include "caml/fail.h"
#include "caml/callback.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* Can't use the recommended caml_named_value mechanism for backwards
- compatibility reasons. This is largely equivalent. */
-static value llvm_ioerror_exn;
-
-CAMLprim value llvm_register_core_exns(value IoError) {
- llvm_ioerror_exn = Field(IoError, 0);
- register_global_root(&llvm_ioerror_exn);
-
- return Val_unit;
-}
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
@@ -45,10 +33,7 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
static value llvm_fatal_error_handler;
@@ -186,22 +171,24 @@ CAMLprim value llvm_dump_module(LLVMModu
/* string -> llmodule -> unit */
CAMLprim value llvm_print_module(value Filename, LLVMModuleRef M) {
char* Message;
- if(LLVMPrintModuleToFile(M, String_val(Filename), &Message)) {
- llvm_raise(llvm_ioerror_exn, Message);
- }
+
+ if(LLVMPrintModuleToFile(M, String_val(Filename), &Message))
+ llvm_raise(*caml_named_value("Llvm.IoError"), Message);
return Val_unit;
}
/* llmodule -> string */
CAMLprim value llvm_string_of_llmodule(LLVMModuleRef M) {
+ CAMLparam0();
+ CAMLlocal1(ModuleStr);
char* ModuleCStr;
- ModuleCStr = LLVMPrintModuleToString(M);
- value ModuleStr = caml_copy_string(ModuleCStr);
+ ModuleCStr = LLVMPrintModuleToString(M);
+ ModuleStr = caml_copy_string(ModuleCStr);
LLVMDisposeMessage(ModuleCStr);
- return ModuleStr;
+ CAMLreturn(ModuleStr);
}
/* llmodule -> string -> unit */
@@ -234,13 +221,15 @@ CAMLprim value llvm_dump_type(LLVMTypeRe
/* lltype -> string */
CAMLprim value llvm_string_of_lltype(LLVMTypeRef M) {
+ CAMLparam0();
+ CAMLlocal1(TypeStr);
char* TypeCStr;
- TypeCStr = LLVMPrintTypeToString(M);
- value TypeStr = caml_copy_string(TypeCStr);
+ TypeCStr = LLVMPrintTypeToString(M);
+ TypeStr = caml_copy_string(TypeCStr);
LLVMDisposeMessage(TypeCStr);
- return TypeStr;
+ CAMLreturn(TypeStr);
}
/*--... Operations on integer types ........................................--*/
@@ -554,13 +543,15 @@ CAMLprim value llvm_dump_value(LLVMValue
/* llvalue -> string */
CAMLprim value llvm_string_of_llvalue(LLVMValueRef M) {
+ CAMLparam0();
+ CAMLlocal1(ValueStr);
char* ValueCStr;
- ValueCStr = LLVMPrintValueToString(M);
- value ValueStr = caml_copy_string(ValueCStr);
+ ValueCStr = LLVMPrintValueToString(M);
+ ValueStr = caml_copy_string(ValueCStr);
LLVMDisposeMessage(ValueCStr);
- return ValueStr;
+ CAMLreturn(ValueStr);
}
/* llvalue -> llvalue -> unit */
@@ -738,16 +729,22 @@ CAMLprim LLVMValueRef llvm_const_float(L
/* llvalue -> float */
CAMLprim value llvm_float_of_const(LLVMValueRef Const)
{
+ CAMLparam0();
+ CAMLlocal1(Option);
+ LLVMBool LosesInfo;
+ double Result;
+
if (LLVMIsAConstantFP(Const)) {
- LLVMBool LosesInfo;
- double res = LLVMConstRealGetDouble(Const, &LosesInfo);
+ Result = LLVMConstRealGetDouble(Const, &LosesInfo);
if (LosesInfo)
return Val_int(0);
- value Option = alloc(1, 0);
- Field(Option, 0) = caml_copy_double(res);
- return Option;
+
+ Option = alloc(1, 0);
+ Field(Option, 0) = caml_copy_double(Result);
+ CAMLreturn(Option);
}
- return Val_int(0);
+
+ CAMLreturn(Val_int(0));
}
/* lltype -> string -> llvalue */
@@ -1536,15 +1533,13 @@ static void llvm_finalize_builder(value
}
static struct custom_operations builder_ops = {
- (char *) "LLVMIRBuilder",
+ (char *) "Llvm.llbuilder",
llvm_finalize_builder,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
- custom_deserialize_default
-#ifdef custom_compare_ext_default
- , custom_compare_ext_default
-#endif
+ custom_deserialize_default,
+ custom_compare_ext_default
};
static value alloc_builder(LLVMBuilderRef B) {
@@ -2254,7 +2249,7 @@ CAMLprim value llvm_memorybuffer_of_file
if (LLVMCreateMemoryBufferWithContentsOfFile(String_val(Path),
&MemBuf, &Message))
- llvm_raise(llvm_ioerror_exn, Message);
+ llvm_raise(*caml_named_value("Llvm.IoError"), Message);
CAMLreturn((value) MemBuf);
}
@@ -2266,20 +2261,21 @@ CAMLprim LLVMMemoryBufferRef llvm_memory
LLVMMemoryBufferRef MemBuf;
if (LLVMCreateMemoryBufferWithSTDIN(&MemBuf, &Message))
- llvm_raise(llvm_ioerror_exn, Message);
+ llvm_raise(*caml_named_value("Llvm.IoError"), Message);
return MemBuf;
}
/* ?name:string -> string -> llmemorybuffer */
CAMLprim LLVMMemoryBufferRef llvm_memorybuffer_of_string(value Name, value String) {
+ LLVMMemoryBufferRef MemBuf;
const char *NameCStr;
+
if(Name == Val_int(0))
NameCStr = "";
else
NameCStr = String_val(Field(Name, 0));
- LLVMMemoryBufferRef MemBuf;
MemBuf = LLVMCreateMemoryBufferWithMemoryRangeCopy(
String_val(String), caml_string_length(String), NameCStr);
Modified: llvm/trunk/bindings/ocaml/target/llvm_target.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/target/llvm_target.ml?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/target/llvm_target.ml (original)
+++ llvm/trunk/bindings/ocaml/target/llvm_target.ml Wed Oct 29 03:15:54 2014
@@ -47,8 +47,7 @@ end
exception Error of string
-external register_exns : exn -> unit = "llvm_register_target_exns"
-let _ = register_exns (Error "")
+let () = Callback.register_exception "Llvm_target.Error" (Error "")
module DataLayout = struct
type t
Modified: llvm/trunk/bindings/ocaml/target/target_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/target/target_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/target/target_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/target/target_ocaml.c Wed Oct 29 03:15:54 2014
@@ -21,17 +21,10 @@
#include "caml/fail.h"
#include "caml/memory.h"
#include "caml/custom.h"
+#include "caml/callback.h"
/*===---- Exceptions ------------------------------------------------------===*/
-static value llvm_target_error_exn;
-
-CAMLprim value llvm_register_target_exns(value Error) {
- llvm_target_error_exn = Field(Error, 0);
- register_global_root(&llvm_target_error_exn);
- return Val_unit;
-}
-
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
CAMLlocal1(CamlMessage);
@@ -40,10 +33,7 @@ static void llvm_raise(value Prototype,
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
- abort(); /* NOTREACHED */
-#ifdef CAMLnoreturn
- CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
-#endif
+ CAMLnoreturn;
}
static value llvm_string_of_message(char* Message) {
@@ -62,15 +52,13 @@ static void llvm_finalize_data_layout(va
}
static struct custom_operations llvm_data_layout_ops = {
- (char *) "LLVMDataLayout",
+ (char *) "Llvm_target.DataLayout.t",
llvm_finalize_data_layout,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
- custom_deserialize_default
-#ifdef custom_compare_ext_default
- , custom_compare_ext_default
-#endif
+ custom_deserialize_default,
+ custom_compare_ext_default
};
value llvm_alloc_data_layout(LLVMTargetDataRef DataLayout) {
@@ -219,7 +207,7 @@ CAMLprim LLVMTargetRef llvm_target_by_tr
char *Error;
if(LLVMGetTargetFromTriple(String_val(Triple), &T, &Error))
- llvm_raise(llvm_target_error_exn, Error);
+ llvm_raise(*caml_named_value("Llvm_target.Error"), Error);
return T;
}
@@ -258,15 +246,13 @@ static void llvm_finalize_target_machine
}
static struct custom_operations llvm_target_machine_ops = {
- (char *) "LLVMTargetMachine",
+ (char *) "Llvm_target.TargetMachine.t",
llvm_finalize_target_machine,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
- custom_deserialize_default
-#ifdef custom_compare_ext_default
- , custom_compare_ext_default
-#endif
+ custom_deserialize_default,
+ custom_compare_ext_default
};
static value llvm_alloc_targetmachine(LLVMTargetMachineRef Machine) {
@@ -337,6 +323,7 @@ CAMLprim value llvm_targetmachine_featur
CAMLprim value llvm_targetmachine_data_layout(value Machine) {
CAMLparam1(Machine);
CAMLlocal1(DataLayout);
+ char *TargetDataCStr;
/* LLVMGetTargetMachineData returns a pointer owned by the TargetMachine,
so it is impossible to wrap it with llvm_alloc_target_data, which assumes
@@ -344,7 +331,6 @@ CAMLprim value llvm_targetmachine_data_l
LLVMTargetDataRef OrigDataLayout;
OrigDataLayout = LLVMGetTargetMachineData(TargetMachine_val(Machine));
- char* TargetDataCStr;
TargetDataCStr = LLVMCopyStringRepOfTargetData(OrigDataLayout);
DataLayout = llvm_alloc_data_layout(LLVMCreateTargetData(TargetDataCStr));
LLVMDisposeMessage(TargetDataCStr);
@@ -361,12 +347,12 @@ CAMLprim value llvm_targetmachine_set_ve
/* Llvm.llmodule -> CodeGenFileType.t -> string -> TargetMachine.t -> unit */
CAMLprim value llvm_targetmachine_emit_to_file(LLVMModuleRef Module,
value FileType, value FileName, value Machine) {
- char* ErrorMessage;
+ char *ErrorMessage;
if(LLVMTargetMachineEmitToFile(TargetMachine_val(Machine), Module,
String_val(FileName), Int_val(FileType),
&ErrorMessage)) {
- llvm_raise(llvm_target_error_exn, ErrorMessage);
+ llvm_raise(*caml_named_value("Llvm_target.Error"), ErrorMessage);
}
return Val_unit;
@@ -377,13 +363,13 @@ CAMLprim value llvm_targetmachine_emit_t
CAMLprim LLVMMemoryBufferRef llvm_targetmachine_emit_to_memory_buffer(
LLVMModuleRef Module, value FileType,
value Machine) {
- char* ErrorMessage;
+ char *ErrorMessage;
LLVMMemoryBufferRef Buffer;
if(LLVMTargetMachineEmitToMemoryBuffer(TargetMachine_val(Machine), Module,
Int_val(FileType), &ErrorMessage,
&Buffer)) {
- llvm_raise(llvm_target_error_exn, ErrorMessage);
+ llvm_raise(*caml_named_value("Llvm_target.Error"), ErrorMessage);
}
return Buffer;
Modified: llvm/trunk/bindings/ocaml/transforms/ipo/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/ipo/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/ipo/Makefile (original)
+++ llvm/trunk/bindings/ocaml/transforms/ipo/Makefile Wed Oct 29 03:15:54 2014
@@ -1,4 +1,4 @@
-##===- bindings/ocaml/transforms/scalar/Makefile -----------*- Makefile -*-===##
+##===- bindings/ocaml/transforms/ipo/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
#
-# This is the makefile for the Objective Caml Llvm_scalar_opts interface.
+# This is the makefile for the Objective Caml Llvm_ipo interface.
#
##===----------------------------------------------------------------------===##
Modified: llvm/trunk/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c Wed Oct 29 03:15:54 2014
@@ -27,15 +27,13 @@ static void llvm_finalize_pmbuilder(valu
}
static struct custom_operations pmbuilder_ops = {
- (char *) "LLVMPassManagerBuilder",
+ (char *) "Llvm_passmgr_builder.t",
llvm_finalize_pmbuilder,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
- custom_deserialize_default
-#ifdef custom_compare_ext_default
- , custom_compare_ext_default
-#endif
+ custom_deserialize_default,
+ custom_compare_ext_default
};
static value alloc_pmbuilder(LLVMPassManagerBuilderRef Ref) {
Modified: llvm/trunk/bindings/ocaml/transforms/vectorize/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/transforms/vectorize/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/transforms/vectorize/Makefile (original)
+++ llvm/trunk/bindings/ocaml/transforms/vectorize/Makefile Wed Oct 29 03:15:54 2014
@@ -7,7 +7,7 @@
#
##===----------------------------------------------------------------------===##
#
-# This is the makefile for the Objective Caml Llvm_vectorize_opts interface.
+# This is the makefile for the Objective Caml Llvm_vectorize interface.
#
##===----------------------------------------------------------------------===##
Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=220843&r1=220842&r2=220843&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Wed Oct 29 03:15:54 2014
@@ -129,7 +129,7 @@ lit.site.cfg: FORCE
@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
@$(ECHOPATH) s=@OCAMLC@=$(OCAMLC)=g >> lit.tmp
@$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT)=g >> lit.tmp
- @$(ECHOPATH) s=@OCAMLFLAGS@=-cclib -lstdc++ -cclib -L$(LibDir) -I $(LibDir)/ocaml $(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp
+ @$(ECHOPATH) s=@OCAMLFLAGS@=-cclib -L$(LibDir) -I $(LibDir)/ocaml $(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp
@$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp
@$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp
@$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp
More information about the llvm-commits
mailing list