Expose initializing the native target for the execution engine.
[oota-llvm.git] / docs / tutorial / OCamlLangImpl6.html
index 780cab819142a70c29619fae6bb500dd9f8af810..2edb22edf632acc03d34594e987c561bb3183b00 100644 (file)
@@ -1173,8 +1173,9 @@ open Llvm
 
 exception Error of string
 
-let the_module = create_module "my cool jit"
-let builder = builder ()
+let context = global_context ()
+let the_module = create_module context "my cool jit"
+let builder = builder context
 let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
 
 let rec codegen_expr = function
@@ -1485,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 '<' 10;
@@ -1517,6 +1520,8 @@ let main () =
   (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
   add_cfg_simplification the_fpm;
 
+  ignore (PassManager.initialize the_fpm);
+
   (* Run the main "interpreter loop" now. *)
   Toplevel.main_loop the_fpm the_execution_engine stream;