Attached are updated LLVM-OCaml Bindings Tutorial from Chris Wailes. (http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-April/021804.html) We changed them to work with the latest APIs(LLVM2.6 and the latest LLVM from SVN). Does anyone know if there is any realistic project using LLVM-OCaml Bindings? How is the performance? Jianzhou -------------- next part -------------- A non-text attachment was scrubbed... Name: LLVMOCamlBindingsTutorial.tgz Type: application/x-gzip Size: 34856 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100215/2c017c9b/attachment.bin>
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. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e
On Mon, Feb 15, 2010 at 11:47 PM, Jon Harrop <jon at ffconsultancy.com> wrote:> There are at least two other significant users of LLVM's OCaml bindings, > AFAIK.I'm writing an llvm backend/repl for felix, but it's pretty early.> 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.Unfortunately most errors are assertions, which we can't hook into. Perhaps though we can recover some type safety. Hypothetically, I can imagine using polymorphic variants just like lablgtk, and type llvalue = [`Value] type lluser = [value | `User] type llconstant = [user | `Constant] type llfunction = [llconstant | `Function] val value_name : [> llvalue] -> string val is_tail_call : [>llfunction] -> bool Would something like this be worthwhile? If we do it right, I think we could be mostly source compatible.
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 >