aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <nothing@nowhere.org>2007-05-23 18:12:40 +0000
committercvs2svn <nothing@nowhere.org>2007-05-23 18:12:40 +0000
commitda8b9c2c5c2548ba967e48b49fbe6fefb95967ee (patch)
treea2abaf2c3a2a4156b71cbb218044c0b191fdcdf4
parentb64c2c8a2afcde97bbb6e2d1dc6208a0313cb16f (diff)
This commit was manufactured by cvs2svn to create tag 'RELEASE_20'.svn-tags/RELEASE_20
git-svn-id: https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_20@37313 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile.rules15
-rw-r--r--autoconf/configure.ac3
-rwxr-xr-xconfigure69
-rw-r--r--docs/BitCodeFormat.html609
-rw-r--r--docs/CommandGuide/man/man1/bugpoint.1240
-rw-r--r--docs/CommandGuide/man/man1/llc.1277
-rw-r--r--docs/CommandGuide/man/man1/lli.1206
-rw-r--r--docs/CommandGuide/man/man1/llvm-ar.1461
-rw-r--r--docs/CommandGuide/man/man1/llvm-as.1182
-rw-r--r--docs/CommandGuide/man/man1/llvm-bcanalyzer.1370
-rw-r--r--docs/CommandGuide/man/man1/llvm-config.1227
-rw-r--r--docs/CommandGuide/man/man1/llvm-db.1141
-rw-r--r--docs/CommandGuide/man/man1/llvm-dis.1175
-rw-r--r--docs/CommandGuide/man/man1/llvm-extract.1177
-rw-r--r--docs/CommandGuide/man/man1/llvm-ld.1348
-rw-r--r--docs/CommandGuide/man/man1/llvm-link.1186
-rw-r--r--docs/CommandGuide/man/man1/llvm-nm.1219
-rw-r--r--docs/CommandGuide/man/man1/llvm-prof.1173
-rw-r--r--docs/CommandGuide/man/man1/llvm-ranlib.1167
-rw-r--r--docs/CommandGuide/man/man1/llvm-upgrade.1179
-rw-r--r--docs/CommandGuide/man/man1/llvm2cpp.1301
-rw-r--r--docs/CommandGuide/man/man1/llvmc.1455
-rw-r--r--docs/CommandGuide/man/man1/llvmgcc.1194
-rw-r--r--docs/CommandGuide/man/man1/llvmgxx.1194
-rw-r--r--docs/CommandGuide/man/man1/opt.1246
-rw-r--r--docs/CommandGuide/man/man1/stkrc.1198
-rw-r--r--docs/CommandGuide/man/man1/tblgen.1215
-rw-r--r--docs/GettingStarted.html11
-rw-r--r--docs/LangRef.html56
-rw-r--r--docs/ReleaseNotes.html655
-rw-r--r--docs/WritingAnLLVMPass.html12
-rw-r--r--include/llvm/BasicBlock.h1
-rw-r--r--include/llvm/IntrinsicsX86.td4
-rw-r--r--include/llvm/ValueSymbolTable.h1
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp165
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.h13
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp27
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp26
-rw-r--r--lib/Support/APInt.cpp6
-rw-r--r--lib/System/Unix/MappedFile.inc1
-rw-r--r--lib/Target/CBackend/CBackend.cpp5
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp26
-rw-r--r--lib/Target/PowerPC/PPCRegisterInfo.td6
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp14
-rw-r--r--lib/Target/X86/X86InstrMMX.td4
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp6
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp34
-rw-r--r--test/CodeGen/SPARC/2007-05-09-JumpTables.ll30
-rw-r--r--test/Feature/llvm2cpp.ll795
-rw-r--r--tools/llvm-upgrade/UpgradeLexer.cpp.cvs332
-rw-r--r--tools/llvm-upgrade/UpgradeParser.cpp.cvs626
-rw-r--r--tools/llvm-upgrade/UpgradeParser.h.cvs2
-rw-r--r--tools/llvm-upgrade/UpgradeParser.y.cvs90
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp12
55 files changed, 7464 insertions, 1727 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 888c5bdf04..d83f2fa548 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1359,15 +1359,12 @@ all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs)
%.h: %.y
# Rule for building the bison based parsers...
-$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
ifneq ($(BISON),)
+$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(Echo) "Bisoning $*.y"
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
-else
- $(Echo) "Bison of $*.y SKIPPED -- bison not found"
-endif
# IFF the .y file has changed since it was last checked into CVS, copy the .y
# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
@@ -1380,6 +1377,16 @@ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
$(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \
$(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
+else
+$(PROJ_SRC_DIR)/%.cpp : $(PROJ_SRC_DIR)/%.cpp.cvs
+ $(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .cpp.cvs"
+ $(Verb)$(CP) $(PROJ_SRC_DIR)/$*.cpp.cvs $(PROJ_SRC_DIR)/$*.cpp
+
+$(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.h.cvs
+ $(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .h.cvs"
+ $(Verb)$(CP) $(PROJ_SRC_DIR)/$*.h.cvs $(PROJ_SRC_DIR)/$*.h
+endif
+
$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 293406160c..674b9054d9 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -31,7 +31,7 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
-AC_INIT([[llvm]],[[2.0cvs]],[llvmbugs@cs.uiuc.edu])
+AC_INIT([[llvm]],[[2.0]],[llvmbugs@cs.uiuc.edu])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
@@ -495,6 +495,7 @@ LLVM_PROG_PERL([5.006])
AC_SUBST(PERL)
if test x"$PERL" = xnone; then
AC_SUBST(HAVE_PERL,0)
+ AC_MSG_ERROR([perl is required but was not found, please install it])
else
AC_SUBST(HAVE_PERL,1)
fi
diff --git a/configure b/configure
index 820080c210..7c417e103a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for llvm 2.0cvs.
+# Generated by GNU Autoconf 2.60 for llvm 2.0.
#
# Report bugs to <llvmbugs@cs.uiuc.edu>.
#
@@ -715,8 +715,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='llvm'
PACKAGE_TARNAME='-llvm-'
-PACKAGE_VERSION='2.0cvs'
-PACKAGE_STRING='llvm 2.0cvs'
+PACKAGE_VERSION='2.0'
+PACKAGE_STRING='llvm 2.0'
PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu'
ac_unique_file="lib/VMCore/Module.cpp"
@@ -1450,7 +1450,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures llvm 2.0cvs to adapt to many kinds of systems.
+\`configure' configures llvm 2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1516,7 +1516,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of llvm 2.0cvs:";;
+ short | recursive ) echo "Configuration of llvm 2.0:";;
esac
cat <<\_ACEOF
@@ -1641,7 +1641,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-llvm configure 2.0cvs
+llvm configure 2.0
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1657,7 +1657,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by llvm $as_me 2.0cvs, which was
+It was created by llvm $as_me 2.0, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@@ -7374,6 +7374,9 @@ fi
if test x"$PERL" = xnone; then
HAVE_PERL=0
+ { { echo "$as_me:$LINENO: error: perl is required but was not found, please install it" >&5
+echo "$as_me: error: perl is required but was not found, please install it" >&2;}
+ { (exit 1); exit 1; }; }
else
HAVE_PERL=1
@@ -10340,7 +10343,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10343 "configure"
+#line 10346 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12484,7 +12487,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 12487 "configure"' > conftest.$ac_ext
+ echo '#line 12490 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14202,11 +14205,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14205: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14208: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14209: \$? = $ac_status" >&5
+ echo "$as_me:14212: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14470,11 +14473,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14473: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14476: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14477: \$? = $ac_status" >&5
+ echo "$as_me:14480: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14574,11 +14577,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14577: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14580: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14581: \$? = $ac_status" >&5
+ echo "$as_me:14584: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17026,7 +17029,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17029 "configure"
+#line 17032 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17126,7 +17129,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17129 "configure"
+#line 17132 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19494,11 +19497,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19497: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19500: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:19501: \$? = $ac_status" >&5
+ echo "$as_me:19504: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -19598,11 +19601,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19601: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19604: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:19605: \$? = $ac_status" >&5
+ echo "$as_me:19608: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21168,11 +21171,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21171: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21174: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:21175: \$? = $ac_status" >&5
+ echo "$as_me:21178: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -21272,11 +21275,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21275: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21278: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:21279: \$? = $ac_status" >&5
+ echo "$as_me:21282: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -23507,11 +23510,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23510: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23513: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23514: \$? = $ac_status" >&5
+ echo "$as_me:23517: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23775,11 +23778,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23778: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23781: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23782: \$? = $ac_status" >&5
+ echo "$as_me:23785: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23879,11 +23882,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23882: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23885: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:23886: \$? = $ac_status" >&5
+ echo "$as_me:23889: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -34017,7 +34020,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by llvm $as_me 2.0cvs, which was
+This file was extended by llvm $as_me 2.0, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -34070,7 +34073,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-llvm config.status 2.0cvs
+llvm config.status 2.0
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/docs/BitCodeFormat.html b/docs/BitCodeFormat.html
index 0579a42115..7194c7a6d3 100644
--- a/docs/BitCodeFormat.html
+++ b/docs/BitCodeFormat.html
@@ -1,59 +1,612 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Bitcode File Format</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
- <style type="text/css">
- TR, TD { border: 2px solid gray; padding-left: 4pt; padding-right: 4pt;
- padding-top: 2pt; padding-bottom: 2pt; }
- TH { border: 2px solid gray; font-weight: bold; font-size: 105%; }
- TABLE { text-align: center; border: 2px solid black;
- border-collapse: collapse; margin-top: 1em; margin-left: 1em;
- margin-right: 1em; margin-bottom: 1em; }
- .td_left { border: 2px solid gray; text-align: left; }
- </style>
</head>
<body>
<div class="doc_title"> LLVM Bitcode File Format </div>
<ol>
<li><a href="#abstract">Abstract</a></li>
- <li><a href="#concepts">Concepts</a></li>
+ <li><a href="#overview">Overview</a></li>
+ <li><a href="#bitstream">Bitstream Format</a>
+ <ol>
+ <li><a href="#magic">Magic Numbers</a></li>
+ <li><a href="#primitives">Primitives</a></li>
+ <li><a href="#abbrevid">Abbreviation IDs</a></li>
+ <li><a href="#blocks">Blocks</a></li>
+ <li><a href="#datarecord">Data Records</a></li>
+ <li><a href="#abbreviations">Abbreviations</a></li>
+ <li><a href="#stdblocks">Standard Blocks</a></li>
+ </ol>
+ </li>
+ <li><a href="#llvmir">LLVM IR Encoding</a>
+ <ol>
+ <li><a href="#basics">Basics</a></li>
+ </ol>
+ </li>
</ol>
<div class="doc_author">
- <p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and
- <a href="mailto:sabre@nondot.org">Chris Lattner</a>.
+ <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>.
</p>
</div>
+
<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="abstract">Abstract </a></div>
+<div class="doc_section"> <a name="abstract">Abstract</a></div>
<!-- *********************************************************************** -->
+
<div class="doc_text">
-<p>This document describes the LLVM bitcode file format. It specifies
-the binary encoding rules of the bitcode file format so that
-equivalent systems can encode bitcode files correctly. The LLVM
-bitcode representation is used to store the intermediate
-representation on disk in a compacted form.</p>
-<p>This document supercedes the LLVM bytecode file format for the 2.0
-release.</p>
+
+<p>This document describes the LLVM bitstream file format and the encoding of
+the LLVM IR into it.</p>
+
</div>
+
<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="concepts">Concepts</a> </div>
+<div class="doc_section"> <a name="overview">Overview</a></div>
<!-- *********************************************************************** -->
+
<div class="doc_text">
-<p>This section describes the general concepts of the bitcode file
-format without getting into specific layout details. It is recommended
-that you read this section thoroughly before interpreting the detailed
-descriptions.</p>
+
+<p>
+What is commonly known as the LLVM bitcode file format (also, sometimes
+anachronistically known as bytecode) is actually two things: a <a
+href="#bitstream">bitstream container format</a>
+and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
+
+<p>
+The bitstream format is an abstract encoding of structured data, very
+similar to XML in some ways. Like XML, bitstream files contain tags, and nested
+structures, and you can parse the file without having to understand the tags.
+Unlike XML, the bitstream format is a binary encoding, and unlike XML it
+provides a mechanism for the file to self-describe "abbreviations", which are
+effectively size optimizations for the content.</p>
+
+<p>This document first describes the LLVM bitstream format, then describes the
+record structure used by LLVM IR files.
+</p>
+
+</div>
+
+<!-- *********************************************************************** -->
+<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
+<!-- *********************************************************************** -->
+
+<div class="doc_text">
+
+<p>
+The bitstream format is literally a stream of bits, with a very simple
+structure. This structure consists of the following concepts:
+</p>
+
+<ul>
+<li>A "<a href="#magic">magic number</a>" that identifies the contents of
+ the stream.</li>
+<li>Encoding <a href="#primitives">primitives</a> like variable bit-rate
+ integers.</li>
+<li><a href="#blocks">Blocks</a>, which define nested content.</li>
+<li><a href="#datarecord">Data Records</a>, which describe entities within the
+ file.</li>
+<li>Abbreviations, which specify compression optimizations for the file.</li>
+</ul>
+
+<p>Note that the <a
+href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
+used to dump and inspect arbitrary bitstreams, which is very useful for
+understanding the encoding.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="magic">Magic Numbers</a>
+</div>
+
+<div class="doc_text">
+
+<p>The first four bytes of the stream identify the encoding of the file. This
+is used by a reader to know what is contained in the file.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="primitives">Primitives</a>
+</div>
+
+<div class="doc_text">
+
+<p>
+A bitstream literally consists of a stream of bits. This stream is made up of a
+number of primitive values that encode a stream of unsigned integer values.
+These
+integers are are encoded in two ways: either as <a href="#fixedwidth">Fixed
+Width Integers</a> or as <a href="#variablewidth">Variable Width
+Integers</a>.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="fixedwidth">Fixed Width Integers</a>
+</div>
+
+<div class="doc_text">
+
+<p>Fixed-width integer values have their low bits emitted directly to the file.
+ For example, a 3-bit integer value encodes 1 as 001. Fixed width integers
+ are used when there are a well-known number of options for a field. For
+ example, boolean values are usually encoded with a 1-bit wide integer.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="variablewidth">Variable Width
+Integers</a></div>
+
+<div class="doc_text">
+
+<p>Variable-width integer (VBR) values encode values of arbitrary size,
+optimizing for the case where the values are small. Given a 4-bit VBR field,
+any 3-bit value (0 through 7) is encoded directly, with the high bit set to
+zero. Values larger than N-1 bits emit their bits in a series of N-1 bit
+chunks, where all but the last set the high bit.</p>
+
+<p>For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a
+vbr4 value. The first set of four bits indicates the value 3 (011) with a
+continuation piece (indicated by a high bit of 1). The next word indicates a
+value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value
+27.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="char6">6-bit characters</a></div>
+
+<div class="doc_text">
+
+<p>6-bit characters encode common characters into a fixed 6-bit field. They
+represent the following characters with the following 6-bit values:</p>
+
+<ul>
+<li>'a' .. 'z' - 0 .. 25</li>
+<li>'A' .. 'Z' - 26 .. 52</li>
+<li>'0' .. '9' - 53 .. 61</li>
+<li>'.' - 62</li>
+<li>'_' - 63</li>
+</ul>
+
+<p>This encoding is only suitable for encoding characters and strings that
+consist only of the above characters. It is completely incapable of encoding
+characters not in the set.</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="wordalign">Word Alignment</a></div>
+
+<div class="doc_text">
+
+<p>Occasionally, it is useful to emit zero bits until the bitstream is a
+multiple of 32 bits. This ensures that the bit position in the stream can be
+represented as a multiple of 32-bit words.</p>
+
+</div>
+
+
+<!-- ======================================================================= -->
+<div class="doc_subsection"><a name="abbrevid">Abbreviation IDs</a>
+</div>
+
+<div class="doc_text">