Home | History | Annotate | Download | only in Chapter7

Lines Matching refs:let

9 let context = global_context ()
10 let the_module = create_module context "my cool jit"
11 let builder = builder context
12 let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
13 let double_type = double_type context
17 let create_entry_block_alloca the_function var_name =
18 let builder = builder_at context (instr_begin (entry_block the_function)) in
21 let rec codegen_expr = function
24 let v = try Hashtbl.find named_values name with
30 let operand = codegen_expr operand in
31 let callee = "unary" ^ (String.make 1 op) in
32 let callee =
43 let name =
50 let val_ = codegen_expr rhs in
53 let variable = try Hashtbl.find named_values name with
59 let lhs_val = codegen_expr lhs in
60 let rhs_val = codegen_expr rhs in
68 let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
73 let callee = "binary" ^ (String.make 1 op) in
74 let callee =
84 let callee =
89 let params = params callee in
94 let args = Array.map codegen_expr args in
97 let cond = codegen_expr cond in
100 let zero = const_float double_type 0.0 in
101 let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
105 let start_bb = insertion_block builder in
106 let the_function = block_parent start_bb in
108 let then_bb = append_block context "then" the_function in
112 let then_val = codegen_expr then_ in
117 let new_then_bb = insertion_block builder in
120 let else_bb = append_block context "else" the_function in
122 let else_val = codegen_expr else_ in
126 let new_else_bb = insertion_block builder in
129 let merge_bb = append_block context "ifcont" the_function in
131 let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
132 let phi = build_phi incoming "iftmp" builder in
168 let the_function = block_parent (insertion_block builder) in
171 let alloca = create_entry_block_alloca the_function var_name in
174 let start_val = codegen_expr start in
181 let loop_bb = append_block context "loop" the_function in
193 let old_val =
204 let step_val =
212 let end_cond = codegen_expr end_ in
216 let cur_var = build_load alloca var_name builder in
217 let next_var = build_add cur_var step_val "nextvar" builder in
221 let zero = const_float double_type 0.0 in
222 let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
225 let after_bb = append_block context "afterloop" the_function in
242 let old_bindings = ref [] in
244 let the_function = block_parent (insertion_block builder) in
253 let init_val =
260 let alloca = create_entry_block_alloca the_function var_name in
267 let old_value = Hashtbl.find named_values var_name in
277 let body_val = codegen_expr body in
287 let codegen_proto = function
290 let doubles = Array.make (Array.length args) double_type in
291 let ft = function_type double_type doubles in
292 let f =
311 let n = args.(i) in
319 let create_argument_allocas the_function proto =
320 let args = match proto with
324 let var_name = args.(i) in
326 let alloca = create_entry_block_alloca the_function var_name in
335 let codegen_func the_fpm = function
338 let the_function = codegen_proto proto in
343 let op = name.[String.length name - 1] in
349 let bb = append_block context "entry" the_function in
356 let ret_val = codegen_expr body in
359 let _ = build_ret ret_val builder in
365 let _ = PassManager.run_function the_function the_fpm in