[LLVMdev] reading a module from a memory string (BitCode)

Basile STARYNKEVITCH basile at starynkevitch.net
Sat May 12 14:45:55 PDT 2007


Hello,

with the latest LLVM (almost 2.0 CVS) what is the right way to read a module
from a byte array fetched from a database?

I thought that I could subclass llbm::module to add my own fields
(typically, a MySQL id number) and then parse it as bitcode, but I am stuck,
since apparently the only way to parse bitcode is to use a BitcodeReader
then calling materializeModule gives a fresh llvm Module (not my subclass)


As a general question, are Llvm classes supposed to be usually subclassed to
add application data (like my modtime and id), or not...

Does any one have some example of reading Bitcode encoded modules? Can I
assume that such modules are not tied to a particular (LLVM target)
architecture, in other words can I store into my database modules build on
AMD64 and reload them on x86 (32 bits)?

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



More information about the llvm-dev mailing list