[LLVMdev] reading & writing bitcode from non file, e.g. GDBM store (or MySQL database)

Basile STARYNKEVITCH basile at starynkevitch.net
Sun Dec 2 10:46:03 PST 2007

Hello All,

(Sorry, I probably did already ask something similar before, but I 
cannot recall it easily)

First, I don't understand what precisely is in the 
/usr/local/include/llvm/Support/ directory

In particular, it seems to me that nothing in the documentation says 
that MemoryBuffer.h in inside it....

I'm quite annoyed to understand what exactly is the public interface to 
The doxygen documentation does not help: some classes or includes are 
conceptually private to the LLVM implementation, i.e. not available in 
/usr/local/include/ after a standard installation

May I suggest to add (progressively) into the LLVM doxygen-ed 
documentation some conventional comments to explain that such & such 
stuff is private to the implementation, or available to users after a 
standard installation (and without any tweaking of LLVM sources!)

I want to store modules inside non-files, for example inside GDBM 
entries (or inside MySQL databases). Apparently, I can read a module 
from a GDBM store with something like (all error handling is skipped)

   datum keyd, vald; // GDBM key & value
   // fill keyd appropriately
   vald = gdbm_fetch (bark_gdbm, keyd);
   MemoryBuffer* membuf = MemoryBuffer::getMemBuffer(vald.dptr,
					vald.dptr+vald.dsize, bufnam);
   Module* lmodu = ParseBitcodeFile(membuf, &errmsg);
   // do something appropriate with the llvm module lmodu

Unfortunately, there is no way of dumping into memory, except by going 
thru a stdc++ memory output buffer. Or am I wrong on this?

Regards, and thanks for your patience & reading.

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

More information about the llvm-dev mailing list