mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Chapter 5, 6, and 7 of the ocaml/kaleidoscope tutorial
and fix some tabs in chapter 3 and 4. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48978 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -183,7 +183,7 @@ variables</a>.</p>
|
||||
let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
|
||||
build_uitofp i double_type "booltmp" builder
|
||||
| _ -> raise (Error "invalid binary operator")
|
||||
end
|
||||
end
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -280,7 +280,7 @@ let codegen_proto = function
|
||||
(* Make the function type: double(double,double) etc. *)
|
||||
let doubles = Array.make (Array.length args) double_type in
|
||||
let ft = function_type double_type doubles in
|
||||
let f =
|
||||
let f =
|
||||
match lookup_function name the_module with
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -237,7 +237,7 @@ We do this by running it after our newly created function is constructed (in
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
let codegen_func the_fpm = function
|
||||
...
|
||||
...
|
||||
try
|
||||
let ret_val = codegen_expr body in
|
||||
|
||||
@@ -316,10 +316,9 @@ by adding a global variable and a call in <tt>main</tt>:</p>
|
||||
...
|
||||
let main () =
|
||||
...
|
||||
<b>
|
||||
(* Create the JIT. *)
|
||||
<b>(* Create the JIT. *)
|
||||
let the_module_provider = ModuleProvider.create Codegen.the_module in
|
||||
let the_execution_engine = ExecutionEngine.create the_module_provider in</b>
|
||||
let the_execution_engine = ExecutionEngine.create the_module_provider in</b>
|
||||
...
|
||||
</pre>
|
||||
</div>
|
||||
@@ -508,6 +507,17 @@ Here is the complete code listing for our running example, enhanced with the
|
||||
LLVM JIT and optimizer. To build this example, use:
|
||||
</p>
|
||||
|
||||
<div class="doc_code">
|
||||
<pre>
|
||||
# Compile
|
||||
ocamlbuild toy.byte
|
||||
# Run
|
||||
./toy.byte
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Here is the code:</p>
|
||||
|
||||
<dl>
|
||||
<dt>_tags:</dt>
|
||||
<dd class="doc_code">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user