[LLVMdev] bytecode reader
isanbard at gmail.com
Tue Jun 24 00:08:44 PDT 2008
> I currently write a tool to parse the LLVM bytecode file (.bc file).
> So I
> have some very basic questions:
I have to ask: Why are you doing this? There's already a bytecode file
reader and writer that's part of LLVM and it's a library, so you can
link it into your own app...
> - First, about the Abbreviation ID ( "0"=END_BLOCK,
> how to read these ID from the file stream ? I mean, I don't know,
> how many
> bit length they are. It doesn't exist on the document.
> - Second, how is the order to read the bytecode ?
> For example 4 bytes after the LLVM IR magic nr.: 21 0C 00 00 It
> the MODULE_BLOCK with its parameters, actually. But I don't know
> how to
> extract them from those bytes.
> I hope that somebody can help me answer these questions.
The best thing to do, if you're not going to use the LLVM library, is
to look at the source code to see what we're doing. Look at the
appropriate files (probably .y) in the lib/AsmParser directory.
More information about the llvm-dev