llvm.org GIT mirror llvm / bc7d598
A couple of minor fixes to the OCaml tutorial. PR10025 and PR10316. Patches by Damien Schoof! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135293 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 8 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
9494

                  
                
9595 exception Error of string
9696
97 let the_module = create_module (global_context ()) "my cool jit"
98 let builder = builder (global_context ())
97 let context = global_context ()
98 let the_module = create_module context "my cool jit"
99 let builder = builder context
99100 let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
100101 let double_type = double_type context
101102
175176 let rhs_val = codegen_expr rhs in
176177 begin
177178 match op with
178 | '+' -> build_add lhs_val rhs_val "addtmp" builder
179 | '-' -> build_sub lhs_val rhs_val "subtmp" builder
180 | '*' -> build_mul lhs_val rhs_val "multmp" builder
179 | '+' -> build_fadd lhs_val rhs_val "addtmp" builder
180 | '-' -> build_fsub lhs_val rhs_val "subtmp" builder
181 | '*' -> build_fmul lhs_val rhs_val "multmp" builder
181182 | '<' ->
182183 (* Convert bool 0/1 to double 0.0 or 1.0 *)
183184 let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in