Home | History | Annotate | Download | only in Chapter6

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
15 let rec codegen_expr = function
21 let operand = codegen_expr operand in
22 let callee = "unary" ^ (String.make 1 op) in
23 let callee =
30 let lhs_val = codegen_expr lhs in
31 let rhs_val = codegen_expr rhs in
39 let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
44 let callee = "binary" ^ (String.make 1 op) in
45 let callee =
54 let callee =
59 let params = params callee in
64 let args = Array.map codegen_expr args in
67 let cond = codegen_expr cond in
70 let zero = const_float double_type 0.0 in
71 let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
75 let start_bb = insertion_block builder in
76 let the_function = block_parent start_bb in
78 let then_bb = append_block context "then" the_function in
82 let then_val = codegen_expr then_ in
87 let new_then_bb = insertion_block builder in
90 let else_bb = append_block context "else" the_function in
92 let else_val = codegen_expr else_ in
96 let new_else_bb = insertion_block builder in
99 let merge_bb = append_block context "ifcont" the_function in
101 let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
102 let phi = build_phi incoming "iftmp" builder in
119 let start_val = codegen_expr start in
123 let preheader_bb = insertion_block builder in
124 let the_function = block_parent preheader_bb in
125 let loop_bb = append_block context "loop" the_function in
135 let variable = build_phi [(start_val, preheader_bb)] var_name builder in
140 let old_val =
151 let step_val =
158 let next_var = build_add variable step_val "nextvar" builder in
161 let end_cond = codegen_expr end_ in
164 let zero = const_float double_type 0.0 in
165 let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
168 let loop_end_bb = insertion_block builder in
169 let after_bb = append_block context "afterloop" the_function in
189 let codegen_proto = function
192 let doubles = Array.make (Array.length args) double_type in
193 let ft = function_type double_type doubles in
194 let f =
213 let n = args.(i) in
219 let codegen_func the_fpm = function
222 let the_function = codegen_proto proto in
227 let op = name.[String.length name - 1] in
233 let bb = append_block context "entry" the_function in
237 let ret_val = codegen_expr body in
240 let _ = build_ret ret_val builder in
246 let _ = PassManager.run_function the_function the_fpm in