[LLVMdev] LLVM-OCaml Bindings Tutorial (2.6-2.7)

Jianzhou Zhao jianzhou at seas.upenn.edu
Wed Feb 17 09:31:56 PST 2010


On Tue, Feb 16, 2010 at 2:47 AM, Jon Harrop <jon at ffconsultancy.com> wrote:
> On Tuesday 16 February 2010 03:51:00 Jianzhou Zhao wrote:
>> Does anyone know if there is any realistic project using LLVM-OCaml
>> Bindings?
>
> I've written a VM in OCaml built upon LLVM using LLVM's OCaml bindings:
>
>  http://www.ffconsultancy.com/ocaml/hlvm/
>
> There are at least two other significant users of LLVM's OCaml bindings,
> AFAIK.
>
>> How is the performance?
>
> Performance of the bindings? Fine.
>
> My only gripe with LLVM's OCaml bindings is the way an error caught on the
> LLVM side causes my program to die in a way that the stack trace is
> unobtainable. So I resort to massively verbose debug logs. I'd much rather
> the bindings reraised errors as exceptions on the OCaml side.

I met the same issue about how to debug assertion failures from C.
But I found the latest LLVM fixed the problem I met. So I am fine
temporarily. :)

HLVM is an interesting project to support multi-language programming
in a higher level. In this project, have you designed a compiler optimization
pass with OCaml bindings?

I looked into the OCaml bindings codes.
It provides some OCaml interfaces to call an existing LLVM pass, such
as constant propagation, simplification of CFG, but it has not wrapped
enough interfaces to design a pass in OCaml from sketch yet. For example,
to implement a simple constant propagation (which is defined in
lib/Transforms/scalar in C++)
in OCaml, we need some functions in lib/Analysis which have not been
ported into OCaml. Was there any difficult to port those C++ code into
OCaml?

How does LLVM team expect users to use these OCaml bindings?
Is the implementation of a pass in OCaml an expected requirement? or
this bindings are only used to drive the LLVM compilations from OCaml.

Thanks
Jianzhou

>
> --
> Dr Jon Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/?e
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list