I wrote in a few weeks ago about writing an independent implementation of Bitcode and updating the docs to be more complete.
Attached is a patch to docs/BitCodeFormat.html that adds a lot of information that was previously only available by reading the source code. It also corrects some errors.
Josh
bitcode-doc.diff (7.8 KB)
Very nice, applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071008/054344.html
If you're developing an independent reimplementation, you should make use of the llvm-bcanalyzer tool. It can dump out the file in an xml'y format, like this:
$ llvm-bcanalyzer test.bc -dump
<MODULE_BLOCK NumWords=166 BlockCodeSize=3>
<BLOCKINFO_BLOCK/>
<TYPE_BLOCK NumWords=12 BlockCodeSize=4>
<NUMENTRY op0=14/>
<POINTER abbrevid=4 op0=2/>
<INTEGER op0=32/>
<VECTOR op0=4 op1=4/>
<LABEL/>
<FLOAT/>
<POINTER abbrevid=4 op0=0/>
<POINTER abbrevid=4 op0=4/>
<POINTER abbrevid=4 op0=10/>
<POINTER abbrevid=4 op0=11/>
<POINTER abbrevid=4 op0=12/>
<STRUCT abbrevid=6 op0=0 op1=2/>
<FUNCTION abbrevid=5 op0=0 op1=0 op2=13 op3=0 op4=4/>
<ARRAY abbrevid=7 op0=4 op1=4/>
<VOID/>
</TYPE_BLOCK>
<TRIPLE op0=112 op1=111 op2=119 ...
It can only give names to the tags if the content format is recognized, but it still may be useful. Thanks for the docs!
-Chris