diff options
Diffstat (limited to 'docs/tutorial/OCamlLangImpl5.html')
-rw-r--r-- | docs/tutorial/OCamlLangImpl5.html | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/tutorial/OCamlLangImpl5.html b/docs/tutorial/OCamlLangImpl5.html index 14f0efd..b0440ac 100644 --- a/docs/tutorial/OCamlLangImpl5.html +++ b/docs/tutorial/OCamlLangImpl5.html @@ -364,7 +364,7 @@ value as a 1-bit (bool) value.</p> let start_bb = insertion_block builder in let the_function = block_parent start_bb in - let then_bb = append_block "then" the_function in + let then_bb = append_block context "then" the_function in position_at_end then_bb builder; </pre> </div> @@ -417,7 +417,7 @@ up-to-date value for code that will set up the Phi node.</p> <div class="doc_code"> <pre> (* Emit 'else' value. *) - let else_bb = append_block "else" the_function in + let else_bb = append_block context "else" the_function in position_at_end else_bb builder; let else_val = codegen_expr else_ in @@ -433,7 +433,7 @@ the 'then' block.</p> <div class="doc_code"> <pre> (* Emit merge block. *) - let merge_bb = append_block "ifcont" the_function in + let merge_bb = append_block context "ifcont" the_function in position_at_end merge_bb builder; let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in let phi = build_phi incoming "iftmp" builder in @@ -704,7 +704,7 @@ block, but remember that the body code itself could consist of multiple blocks * block. *) let preheader_bb = insertion_block builder in let the_function = block_parent preheader_bb in - let loop_bb = append_block "loop" the_function in + let loop_bb = append_block context "loop" the_function in (* Insert an explicit fall through from the current block to the * loop_bb. *) @@ -804,7 +804,7 @@ statement.</p> <pre> (* Create the "after loop" block and insert it. *) let loop_end_bb = insertion_block builder in - let after_bb = append_block "afterloop" the_function in + let after_bb = append_block context "afterloop" the_function in (* Insert the conditional branch into the end of loop_end_bb. *) ignore (build_cond_br end_cond loop_bb after_bb builder); @@ -1204,6 +1204,7 @@ 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 double_type = double_type context let rec codegen_expr = function | Ast.Number n -> const_float double_type n @@ -1250,7 +1251,7 @@ let rec codegen_expr = function let start_bb = insertion_block builder in let the_function = block_parent start_bb in - let then_bb = append_block "then" the_function in + let then_bb = append_block context "then" the_function in (* Emit 'then' value. *) position_at_end then_bb builder; @@ -1262,7 +1263,7 @@ let rec codegen_expr = function let new_then_bb = insertion_block builder in (* Emit 'else' value. *) - let else_bb = append_block "else" the_function in + let else_bb = append_block context "else" the_function in position_at_end else_bb builder; let else_val = codegen_expr else_ in @@ -1271,7 +1272,7 @@ let rec codegen_expr = function let new_else_bb = insertion_block builder in (* Emit merge block. *) - let merge_bb = append_block "ifcont" the_function in + let merge_bb = append_block context "ifcont" the_function in position_at_end merge_bb builder; let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in let phi = build_phi incoming "iftmp" builder in @@ -1297,7 +1298,7 @@ let rec codegen_expr = function * block. *) let preheader_bb = insertion_block builder in let the_function = block_parent preheader_bb in - let loop_bb = append_block "loop" the_function in + let loop_bb = append_block context "loop" the_function in (* Insert an explicit fall through from the current block to the * loop_bb. *) @@ -1341,7 +1342,7 @@ let rec codegen_expr = function (* Create the "after loop" block and insert it. *) let loop_end_bb = insertion_block builder in - let after_bb = append_block "afterloop" the_function in + let after_bb = append_block context "afterloop" the_function in (* Insert the conditional branch into the end of loop_end_bb. *) ignore (build_cond_br end_cond loop_bb after_bb builder); @@ -1397,7 +1398,7 @@ let codegen_func the_fpm = function let the_function = codegen_proto proto in (* Create a new basic block to start insertion into. *) - let bb = append_block "entry" the_function in + let bb = append_block context "entry" the_function in position_at_end bb builder; try @@ -1462,7 +1463,7 @@ let rec main_loop the_fpm the_execution_engine stream = the_execution_engine in print_string "Evaluated to "; - print_float (GenericValue.as_float double_type result); + print_float (GenericValue.as_float Codegen.double_type result); print_newline (); with Stream.Error s | Codegen.Error s -> (* Skip token for error recovery. *) @@ -1501,16 +1502,15 @@ let main () = let stream = Lexer.lex (Stream.of_channel stdin) in (* Create the JIT. *) - let the_module_provider = ModuleProvider.create Codegen.the_module in - let the_execution_engine = ExecutionEngine.create the_module_provider in - let the_fpm = PassManager.create_function the_module_provider in + let the_execution_engine = ExecutionEngine.create Codegen.the_module in + let the_fpm = PassManager.create_function Codegen.the_module in (* Set up the optimizer pipeline. Start with registering info about how the * target lays out data structures. *) TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm; (* Do simple "peephole" optimizations and bit-twiddling optzn. *) - add_instruction_combining the_fpm; + add_instruction_combination the_fpm; (* reassociate expressions. *) add_reassociation the_fpm; @@ -1563,7 +1563,7 @@ operators</a> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ + Last modified: $Date: 2010-03-08 20:32:18 +0100 (Mon, 08 Mar 2010) $ </address> </body> </html> |