So, suppose I wanted to create an Eclipse plugin that could read an LLVM bitcode file. What would be the best way to bridge between the Java and C++ worlds? I thought about calling llvm-dis as a subprocess and then parsing the output, but that seems fragile to me. I'd rather deal with the API level if possible. -- -- Talin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091215/65b84e29/attachment.html>
2009/12/16 Talin <viridia at gmail.com>:> So, suppose I wanted to create an Eclipse plugin that could read an LLVM > bitcode file. What would be the best way to bridge between the Java and C++ > worlds? I thought about calling llvm-dis as a subprocess and then parsing > the output, but that seems fragile to me. I'd rather deal with the API level > if possible.Hi Talin, You'd still have to use Java to create the plugin and, unless you write a new llvm-dis in Java, there no way you get a clean API. AFAICS, What you can do is re-write llvm-dis (it's just a small cpp file) but using JNI calls rather than the main(), and use that from your plugin. What are your goals with this plugin? It'd be nice to edit the IR, send it to the back-end or JIT, compile it back to C and re-edit, for code that is hard to optimize. But just visualizing the code would be good enough, especially if you can select the optimization levels seamlessly or even have three panels, one with each level to compare (maybe using Eclipse's diff utility). Looking forward to use the plugin! ;) cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm
On 12/16/09 1:41 AM, Renato Golin wrote:> 2009/12/16 Talin<viridia at gmail.com>: > >> So, suppose I wanted to create an Eclipse plugin that could read an LLVM >> bitcode file. What would be the best way to bridge between the Java and C++ >> worlds? I thought about calling llvm-dis as a subprocess and then parsing >> the output, but that seems fragile to me. I'd rather deal with the API level >> if possible. >> > Hi Talin, > > You'd still have to use Java to create the plugin and, unless you > write a new llvm-dis in Java, there no way you get a clean API. > > AFAICS, What you can do is re-write llvm-dis (it's just a small cpp > file) but using JNI calls rather than the main(), and use that from > your plugin. > > What are your goals with this plugin? It'd be nice to edit the IR, > send it to the back-end or JIT, compile it back to C and re-edit, for > code that is hard to optimize. But just visualizing the code would be > good enough, especially if you can select the optimization levels > seamlessly or even have three panels, one with each level to compare > (maybe using Eclipse's diff utility). >Well, all I really want is some sort of tree-view of the global variables and functions, so that I can verify that my code generator is correct. Right now it's really hard to read the output of llvm-dis, especially the source-level debugging stuff. (Another, perhaps easier option would be to simply write a pretty-printer mode for llvm-dis.)> Looking forward to use the plugin! ;) > > cheers, > --renato > > http://systemcall.org/ > > Reclaim your digital rights, eliminate DRM, learn more at > http://www.defectivebydesign.org/what_is_drm > >