[LLVMdev] ocaml survey

Jon Harrop jon at ffconsultancy.com
Thu Feb 18 15:35:14 PST 2010


On Thursday 18 February 2010 20:51:40 Erick Tryzelaar wrote:
> I'm in the process of finishing up the ocaml llvm bindings, and I had
> some last minute questions before we code freeze:
>
> 1. What version of ocaml is everyone using, and how old of an ocaml
> version do you need to support?

I'm on OCaml 3.11.1 but I have no preferences.

> 2. Would it be alright if I renamed some functions? Module providers
> are being removed for 2.7. I can keep the old functions around, but
> I'd prefer to keep the API clean.

Fine by me.

> 3. Are there any llvm functionality that you need exposed to ocaml?

Nope. The only feature I'd like is exceptions on the OCaml side from LLVM 
errors.

> Right now I plan to expose:
>
> add Union to TypeKind.t
> external union_type: llcontext -> lltype array  -> lltype
> external union_element_types : lltype -> lltype array
>
> external build_indirect_br : llvalue -> int -> llbuilder -> llvalue
> external add_destination: llvalue -> llbasicblock -> unit
>
> external build_nsw_add : llvalue -> llvalue -> string -> llbuilder ->
> llvalue external build_nuw_add : llvalue -> llvalue -> string -> llbuilder
> -> llvalue external build_nsw_sub : llvalue -> llvalue -> string ->
> llbuilder -> llvalue external build_nuw_sub : llvalue -> llvalue -> string
> -> llbuilder -> llvalue external build_nsw_mul : llvalue -> llvalue ->
> string -> llbuilder -> llvalue external build_nuw_mul : llvalue -> llvalue
> -> string -> llbuilder -> llvalue external build_nsw_neg : llvalue ->
> string -> llbuilder -> llvalue external build_nuw_neg : llvalue -> string
> -> llbuilder -> llvalue external build_fneg : llvalue -> string ->
> llbuilder -> llvalue
>
> And I'm working on exposing metadata as well, but I'm not sure of the api
> yet.

Looks good.

> 4. Right now, there's a function "element_types" that return a
> structure's subtypes. Anyone mind if I rename it to
> "struct_element_types" so that the union and struct function are
> similar?

Fine by me.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list