blob: 949de94698284f8a8ef0a177d914b1b11b1f3047 [file] [log] [blame]
Reid Spencer2c1ce4f2007-01-20 23:21:08 +00001<!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">
Reid Spencer2c1ce4f2007-01-20 23:21:08 +00007</head>
8<body>
9<div class="doc_title"> LLVM Bitcode File Format </div>
10<ol>
11 <li><a href="#abstract">Abstract</a></li>
Chris Lattnere9ef4572007-05-12 03:23:40 +000012 <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>
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000019</ol>
20<div class="doc_author">
Chris Lattnere9ef4572007-05-12 03:23:40 +000021 <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>.
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000022</p>
23</div>
Chris Lattnere9ef4572007-05-12 03:23:40 +000024
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000025<!-- *********************************************************************** -->
Chris Lattnere9ef4572007-05-12 03:23:40 +000026<div class="doc_section"> <a name="abstract">Abstract</a></div>
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000027<!-- *********************************************************************** -->
Chris Lattnere9ef4572007-05-12 03:23:40 +000028
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000029<div class="doc_text">
Chris Lattnere9ef4572007-05-12 03:23:40 +000030
31<p>This document describes the LLVM bitstream file format and the encoding of
32the LLVM IR into it.</p>
33
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000034</div>
Chris Lattnere9ef4572007-05-12 03:23:40 +000035
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000036<!-- *********************************************************************** -->
Chris Lattnere9ef4572007-05-12 03:23:40 +000037<div class="doc_section"> <a name="overview">Overview</a></div>
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000038<!-- *********************************************************************** -->
Chris Lattnere9ef4572007-05-12 03:23:40 +000039
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000040<div class="doc_text">
Chris Lattnere9ef4572007-05-12 03:23:40 +000041
42<p>
43What is commonly known as the LLVM bitcode file format (also, sometimes
44anachronistically known as bytecode) is actually two things: a <a
45href="#bitstream">bitstream container format</a>
46and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
47
48<p>
49The bitstream format is an abstract encoding of structured data, like very
50similar to XML in some ways. Like XML, bitstream files contain tags, and nested
51structures, and you can parse the file without having to understand the tags.
52Unlike XML, the bitstream format is a binary encoding, and unlike XML it
53provides a mechanism for the file to self-describe "abbreviations", which are
54effectively size optimizations for the content.</p>
55
56<p>This document first describes the LLVM bitstream format, then describes the
57record structure used by LLVM IR files.
58</p>
59
Reid Spencer2c1ce4f2007-01-20 23:21:08 +000060</div>
Chris Lattnere9ef4572007-05-12 03:23:40 +000061
62<!-- *********************************************************************** -->
63<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
64<!-- *********************************************************************** -->
65
66<div class="doc_text">
67
68<p>
69The bitstream format is literally a stream of bits, with a very simple
70structure. 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
82href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
83used to dump and inspect arbitrary bitstreams, which is very useful for
84understanding 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
Reid Spencer2c1ce4f2007-01-20 23:21:08 +0000120<!-- *********************************************************************** -->
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>
Chris Lattnere9ef4572007-05-12 03:23:40 +0000126 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
Reid Spencer2c1ce4f2007-01-20 23:21:08 +0000127<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
128Last modified: $Date$
129</address>
130</body>
131</html>