[LLVMdev] Rolling my own LLVM assembly language parser

Wesley J. Landaker wjl at icecavern.net
Thu Mar 26 13:52:07 PDT 2009

On Wednesday 25 March 2009 14:16:42 Jon Harrop wrote:
> I assume James is only considering reinventing this wheel because he is
> not using C++. LLVM does not play nice with other languages because C++
> is quite uninteroperable. There are C bindings to LLVM that make it a lot
> easier but, of course, they are far from complete.
> So I can fully appreciate the desire to do something like this. However,
> my recommendation would be to augment LLVM with better interop rather
> than reimplement bits of it in other languages. So I would advise James
> to work on a more language agnostic machine-readable format for LLVM's IR
> (e.g. XML based) and contribute code to LLVM that lets it IO in that
> format as well as the current human-readable form.

For what it's worth, I'm working on creating an LLVM backend for a small 
stack machine, and so far it seems a very poor fit for any of LLVM's 
CodeGen backend.

My current approach -- which may change, but is the best I've come up with 
so far -- is to use make an LLVM pass in C++ where I do nothing but spit 
out the module in a target-specific format that I can easily read from 
Python, where the I'm implemented the bulk of my actual backend. I'm doing 
this largely to avoid writing an .ll or .bc parser (which wouldn't be 
terrible, but I'm not sure how stable those formats really are).

Wesley J. Landaker <wjl at icecavern.net> <xmpp:wjl at icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090326/c874915f/attachment.sig>

More information about the llvm-dev mailing list