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

Jianzhou Zhao jianzhou at seas.upenn.edu
Wed Feb 17 09:35:19 PST 2010


On Tue, Feb 16, 2010 at 3:41 AM, Erick Tryzelaar
<idadesub at users.sourceforge.net> wrote:
> 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.

It sounds attractive if this works. But I did not quite get this idea.
Would you like to point out an example, or a reference
to elaborate this idea? Thanks.

Jianzhou

> _______________________________________________
> 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