search for: dest_blk

Displaying 2 results from an estimated 2 matches for "dest_blk".

2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...cblock; vars: (string * llvalue) list } let bb state = builder_at_end state.blk let new_block state name = append_block name state.fn let find state v = try List.assoc v state.vars with Not_found -> eprintf "Unknown variable %s\n" v; raise Not_found let cont (v, state) dest_blk = build_br dest_blk (bb state) |> ignore; v, state let rec expr state = function | Int n -> const_int i32_type n, state | Var x -> find state x, state | BinOp(op, f, g) -> let f, state = expr state f in let g, state = expr state g in let build, name = match...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml: open Printf open Llvm let build_fib m = let fibf = define_function "fib" (function_type i32_type [| i32_type |]) m in let bb = builder_at_end (entry_block fibf) in let one = const_int i32_type 1 and two = const_int i32_type 2 in let argx = param fibf 0 in set_value_name "AnArg" argx; let