Expose initializing the native target for the execution engine.
authorErick Tryzelaar <idadesub@users.sourceforge.net>
Mon, 14 Sep 2009 21:54:32 +0000 (21:54 +0000)
committerErick Tryzelaar <idadesub@users.sourceforge.net>
Mon, 14 Sep 2009 21:54:32 +0000 (21:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81800 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/ocaml/executionengine/executionengine_ocaml.c
bindings/ocaml/executionengine/llvm_executionengine.ml
bindings/ocaml/executionengine/llvm_executionengine.mli
docs/tutorial/OCamlLangImpl4.html
docs/tutorial/OCamlLangImpl5.html
docs/tutorial/OCamlLangImpl6.html
docs/tutorial/OCamlLangImpl7.html

index 647759fb074424e85c95f934bbe41a0784519823..072d583bf8fb6976e65794c822b428dab627c453 100644 (file)
 #include <string.h>
 #include <assert.h>
 
-/* Force the LLVM interpreter, JIT, and native target to be linked in. */
+/* Force the LLVM interpreter and JIT to be linked in. */
 void llvm_initialize(void) {
   LLVMLinkInInterpreter();
   LLVMLinkInJIT();
-  LLVMInitializeNativeTarget();
+}
+
+/* unit -> bool */
+CAMLprim value llvm_initialize_native_target(value Unit) {
+  return Val_bool(LLVMInitializeNativeTarget());
 }
 
 /* Can't use the recommended caml_named_value mechanism for backwards
index cf9acc7cb6b8297b4a0ea32d00f90290ea711337..c9e8f18b2240993059801abe46c171d64c726dc4 100644 (file)
@@ -109,3 +109,6 @@ module ExecutionEngine = struct
   
    *)
 end
+
+external initialize_native_target : unit -> bool
+                                  = "llvm_initialize_native_target"
index 32e2fdf65451e717eae42608540e6271c14a768f..6c2fdfb7868c45fe49c411778dbdc79fa77e9504 100644 (file)
@@ -161,3 +161,6 @@ module ExecutionEngine: sig
       [ee]. *)
   val target_data: t -> Llvm_target.TargetData.t
 end
+
+external initialize_native_target : unit -> bool
+                                  = "llvm_initialize_native_target"
index 7cd54d9beafd505f2bd39666c4aaa0b613249dd6..238fc53392d18124fe42a749a6f7e384a7f33cd9 100644 (file)
@@ -962,6 +962,8 @@ open Llvm_target
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
index bd22c5e229b4672aa564e584d3149a83a0ae6281..f19e900c00bddcf36ba4a07bff7e54ce4c4ef727 100644 (file)
@@ -1487,6 +1487,8 @@ open Llvm_target
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
index 57131883ada58ae83aa960899a4bd0471f057843..2edb22edf632acc03d34594e987c561bb3183b00 100644 (file)
@@ -1486,6 +1486,8 @@ open Llvm_target
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '&lt;' 10;
index 411e040b93d2cfaa111c68f3199ef6c01e055998..07768214b9a5a11b291ee79d2f484a1d0d19fd39 100644 (file)
@@ -1816,6 +1816,8 @@ open Llvm_target
 open Llvm_scalar_opts
 
 let main () =
+  ignore (initialize_native_target ());
+
   (* Install standard binary operators.
    * 1 is the lowest precedence. *)
   Hashtbl.add Parser.binop_precedence '=' 2;