X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2Ftutorial%2FOCamlLangImpl3.html;h=a59887522ee50fe65cff685800039a45a4fa7ac2;hb=9e6d1d1f5034347d237941f1bf08fba5c1583cd3;hp=b396ef07ae5ccf6fa5b9dcb604a60c4a05a366f8;hpb=89f6d88db334ba088672ae0753deb7d7b7509bac;p=oota-llvm.git diff --git a/docs/tutorial/OCamlLangImpl3.html b/docs/tutorial/OCamlLangImpl3.html index b396ef07ae5..a59887522ee 100644 --- a/docs/tutorial/OCamlLangImpl3.html +++ b/docs/tutorial/OCamlLangImpl3.html @@ -26,7 +26,7 @@
  • Full Code Listing
  • -
  • Chapter 4: Adding JIT and Optimizer +
  • Chapter 4: Adding JIT and Optimizer Support
  • @@ -95,8 +95,8 @@ an undeclared parameter):

     exception Error of string
     
    -let the_module = create_module "my cool jit"
    -let builder = builder ()
    +let the_module = create_module (global_context ()) "my cool jit"
    +let builder = builder (global_context ())
     let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
     
    @@ -148,7 +148,7 @@ internally (APFloat has the capability of holding floating point constants of Arbitrary Precision). This code basically just creates and returns a ConstantFP. Note that in the LLVM IR that constants are all uniqued together and shared. For this reason, the API -uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::create(..)".

    +uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::Create(..)".

    @@ -159,7 +159,7 @@ uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::create(..)".

    References to variables are also quite simple using LLVM. In the simple -version of Kaleidoscope, we assume that the variable has already been emited +version of Kaleidoscope, we assume that the variable has already been emitted somewhere and its value is available. In practice, the only values that can be in the Codegen.named_values map are function arguments. This code simply checks to see that the specified name is in the map (if not, an unknown @@ -323,7 +323,7 @@ code above.

    first, we want to allow 'extern'ing a function more than once, as long as the prototypes for the externs match (since all arguments have the same type, we just have to check that the number of arguments match). Second, we want to -allow 'extern'ing a function and then definining a body for it. This is useful +allow 'extern'ing a function and then defining a body for it. This is useful when defining mutually recursive functions.

    @@ -491,7 +491,7 @@ entry:

    Note how the parser turns the top-level expression into anonymous functions -for us. This will be handy when we add JIT +for us. This will be handy when we add JIT support in the next chapter. Also note that the code is very literally transcribed, no optimizations are being performed. We will add optimizations explicitly @@ -599,7 +599,7 @@ generated. Here you can see the big picture with all the functions referencing each other.

    This wraps up the third chapter of the Kaleidoscope tutorial. Up next, we'll -describe how to add JIT codegen and optimizer +describe how to add JIT codegen and optimizer support to this so we can actually start running code!

    @@ -899,8 +899,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