Skip to content

Commit

Permalink
Expose initializing the native target for the execution engine.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81800 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Erick Tryzelaar committed Sep 14, 2009
1 parent 126d86b commit 4626268
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bindings/ocaml/executionengine/executionengine_ocaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
#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
Expand Down
3 changes: 3 additions & 0 deletions bindings/ocaml/executionengine/llvm_executionengine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@ module ExecutionEngine = struct

*)
end

external initialize_native_target : unit -> bool
= "llvm_initialize_native_target"
3 changes: 3 additions & 0 deletions bindings/ocaml/executionengine/llvm_executionengine.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions docs/tutorial/OCamlLangImpl4.html
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@
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;
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/OCamlLangImpl5.html
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,8 @@
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;
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/OCamlLangImpl6.html
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,8 @@
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;
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/OCamlLangImpl7.html
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,8 @@
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;
Expand Down

0 comments on commit 4626268

Please sign in to comment.