Advertisement
Guest User

type_of llval always matches first expression

a guest
Jul 31st, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.58 KB | None | 0 0
  1. let box_value llval =
  2.   let value_t = match type_by_name the_module "value_t" with
  3.       Some t -> t
  4.     | None -> raise (Error "Could not look up value_t")
  5.   in
  6.   let value_ptr = build_alloca value_t "value" builder in
  7.   let idx n = [| const_int i32_type 0; const_int i32_type n |] in
  8.   let dst = match type_of llval with
  9.       i64_type -> build_in_bounds_gep value_ptr (idx 0) "boxptr" builder
  10.     | i1_type -> build_in_bounds_gep value_ptr (idx 1) "boxptr" builder
  11.     | _ -> raise (Error "Don't know how to box type") in
  12.   ignore (build_store llval dst builder); value_ptr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement