Displaying 2 results from an estimated 2 matches for "k_blk".
Did you mean:
s_blk
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...uild_add, "add"
| `Sub -> build_sub, "sub"
| `Leq -> build_icmp Icmp_sle, "leq" in
build f g name (bb state), state
| If(p, t, f) ->
let t_blk = new_block state "pass" in
let f_blk = new_block state "fail" in
let k_blk = new_block state "cont" in
let cond, state = expr state p in
build_cond_br cond t_blk f_blk (bb state) |> ignore;
let t, state = cont (expr { state with blk = t_blk } t) k_blk in
let f, state = cont (expr { state with blk = f_blk } f) k_blk in
let phi = b...
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