[LLVMdev] Is it possible to write a llvm pass in OCaml?
Gordon Henriksen
gordonhenriksen at mac.com
Thu May 1 14:24:18 PDT 2008
On May 1, 2008, at 15:09, proguan wrote:
> Thank you very much for your reply and your suggestion. It seems not
> easily to write a Pass by OCaml...
>
> Is there a way to analyse the IR in OCaml without using a Pass or
> building a IR syntax tree and a parser by myself? Is there any
> existing thing can help me?
Indeed, there's a bit of work to do still to enable this. I don't
think there's anything truly 'hard', but it certainly isn't ready to
go. I didn't mean to put you off, just wanted to point out the caveats
that might not be immediately obvious.
If you're most interested in quick results, probably the path of least
resistance is to write a pass in C++ and provide your own ocaml
bindings for that; bindings for passes are extremely trivial, since
passes are controlled by a single entry point (a createMyPass()
function in C++). If it's feasible to execute an external program, you
could also run 'opt -load'.
— Gordon
More information about the llvm-dev
mailing list