first step
[oota-llvm.git] / docs / BitCodeFormat.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5   <title>LLVM Bitcode File Format</title>
6   <link rel="stylesheet" href="llvm.css" type="text/css">
7 </head>
8 <body>
9 <div class="doc_title"> LLVM Bitcode File Format </div>
10 <ol>
11   <li><a href="#abstract">Abstract</a></li>
12   <li><a href="#overview">Overview</a></li>
13   <li><a href="#bitstream">Bitstream Format</a>
14     <ol>
15     <li><a href="#magic">Magic Numbers</a></li>
16     </ol>
17   </li>
18   <li><a href="#llvmir">LLVM IR Encoding</a></li>
19 </ol>
20 <div class="doc_author">
21   <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>.
22 </p>
23 </div>
24
25 <!-- *********************************************************************** -->
26 <div class="doc_section"> <a name="abstract">Abstract</a></div>
27 <!-- *********************************************************************** -->
28
29 <div class="doc_text">
30
31 <p>This document describes the LLVM bitstream file format and the encoding of
32 the LLVM IR into it.</p>
33
34 </div>
35
36 <!-- *********************************************************************** -->
37 <div class="doc_section"> <a name="overview">Overview</a></div>
38 <!-- *********************************************************************** -->
39
40 <div class="doc_text">
41
42 <p>
43 What is commonly known as the LLVM bitcode file format (also, sometimes
44 anachronistically known as bytecode) is actually two things: a <a 
45 href="#bitstream">bitstream container format</a>
46 and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
47
48 <p>
49 The bitstream format is an abstract encoding of structured data, like very
50 similar to XML in some ways.  Like XML, bitstream files contain tags, and nested
51 structures, and you can parse the file without having to understand the tags.
52 Unlike XML, the bitstream format is a binary encoding, and unlike XML it
53 provides a mechanism for the file to self-describe "abbreviations", which are
54 effectively size optimizations for the content.</p>
55
56 <p>This document first describes the LLVM bitstream format, then describes the
57 record structure used by LLVM IR files.
58 </p>
59
60 </div>
61
62 <!-- *********************************************************************** -->
63 <div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
64 <!-- *********************************************************************** -->
65
66 <div class="doc_text">
67
68 <p>
69 The bitstream format is literally a stream of bits, with a very simple
70 structure.  This structure consists of the following concepts:
71 </p>
72
73 <ul>
74 <li>A magic number that identifies the stream.</li>
75 <li>Encoding primitives like variable bit-rate integers.</li> 
76 <li>Blocks, which define nested content.</li> 
77 <li>Data Records, which describe entities within the file.</li> 
78 <li>Abbreviations, which specify compression optimizations for the file.</li> 
79 </ul>
80
81 <p>Note that the <a 
82 href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
83 used to dump and inspect arbitrary bitstreams, which is very useful for
84 understanding the encoding.</p>
85
86 </div>
87
88 <!-- ======================================================================= -->
89 <div class="doc_subsection"><a name="magic">Magic Numbers</a>
90 </div>
91
92 <div class="doc_text">
93
94 <p>LLVM </p>
95
96 </div>
97
98
99 <!-- _______________________________________________________________________ -->
100 <div class="doc_subsubsection"> <a name="wellformed">Well-Formedness</a> </div>
101
102 <div class="doc_text">
103
104 <p>blah
105 </p>
106
107 </div>
108
109 <!-- *********************************************************************** -->
110 <div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
111 <!-- *********************************************************************** -->
112
113 <div class="doc_text">
114
115 <p></p>
116
117 </div>
118
119
120 <!-- *********************************************************************** -->
121 <hr>
122 <address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
123  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
124 <a href="http://validator.w3.org/check/referer"><img
125  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
126  <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
127 <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
128 Last modified: $Date$
129 </address>
130 </body>
131 </html>