[LLVMdev] Custom bitcode format and executing it in the interpreter.

Maarten Bovijn maarten.bovijn at gmail.com
Mon Dec 9 08:42:26 PST 2013


Hello,

I'm using llvm for some experiments and I was wondering
if you might be able to give me some more insight on
what I'm planning to do. :)


I would like to store some llvm ir to a custom bitcode format.
(Let's say I have 5 different versions of very similar looking
bitcode, where the only difference are the enum numbers of each
bitcode (see /include/llvm/Bitcode/LLVMBitCodes.h))
The bitcode format will depend on the instructions in the ir.
For example when coming across an "add" instruction when converting
to bitcode I want to use another bitcode representation then the
one the previous instruction used.

Could I perhaps do this by adjusting the function WriteFunction in
/lib/BitCode/Writer/BitcodeWriter.cpp by analysing every basic
block that passes by?
Or are there less invasive methods I could use to accomplish my goal?
Perpaps passes can be a solution?


The next thing I want to do is interpret my custom bitcode file comprising
of different bitcode representations. I'd for example read in the first
bitcode and determine on that which bitcode representation to use for the
next instruction. The problem I see doing that is that right now in the
interpreter (lli) bitcode gets read in and converted to llvm ir, before
execution even starts. My goal is to convert bitcode to llvm ir as
the execution progresses.
What are your thoughts on that?


Any help is much appreciated!

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131209/a3c3ca4b/attachment.html>


More information about the llvm-dev mailing list