Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let box_value llval =
- let value_t = match type_by_name the_module "value_t" with
- Some t -> t
- | None -> raise (Error "Could not look up value_t")
- in
- let value_ptr = build_alloca value_t "value" builder in
- let idx n = [| const_int i32_type 0; const_int i32_type n |] in
- let dst = match type_of llval with
- ty when ty = i64_type ->
- build_in_bounds_gep value_ptr (idx 0) "boxptr" builder
- | ty when ty = i1_type ->
- build_in_bounds_gep value_ptr (idx 1) "boxptr" builder
- | ty when ty = vector_type m n ->
- build_in_bounds_gep value_ptr (idx 3) "boxptr" builder
- | _ -> raise (Error "Don't know how to box type") in
- ignore (build_store llval dst builder); value_ptr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement