summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authortstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>2012-10-11 21:28:00 +0000
committertstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>2012-10-11 21:28:00 +0000
commit00b23dae41f4e32bbd975199c745d60ec7ab7524 (patch)
tree9edb79f82078373b03e6d2d3587d9494fc010e94 /docs
parent32bcd5a2a5b0f3c46754867a06ad62630161ccf4 (diff)
Merge master branch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/R600/@165748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/CodeGenerator.rst14
-rw-r--r--docs/CompilerWriterInfo.html267
-rw-r--r--docs/CompilerWriterInfo.rst118
-rw-r--r--docs/ExtendingLLVM.html379
-rw-r--r--docs/ExtendingLLVM.rst306
-rw-r--r--docs/GarbageCollection.html4
-rw-r--r--docs/GettingStarted.html1760
-rw-r--r--docs/GettingStarted.rst1304
-rw-r--r--docs/GoldPlugin.html227
-rw-r--r--docs/GoldPlugin.rst186
-rw-r--r--docs/HowToSetUpLLVMStyleRTTI.rst281
-rw-r--r--docs/LangRef.html8
-rw-r--r--docs/LinkTimeOptimization.rst2
-rw-r--r--docs/ProgrammersManual.html27
-rw-r--r--docs/SourceLevelDebugging.html6
-rw-r--r--docs/WritingAnLLVMBackend.html10
-rw-r--r--docs/index.rst2
-rw-r--r--docs/programming.rst16
-rw-r--r--docs/subsystems.rst3
-rw-r--r--docs/tutorial/LangImpl4.html6
-rw-r--r--docs/tutorial/LangImpl5.html4
-rw-r--r--docs/tutorial/LangImpl6.html4
-rw-r--r--docs/tutorial/LangImpl7.html6
-rw-r--r--docs/tutorial/OCamlLangImpl4.html4
-rw-r--r--docs/tutorial/OCamlLangImpl5.html2
-rw-r--r--docs/tutorial/OCamlLangImpl6.html2
-rw-r--r--docs/tutorial/OCamlLangImpl7.html4
-rw-r--r--docs/userguides.rst3
28 files changed, 2276 insertions, 2679 deletions
diff --git a/docs/CodeGenerator.rst b/docs/CodeGenerator.rst
index 72b12539cd7..f387e7f4c54 100644
--- a/docs/CodeGenerator.rst
+++ b/docs/CodeGenerator.rst
@@ -81,7 +81,7 @@ Required components in the code generator
The two pieces of the LLVM code generator are the high-level interface to the
code generator and the set of reusable components that can be used to build
target-specific backends. The two most important interfaces (:raw-html:`<tt>`
-`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `TargetData`_
+`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `DataLayout`_
:raw-html:`</tt>`) are the only ones that are required to be defined for a
backend to fit into the LLVM system, but the others must be defined if the
reusable code generator components are going to be used.
@@ -197,7 +197,7 @@ any particular client. These classes are designed to capture the *abstract*
properties of the target (such as the instructions and registers it has), and do
not incorporate any particular pieces of code generation algorithms.
-All of the target description classes (except the :raw-html:`<tt>` `TargetData`_
+All of the target description classes (except the :raw-html:`<tt>` `DataLayout`_
:raw-html:`</tt>` class) are designed to be subclassed by the concrete target
implementation, and have virtual methods implemented. To get to these
implementations, the :raw-html:`<tt>` `TargetMachine`_ :raw-html:`</tt>` class
@@ -214,18 +214,18 @@ the ``get*Info`` methods (``getInstrInfo``, ``getRegisterInfo``,
``getFrameInfo``, etc.). This class is designed to be specialized by a concrete
target implementation (e.g., ``X86TargetMachine``) which implements the various
virtual methods. The only required target description class is the
-:raw-html:`<tt>` `TargetData`_ :raw-html:`</tt>` class, but if the code
+:raw-html:`<tt>` `DataLayout`_ :raw-html:`</tt>` class, but if the code
generator components are to be used, the other interfaces should be implemented
as well.
-.. _TargetData:
+.. _DataLayout:
-The ``TargetData`` class
+The ``DataLayout`` class
------------------------
-The ``TargetData`` class is the only required target description class, and it
+The ``DataLayout`` class is the only required target description class, and it
is the only class that is not extensible (you cannot derived a new class from
-it). ``TargetData`` specifies information about how the target lays out memory
+it). ``DataLayout`` specifies information about how the target lays out memory
for structures, the alignment requirements for various data types, the size of
pointers in the target, and whether the target is little-endian or
big-endian.
diff --git a/docs/CompilerWriterInfo.html b/docs/CompilerWriterInfo.html
deleted file mode 100644
index 66190655fa5..00000000000
--- a/docs/CompilerWriterInfo.html
+++ /dev/null
@@ -1,267 +0,0 @@
-<!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>Architecture/platform information for compiler writers</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-
-<body>
-
-<h1>
- Architecture/platform information for compiler writers
-</h1>
-
-<div class="doc_warning">
- <p>Note: This document is a work-in-progress. Additions and clarifications
- are welcome.</p>
-</div>
-
-<ol>
- <li><a href="#hw">Hardware</a>
- <ol>
- <li><a href="#arm">ARM</a></li>
- <li><a href="#ia64">Itanium</a></li>
- <li><a href="#mips">MIPS</a></li>
- <li><a href="#ppc">PowerPC</a></li>
- <li><a href="#sparc">SPARC</a></li>
- <li><a href="#x86">X86</a></li>
- <li><a href="#other">Other lists</a></li>
- </ol></li>
- <li><a href="#abi">Application Binary Interface (ABI)</a>
- <ol>
- <li><a href="#linux">Linux</a></li>
- <li><a href="#osx">OS X</a></li>
- </ol></li>
- <li><a href="#misc">Miscellaneous resources</a></li>
-</ol>
-
-<div class="doc_author">
- <p>Compiled by <a href="http://misha.brukman.net">Misha Brukman</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="hw">Hardware</a></h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<!-- ======================================================================= -->
-<h3><a name="arm">ARM</a></h3>
-
-<div>
-<ul>
-<li><a href="http://www.arm.com/documentation/">ARM documentation</a>
-(<a href="http://www.arm.com/documentation/ARMProcessor_Cores/">Processor
-Cores</a>)</li>
-<li><a href="http://www.arm.com/products/DevTools/ABI.html">ABI</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="ia64">Itanium (ia64)</a></h3>
-
-<div>
-<ul>
-<li><a
-href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a>
-</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="mips">MIPS</a></h3>
-
-<div>
-<ul>
-<li><a
-href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
-Processor Architecture</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="ppc">PowerPC</a></h3>
-
-<div>
-
-<!-- _______________________________________________________________________ -->
-<h4>IBM - Official manuals and docs</h4>
-
-<div>
-
-<ul>
-<li><a
-href="http://www-106.ibm.com/developerworks/eserver/articles/archguide.html">PowerPC
-Architecture Book</a>
-<ul>
- <li>Book I: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf">PowerPC
- User Instruction Set Architecture</a></li>
- <li>Book II: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf">PowerPC
- Virtual Environment Architecture</a></li>
- <li>Book III: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf">PowerPC
- Operating Environment Architecture</a></li>
-</ul></li>
-<li><a
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">PowerPC
-Compiler Writer's Guide</a></li>
-<li><A
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC">PowerPC
-Processor Manuals</a></li>
-<li><a
-href="http://www-106.ibm.com/developerworks/linux/library/l-powarch/">Intro to
-PowerPC architecture</a></li>
-<li><a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm">IBM AIX/5L for POWER Assembly reference</a></li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Other documents, collections, notes</h4>
-
-<div>
-
-<ul>
-<li><a href="http://penguinppc.org/dev/#library">PowerPC ABI documents</a></li>
-<li><a href="http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html">PowerPC64
-alignment of long doubles (from GCC)</a></li>
-<li><a href="http://sources.redhat.com/ml/binutils/2002-04/msg00573.html">Long
-branch stubs for powerpc64-linux (from binutils)</a></li>
-</ul>
-
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="sparc">SPARC</a></h3>
-
-<div>
-
-<ul>
-<li><a href="http://www.sparc.org/resource.htm">SPARC resources</a></li>
-<li><a href="http://www.sparc.org/standards.html">SPARC standards</a></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="x86">X86</a></h3>
-
-<div>
-
-<!-- _______________________________________________________________________ -->
-<h4>AMD - Official manuals and docs</h4>
-
-<div>
-<ul>
-<li><a
-href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
-<li><a href="http://www.x86-64.org/documentation">X86-64 ABI</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Intel - Official manuals and docs</h4>
-
-<div>
-<ul>
-<li><a
-href="http://developer.intel.com/design/pentium4/manuals/index_new.htm">IA-32
-manuals</a></li>
-<li><a
-href="http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs">Intel
-Itanium documentation</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Other x86-specific information</h4>
-
-<div>
-<ul>
-<li><a href="http://www.agner.org/assem/calling_conventions.pdf">Calling
-conventions for different C++ compilers and operating systems</a></li>
-</ul>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="other">Other relevant lists</a></h3>
-
-<div>
-
-<ul>
-<li><a href="http://gcc.gnu.org/readings.html">GCC reading list</a></li>
-</ul>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="abi">ABI</a></h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<!-- ======================================================================= -->
-<h3><a name="linux">Linux</a></h3>
-
-<div>
-<ol>
-<li><a href="http://www.linuxbase.org/spec/ELF/ppc64/">PowerPC 64-bit ELF ABI
-Supplement</a></li>
-</ol>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="osx">OS X</a></h3>
-
-<div>
-<ol>
-<li><a
-href="http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html">Mach-O
-Runtime Architecture</a></li>
-<li><a href="http://www.unsanity.org/archives/000044.php">Notes on Mach-O
-ABI</a></li>
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="misc">Miscellaneous resources</a></h2>
-<!-- *********************************************************************** -->
-
-<ul>
-<li><a
-href="http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/">Executable
-File Format library</a></li>
-<li><a href="http://gcc.gnu.org/projects/prefetch.html">GCC prefetch project</a>
-page has a good survey of the prefetching capabilities of a variety of modern
-processors.</li>
-</ul>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="http://misha.brukman.net">Misha Brukman</a><br>
- <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
- Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/docs/CompilerWriterInfo.rst b/docs/CompilerWriterInfo.rst
new file mode 100644
index 00000000000..e41f5f9eece
--- /dev/null
+++ b/docs/CompilerWriterInfo.rst
@@ -0,0 +1,118 @@
+.. _compiler_writer_info:
+
+========================================================
+Architecture & Platform Information for Compiler Writers
+========================================================
+
+.. contents::
+ :local:
+
+.. note::
+
+ This document is a work-in-progress. Additions and clarifications are
+ welcome.
+
+ Compiled by `Misha Brukman <http://misha.brukman.net>`_.
+
+Hardware
+========
+
+ARM
+---
+
+* `ARM documentation <http://www.arm.com/documentation/>`_ (`Processor Cores <http://www.arm.com/documentation/ARMProcessor_Cores/>`_ Cores)
+
+* `ABI <http://www.arm.com/products/DevTools/ABI.html>`_
+
+Itanium (ia64)
+--------------
+
+* `Itanium documentation <http://developer.intel.com/design/itanium2/documentation.htm>`_
+
+MIPS
+----
+
+* `MIPS Processor Architecture <http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary>`_
+
+PowerPC
+-------
+
+IBM - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `PowerPC Architecture Book <http://www-106.ibm.com/developerworks/eserver/articles/archguide.html>`_
+
+ * Book I: `PowerPC User Instruction Set Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf>`_
+
+ * Book II: `PowerPC Virtual Environment Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf>`_
+
+ * Book III: `PowerPC Operating Environment Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf>`_
+
+* `PowerPC Compiler Writer's Guide <http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6>`_
+
+* `PowerPC Processor Manuals <http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC>`_
+
+* `Intro to PowerPC Architecture <http://www-106.ibm.com/developerworks/linux/library/l-powarch/>`_
+
+* `IBM AIX/5L for POWER Assembly Reference <http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm>`_
+
+Other documents, collections, notes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `PowerPC ABI documents <http://penguinppc.org/dev/#library>`_
+* `PowerPC64 alignment of long doubles (from GCC) <http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html>`_
+* `Long branch stubs for powerpc64-linux (from binutils) <http://sources.redhat.com/ml/binutils/2002-04/msg00573.html>`_
+
+SPARC
+-----
+
+* `SPARC resources <http://www.sparc.org/resource.htm>`_
+* `SPARC standards <http://www.sparc.org/standards.html>`_
+
+X86
+---
+
+AMD - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `AMD processor manuals <http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html>`_
+* `X86-64 ABI <http://www.x86-64.org/documentation>`_
+
+Intel - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `IA-32 manuals <http://developer.intel.com/design/pentium4/manuals/index_new.htm>`_
+* `Intel Itanium documentation <http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs>`_
+
+Other x86-specific information
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `Calling conventions for different C++ compilers and operating systems <http://www.agner.org/assem/calling_conventions.pdf>`_
+
+Other relevant lists
+--------------------
+
+* `GCC reading list <http://gcc.gnu.org/readings.html>`_
+
+ABI
+===
+
+Linux
+-----
+
+* `PowerPC 64-bit ELF ABI Supplement <http://www.linuxbase.org/spec/ELF/ppc64/>`_
+
+OS X
+----
+
+* `Mach-O Runtime Architecture <http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html>`_
+* `Notes on Mach-O ABI <http://www.unsanity.org/archives/000044.php>`_
+
+Miscellaneous Resources
+=======================
+
+* `Executable File Format library <http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/>`_
+
+* `GCC prefetch project <http://gcc.gnu.org/projects/prefetch.html>`_ page has a
+ good survey of the prefetching capabilities of a variety of modern
+ processors.
diff --git a/docs/ExtendingLLVM.html b/docs/ExtendingLLVM.html
deleted file mode 100644
index 99e209b8940..00000000000
--- a/docs/ExtendingLLVM.html
+++ /dev/null
@@ -1,379 +0,0 @@
-<!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>Extending LLVM: Adding instructions, intrinsics, types, etc.</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-
-<body>
-
-<h1>
- Extending LLVM: Adding instructions, intrinsics, types, etc.
-</h1>
-
-<ol>
- <li><a href="#introduction">Introduction and Warning</a></li>
- <li><a href="#intrinsic">Adding a new intrinsic function</a></li>
- <li><a href="#instruction">Adding a new instruction</a></li>
- <li><a href="#sdnode">Adding a new SelectionDAG node</a></li>
- <li><a href="#type">Adding a new type</a>
- <ol>
- <li><a href="#fund_type">Adding a new fundamental type</a></li>
- <li><a href="#derived_type">Adding a new derived type</a></li>
- </ol></li>
-</ol>
-
-<div class="doc_author">
- <p>Written by <a href="http://misha.brukman.net">Misha Brukman</a>,
- Brad Jones, Nate Begeman,
- and <a href="http://nondot.org/sabre">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="introduction">Introduction and Warning</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>During the course of using LLVM, you may wish to customize it for your
-research project or for experimentation. At this point, you may realize that
-you need to add something to LLVM, whether it be a new fundamental type, a new
-intrinsic function, or a whole new instruction.</p>
-
-<p>When you come to this realization, stop and think. Do you really need to
-extend LLVM? Is it a new fundamental capability that LLVM does not support at
-its current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the <a
-href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM-dev</a> list. The
-reason is that extending LLVM will get involved as you need to update all the
-different passes that you intend to use with your extension, and there are
-<em>many</em> LLVM analyses and transformations, so it may be quite a bit of
-work.</p>
-
-<p>Adding an <a href="#intrinsic">intrinsic function</a> is far easier than
-adding an instruction, and is transparent to optimization passes. If your added
-functionality can be expressed as a
-function call, an intrinsic function is the method of choice for LLVM
-extension.</p>
-
-<p>Before you invest a significant amount of effort into a non-trivial
-extension, <span class="doc_warning">ask on the list</span> if what you are
-looking to do can be done with already-existing infrastructure, or if maybe
-someone else is already working on it. You will save yourself a lot of time and
-effort by doing so.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="intrinsic">Adding a new intrinsic function</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Adding a new intrinsic function to LLVM is much easier than adding a new
-instruction. Almost all extensions to LLVM should start as an intrinsic
-function and then be turned into an instruction if warranted.</p>
-
-<ol>
-<li><tt>llvm/docs/LangRef.html</tt>:
- Document the intrinsic. Decide whether it is code generator specific and
- what the restrictions are. Talk to other people about it so that you are
- sure it's a good idea.</li>
-
-<li><tt>llvm/include/llvm/Intrinsics*.td</tt>:
- Add an entry for your intrinsic. Describe its memory access characteristics
- for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
- that any intrinsic using the <tt>llvm_int_ty</tt> type for an argument will
- be deemed by <tt>tblgen</tt> as overloaded and the corresponding suffix
- will be required on the intrinsic's name.</li>
-
-<li><tt>llvm/lib/Analysis/ConstantFolding.cpp</tt>: If it is possible to
- constant fold your intrinsic, add support to it in the
- <tt>canConstantFoldCallTo</tt> and <tt>ConstantFoldCall</tt> functions.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: Add test cases for your test cases to the
- test suite</li>
-</ol>
-
-<p>Once the intrinsic has been added to the system, you must add code generator
-support for it. Generally you must do the following steps:</p>
-
-<dl>
-
-<dt>Add support to the .td file for the target(s) of your choice in
- <tt>lib/Target/*/*.td</tt>.</dt>
-
-<dd>This is usually a matter of adding a pattern to the .td file that matches
- the intrinsic, though it may obviously require adding the instructions you
- want to generate as well. There are lots of examples in the PowerPC and X86
- backend to follow.</dd>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="sdnode">Adding a new SelectionDAG node</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>As with intrinsics, adding a new SelectionDAG node to LLVM is much easier
-than adding a new instruction. New nodes are often added to help represent
-instructions common to many targets. These nodes often map to an LLVM
-instruction (add, sub) or intrinsic (byteswap, population count). In other
-cases, new nodes have been added to allow many targets to perform a common task
-(converting between floating point and integer representation) or capture more
-complicated behavior in a single node (rotate).</p>
-
-<ol>
-<li><tt>include/llvm/CodeGen/ISDOpcodes.h</tt>:
- Add an enum value for the new SelectionDAG node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/SelectionDAG.cpp</tt>:
- Add code to print the node to <tt>getOperationName</tt>. If your new node
- can be evaluated at compile time when given constant arguments (such as an
- add of a constant with another constant), find the <tt>getNode</tt> method
- that takes the appropriate number of arguments, and add a case for your node
- to the switch statement that performs constant folding for nodes that take
- the same number of arguments as your new node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- Add code to <a href="CodeGenerator.html#selectiondag_legalize">legalize,
- promote, and expand</a> the node as necessary. At a minimum, you will need
- to add a case statement for your node in <tt>LegalizeOp</tt> which calls
- LegalizeOp on the node's operands, and returns a new node if any of the
- operands changed as a result of being legalized. It is likely that not all
- targets supported by the SelectionDAG framework will natively support the
- new node. In this case, you must also add code in your node's case
- statement in <tt>LegalizeOp</tt> to Expand your node into simpler, legal
- operations. The case for <tt>ISD::UREM</tt> for expanding a remainder into
- a divide, multiply, and a subtract is a good example.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- If targets may support the new node being added only at certain sizes, you
- will also need to add code to your node's case statement in
- <tt>LegalizeOp</tt> to Promote your node's operands to a larger size, and
- perform the correct operation. You will also need to add code to
- <tt>PromoteOp</tt> to do this as well. For a good example, see
- <tt>ISD::BSWAP</tt>,
- which promotes its operand to a wider size, performs the byteswap, and then
- shifts the correct bytes right to emulate the narrower byteswap in the
- wider type.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- Add a case for your node in <tt>ExpandOp</tt> to teach the legalizer how to
- perform the action represented by the new node on a value that has been
- split into high and low halves. This case will be used to support your
- node with a 64 bit operand on a 32 bit target.</li>
-<li><tt>lib/CodeGen/SelectionDAG/DAGCombiner.cpp</tt>:
- If your node can be combined with itself, or other existing nodes in a
- peephole-like fashion, add a visit function for it, and call that function
- from <tt></tt>. There are several good examples for simple combines you
- can do; <tt>visitFABS</tt> and <tt>visitSRL</tt> are good starting places.
- </li>
-<li><tt>lib/Target/PowerPC/PPCISelLowering.cpp</tt>:
- Each target has an implementation of the <tt>TargetLowering</tt> class,
- usually in its own file (although some targets include it in the same
- file as the DAGToDAGISel). The default behavior for a target is to
- assume that your new node is legal for all types that are legal for
- that target. If this target does not natively support your node, then
- tell the target to either Promote it (if it is supported at a larger
- type) or Expand it. This will cause the code you wrote in
- <tt>LegalizeOp</tt> above to decompose your new node into other legal
- nodes for this target.</li>
-<li><tt>lib/Target/TargetSelectionDAG.td</tt>:
- Most current targets supported by LLVM generate code using the DAGToDAG
- method, where SelectionDAG nodes are pattern matched to target-specific
- nodes, which represent individual instructions. In order for the targets
- to match an instruction to your new node, you must add a def for that node
- to the list in this file, with the appropriate type constraints. Look at
- <tt>add</tt>, <tt>bswap</tt>, and <tt>fadd</tt> for examples.</li>
-<li><tt>lib/Target/PowerPC/PPCInstrInfo.td</tt>:
- Each target has a tablegen file that describes the target's instruction
- set. For targets that use the DAGToDAG instruction selection framework,
- add a pattern for your new node that uses one or more target nodes.
- Documentation for this is a bit sparse right now, but there are several
- decent examples. See the patterns for <tt>rotl</tt> in
- <tt>PPCInstrInfo.td</tt>.</li>
-<li>TODO: document complex patterns.</li>
-<li><tt>llvm/test/Regression/CodeGen/*</tt>: Add test cases for your new node
- to the test suite. <tt>llvm/test/Regression/CodeGen/X86/bswap.ll</tt> is
- a good example.</li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="instruction">Adding a new instruction</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
-format, and it will take some effort to maintain compatibility with
-the previous version.</span> Only add an instruction if it is absolutely
-necessary.</p>
-
-<ol>
-
-<li><tt>llvm/include/llvm/Instruction.def</tt>:
- add a number for your instruction and an enum name</li>
-
-<li><tt>llvm/include/llvm/Instructions.h</tt>:
- add a definition for the class that will represent your instruction</li>
-
-<li><tt>llvm/include/llvm/Support/InstVisitor.h</tt>:
- add a prototype for a visitor to your new instruction type</li>
-
-<li><tt>llvm/lib/AsmParser/Lexer.l</tt>:
- add a new token to parse your instruction from assembly text file</li>
-
-<li><tt>llvm/lib/AsmParser/llvmAsmParser.y</tt>:
- add the grammar on how your instruction can be read and what it will
- construct as a result</li>
-
-<li><tt>llvm/lib/Bitcode/Reader/Reader.cpp</tt>:
- add a case for your instruction and how it will be parsed from bitcode</li>
-
-<li><tt>llvm/lib/VMCore/Instruction.cpp</tt>:
- add a case for how your instruction will be printed out to assembly</li>
-
-<li><tt>llvm/lib/VMCore/Instructions.cpp</tt>:
- implement the class you defined in
- <tt>llvm/include/llvm/Instructions.h</tt></li>
-
-<li>Test your instruction</li>
-
-<li><tt>llvm/lib/Target/*</tt>:
- Add support for your instruction to code generators, or add a lowering
- pass.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite.</li>
-
-</ol>
-
-<p>Also, you need to implement (or modify) any analyses or passes that you want
-to understand this new instruction.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="type">Adding a new type</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p><span class="doc_warning">WARNING: adding new types changes the bitcode
-format, and will break compatibility with currently-existing LLVM
-installations.</span> Only add new types if it is absolutely necessary.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="fund_type">Adding a fundamental type</a>
-</h3>
-
-<div>
-
-<ol>
-
-<li><tt>llvm/include/llvm/Type.h</tt>:
- add enum for the new type; add static <tt>Type*</tt> for this type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
- add mapping from <tt>TypeID</tt> =&gt; <tt>Type*</tt>;
- initialize the static <tt>Type*</tt></li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
- add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/AsmReader/llvmAsmParser.y</tt>:
- add a token for that type</li>
-
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="derived_type">Adding a derived type</a>
-</h3>
-
-<div>
-
-<ol>
-<li><tt>llvm/include/llvm/Type.h</tt>:
- add enum for the new type; add a forward declaration of the type
- also</li>
-
-<li><tt>llvm/include/llvm/DerivedTypes.h</tt>:
- add new class to represent new class in the hierarchy; add forward
- declaration to the TypeMap value type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
- add support for derived type to:
-<div class="doc_code">
-<pre>
-std::string getTypeDescription(const Type &amp;Ty,
- std::vector&lt;const Type*&gt; &amp;TypeStack)
-bool TypesEqual(const Type *Ty, const Type *Ty2,
- std::map&lt;const Type*, const Type*&gt; &amp; EqTypes)
-</pre>
-</div>
- add necessary member functions for type, and factory methods</li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
- add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/BitCode/Writer/Writer.cpp</tt>:
- modify <tt>void BitcodeWriter::outputType(const Type *T)</tt> to serialize
- your type</li>
-
-<li><tt>llvm/lib/BitCode/Reader/Reader.cpp</tt>:
- modify <tt>const Type *BitcodeReader::ParseType()</tt> to read your data
- type</li>
-
-<li><tt>llvm/lib/VMCore/AsmWriter.cpp</tt>:
- modify
-<div class="doc_code">
-<pre>
-void calcTypeName(const Type *Ty,
- std::vector&lt;const Type*&gt; &amp;TypeStack,
- std::map&lt;const Type*,std::string&gt; &amp;TypeNames,
- std::string &amp; Result)
-</pre>
-</div>
- to output the new derived type
-</li>
-
-
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
- <br>
- Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/docs/ExtendingLLVM.rst b/docs/ExtendingLLVM.rst
new file mode 100644
index 00000000000..e41cfd996e5
--- /dev/null
+++ b/docs/ExtendingLLVM.rst
@@ -0,0 +1,306 @@
+.. _extending_llvm:
+
+============================================================
+Extending LLVM: Adding instructions, intrinsics, types, etc.
+============================================================
+
+Introduction and Warning
+========================
+
+
+During the course of using LLVM, you may wish to customize it for your research
+project or for experimentation. At this point, you may realize that you need to
+add something to LLVM, whether it be a new fundamental type, a new intrinsic
+function, or a whole new instruction.
+
+When you come to this realization, stop and think. Do you really need to extend
+LLVM? Is it a new fundamental capability that LLVM does not support at its
+current incarnation or can it be synthesized from already pre-existing LLVM
+elements? If you are not sure, ask on the `LLVM-dev
+<http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev>`_ list. The reason is that
+extending LLVM will get involved as you need to update all the different passes
+that you intend to use with your extension, and there are ``many`` LLVM analyses
+and transformations, so it may be quite a bit of work.
+
+Adding an `intrinsic function`_ is far easier than adding an
+instruction, and is transparent to optimization passes. If your added
+functionality can be expressed as a function call, an intrinsic function is the
+method of choice for LLVM extension.
+
+Before you invest a significant amount of effort into a non-trivial extension,
+**ask on the list** if what you are looking to do can be done with
+already-existing infrastructure, or if maybe someone else is already working on
+it. You will save yourself a lot of time and effort by doing so.
+
+.. _intrinsic function:
+
+Adding a new intrinsic function
+===============================
+
+Adding a new intrinsic function to LLVM is much easier than adding a new
+instruction. Almost all extensions to LLVM should start as an intrinsic
+function and then be turned into an instruction if warranted.
+
+#. ``llvm/docs/LangRef.html``:
+
+ Document the intrinsic. Decide whether it is code generator specific and
+ what the restrictions are. Talk to other people about it so that you are
+ sure it's a good idea.
+
+#. ``llvm/include/llvm/Intrinsics*.td``:
+
+ Add an entry for your intrinsic. Describe its memory access characteristics
+ for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
+ that any intrinsic using the ``llvm_int_ty`` type for an argument will
+ be deemed by ``tblgen`` as overloaded and the corresponding suffix will
+ be required on the intrinsic's name.
+
+#. ``llvm/lib/Analysis/ConstantFolding.cpp``:
+
+ If it is possible to constant fold your intrinsic, add support to it in the
+ ``canConstantFoldCallTo`` and ``ConstantFoldCall`` functions.
+
+#. ``llvm/test/Regression/*``:
+
+ Add test cases for your test cases to the test suite
+
+Once the intrinsic has been added to the system, you must add code generator
+support for it. Generally you must do the following steps:
+
+Add support to the .td file for the target(s) of your choice in
+``lib/Target/*/*.td``.
+
+ This is usually a matter of adding a pattern to the .td file that matches the
+ intrinsic, though it may obviously require adding the instructions you want to
+ generate as well. There are lots of examples in the PowerPC and X86 backend
+ to follow.
+
+Adding a new SelectionDAG node
+==============================
+
+As with intrinsics, adding a new SelectionDAG node to LLVM is much easier than
+adding a new instruction. New nodes are often added to help represent
+instructions common to many targets. These nodes often map to an LLVM
+instruction (add, sub) or intrinsic (byteswap, population count). In other
+cases, new nodes have been added to allow many targets to perform a common task
+(converting between floating point and integer representation) or capture more
+complicated behavior in a single node (rotate).
+
+#. ``include/llvm/CodeGen/ISDOpcodes.h``:
+
+ Add an enum value for the new SelectionDAG node.
+
+#. ``lib/CodeGen/SelectionDAG/SelectionDAG.cpp``:
+
+ Add code to print the node to ``getOperationName``. If your new node can be
+ evaluated at compile time when given constant arguments (such as an add of a
+ constant with another constant), find the ``getNode`` method that takes the
+ appropriate number of arguments, and add a case for your node to the switch
+ statement that performs constant folding for nodes that take the same number
+ of arguments as your new node.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ Add code to `legalize, promote, and expand
+ <CodeGenerator.html#selectiondag_legalize>`_ the node as necessary. At a
+ minimum, you will need to add a case statement for your node in
+ ``LegalizeOp`` which calls LegalizeOp on the node's operands, and returns a
+ new node if any of the operands changed as a result of being legalized. It
+ is likely that not all targets supported by the SelectionDAG framework will
+ natively support the new node. In this case, you must also add code in your
+ node's case statement in ``LegalizeOp`` to Expand your node into simpler,
+ legal operations. The case for ``ISD::UREM`` for expanding a remainder into
+ a divide, multiply, and a subtract is a good example.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ If targets may support the new node being added only at certain sizes, you
+ will also need to add code to your node's case statement in ``LegalizeOp``
+ to Promote your node's operands to a larger size, and perform the correct
+ operation. You will also need to add code to ``PromoteOp`` to do this as
+ well. For a good example, see ``ISD::BSWAP``, which promotes its operand to
+ a wider size, performs the byteswap, and then shifts the correct bytes right
+ to emulate the narrower byteswap in the wider type.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ Add a case for your node in ``ExpandOp`` to teach the legalizer how to
+ perform the action represented by the new node on a value that has been split
+ into high and low halves. This case will be used to support your node with a
+ 64 bit operand on a 32 bit target.
+
+#. ``lib/CodeGen/SelectionDAG/DAGCombiner.cpp``:
+
+ If your node can be combined with itself, or other existing nodes in a
+ peephole-like fashion, add a visit function for it, and call that function
+ from. There are several good examples for simple combines you can do;
+ ``visitFABS`` and ``visitSRL`` are good starting places.
+
+#. ``lib/Target/PowerPC/PPCISelLowering.cpp``:
+
+ Each target has an implementation of the ``TargetLowering`` class, usually in
+ its own file (although some targets include it in the same file as the
+ DAGToDAGISel). The default behavior for a target is to assume that your new
+ node is legal for all types that are legal for that target. If this target
+ does not natively support your node, then tell the target to either Promote
+ it (if it is supported at a larger type) or Expand it. This will cause the
+ code you wrote in ``LegalizeOp`` above to decompose your new node into other
+ legal nodes for this target.
+
+#. ``lib/Target/TargetSelectionDAG.td``:
+
+ Most current targets supported by LLVM generate code using the DAGToDAG
+ method, where SelectionDAG nodes are pattern matched to target-specific
+ nodes, which represent individual instructions. In order for the targets to
+ match an instruction to your new node, you must add a def for that node to
+ the list in this file, with the appropriate type constraints. Look at
+ ``add``, ``bswap``, and ``fadd`` for examples.
+
+#. ``lib/Target/PowerPC/PPCInstrInfo.td``:
+
+ Each target has a tablegen file that describes the target's instruction set.
+ For targets that use the DAGToDAG instruction selection framework, add a
+ pattern for your new node that uses one or more target nodes. Documentation
+ for this is a bit sparse right now, but there are several decent examples.
+ See the patterns for ``rotl`` in ``PPCInstrInfo.td``.
+
+#. TODO: document complex patterns.
+
+#. ``llvm/test/Regression/CodeGen/*``:
+
+ Add test cases for your new node to the test suite.
+ ``llvm/test/Regression/CodeGen/X86/bswap.ll`` is a good example.
+
+Adding a new instruction
+========================
+
+.. warning::
+
+ Adding instructions changes the bitcode format, and it will take some effort
+ to maintain compatibility with the previous version. Only add an instruction
+ if it is absolutely necessary.
+
+#. ``llvm/include/llvm/Instruction.def``:
+
+ add a number for your instruction and an enum name
+
+#. ``llvm/include/llvm/Instructions.h``:
+
+ add a definition for the class that will represent your instruction
+
+#. ``llvm/include/llvm/Support/InstVisitor.h``:
+
+ add a prototype for a visitor to your new instruction type
+
+#. ``llvm/lib/AsmParser/Lexer.l``:
+
+ add a new token to parse your instruction from assembly text file
+
+#. ``llvm/lib/AsmParser/llvmAsmParser.y``:
+
+ add the grammar on how your instruction can be read and what it will
+ construct as a result
+
+#. ``llvm/lib/Bitcode/Reader/Reader.cpp``:
+
+ add a case for your instruction and how it will be parsed from bitcode
+
+#. ``llvm/lib/VMCore/Instruction.cpp``:
+
+ add a case for how your instruction will be printed out to assembly
+
+#. ``llvm/lib/VMCore/Instructions.cpp``:
+
+ implement the class you defined in ``llvm/include/llvm/Instructions.h``
+
+#. Test your instruction
+
+#. ``llvm/lib/Target/*``:
+
+ add support for your instruction to code generators, or add a lowering pass.
+
+#. ``llvm/test/Regression/*``:
+
+ add your test cases to the test suite.
+
+Also, you need to implement (or modify) any analyses or passes that you want to
+understand this new instruction.
+
+Adding a new type
+=================
+
+.. warning::
+
+ Adding new types changes the bitcode format, and will break compatibility with
+ currently-existing LLVM installations. Only add new types if it is absolutely
+ necessary.
+
+Adding a fundamental type
+-------------------------
+
+#. ``llvm/include/llvm/Type.h``:
+
+ add enum for the new type; add static ``Type*`` for this type
+
+#. ``llvm/lib/VMCore/Type.cpp``:
+
+ add mapping from ``TypeID`` => ``Type*``; initialize the static ``Type*``
+
+#. ``llvm/lib/AsmReader/Lexer.l``:
+
+ add ability to parse in the type from text assembly
+
+#. ``llvm/lib/AsmReader/llvmAsmParser.y``:
+
+ add a token for that type
+
+Adding a derived type
+---------------------
+
+#. ``llvm/include/llvm/Type.h``:
+
+ add enum for the new type; add a forward declaration of the type also
+
+#. ``llvm/include/llvm/DerivedTypes.h``:
+
+ add new class to represent new class in the hierarchy; add forward
+ declaration to the TypeMap value type
+
+#. ``llvm/lib/VMCore/Type.cpp``:
+
+ add support for derived type to:
+
+ .. code:: c++
+
+ std::string getTypeDescription(const Type &Ty,
+ std::vector<const Type*> &TypeStack)
+ bool TypesEqual(const Type *Ty, const Type *Ty2,
+ std::map<const Type*, const Type*> &EqTypes)
+
+ add necessary member functions for type, and factory methods
+
+#. ``llvm/lib/AsmReader/Lexer.l``:
+
+ add ability to parse in the type from text assembly
+
+#. ``llvm/lib/BitCode/Writer/Writer.cpp``:
+
+ modify ``void BitcodeWriter::outputType(const Type *T)`` to serialize your
+ type
+
+#. ``llvm/lib/BitCode/Reader/Reader.cpp``:
+
+ modify ``const Type *BitcodeReader::ParseType()`` to read your data type
+
+#. ``llvm/lib/VMCore/AsmWriter.cpp``:
+
+ modify
+
+ .. code:: c++
+
+ void calcTypeName(const Type *Ty,
+ std::vector<const Type*> &TypeStack,
+ std::map<const Type*,std::string> &TypeNames,
+ std::string &Result)
+
+ to output the new derived type
diff --git a/docs/GarbageCollection.html b/docs/GarbageCollection.html
index 20f2c96a2b5..5bc70f1bb01 100644
--- a/docs/GarbageCollection.html
+++ b/docs/GarbageCollection.html
@@ -1253,7 +1253,7 @@ methods. Here's a realistic example:</p>
>#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Function.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetAsmInfo.h"
void MyGCPrinter::beginAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
@@ -1266,7 +1266,7 @@ void MyGCPrinter::finishAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
// Set up for emitting addresses.
const char *AddressDirective;
int AddressAlignLog;
- if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) {
+ if (AP.TM.getDataLayout()->getPointerSize() == sizeof(int32_t)) {
AddressDirective = TAI.getData32bitsDirective();
AddressAlignLog = 2;
} else {
diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html
deleted file mode 100644
index c91cb03d18c..00000000000
--- a/docs/GettingStarted.html
+++ /dev/null
@@ -1,1760 +0,0 @@
-<!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>Getting Started with LLVM System</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-<body>
-
-<h1>
- Getting Started with the LLVM System
-</h1>
-
-<ul>
- <li><a href="#overview">Overview</a>
- <li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
- <li><a href="#requirements">Requirements</a>
- <ol>
- <li><a href="#hardware">Hardware</a></li>
- <li><a href="#software">Software</a></li>
- <li><a href="#brokengcc">Broken versions of GCC and other tools</a></li>
- </ol></li>
-
- <li><a href="#starting">Getting Started with LLVM</a>
- <ol>
- <li><a href="#terminology">Terminology and Notation</a></li>
- <li><a href="#environment">Setting Up Your Environment</a></li>
- <li><a href="#unpack">Unpacking the LLVM Archives</a></li>
- <li><a href="#checkout">Checkout LLVM from Subversion</a></li>
- <li><a href="#git_mirror">LLVM GIT mirror</a></li>
- <li><a href="#config">Local LLVM Configuration</a></li>
- <li><a href="#compile">Compiling the LLVM Suite Source Code</a></li>
- <li><a href="#cross-compile">Cross-Compiling LLVM</a></li>
- <li><a href="#objfiles">The Location of LLVM Object Files</a></li>
- <li><a href="#optionalconfig">Optional Configuration Items</a></li>
- </ol></li>
-
- <li><a href="#layout">Program layout</a>
- <ol>
- <li><a href="#examples"><tt>llvm/examples</tt></a></li>
- <li><a href="#include"><tt>llvm/include</tt></a></li>
- <li><a href="#lib"><tt>llvm/lib</tt></a></li>
- <li><a href="#projects"><tt>llvm/projects</tt></a></li>
- <li><a href="#runtime"><tt>llvm/runtime</tt></a></li>
- <li><a href="#test"><tt>llvm/test</tt></a></li>
- <li><a href="#test-suite"><tt>test-suite</tt></a></li>
- <li><a href="#tools"><tt>llvm/tools</tt></a></li>
- <li><a href="#utils"><tt>llvm/utils</tt></a></li>
- </ol></li>
-
- <li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
- <ol>
- <li><a href="#tutorial4">Example with Clang</a></li>
- </ol>
- <li><a href="#problems">Common Problems</a>
- <li><a href="#links">Links</a>
-</ul>
-
-<div class="doc_author">
- <p>Written by:
- <a href="mailto:criswell@uiuc.edu">John Criswell</a>,
- <a href="mailto:sabre@nondot.org">Chris Lattner</a>,
- <a href="http://misha.brukman.net/">Misha Brukman</a>,
- <a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a>, and
- <a href="mailto:gshi1@uiuc.edu">Guochun Shi</a>.
- </p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="overview">Overview</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Welcome to LLVM! In order to get started, you first need to know some
-basic information.</p>
-
-<p>First, LLVM comes in three pieces. The first piece is the LLVM
-suite. This contains all of the tools, libraries, and header files
-needed to use LLVM. It contains an assembler, disassembler, bitcode
-analyzer and bitcode optimizer. It also contains basic regression tests that
-can be used to test the LLVM tools and the Clang front end.</p>
-
-<p>The second piece is the <a href="http://clang.llvm.org/">Clang</a> front end.
-This component compiles C, C++, Objective C, and Objective C++ code into LLVM
-bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the
-LLVM tools from the LLVM suite.
-</p>
-
-<p>
-There is a third, optional piece called Test Suite. It is a suite of programs
-with a testing harness that can be used to further test LLVM's functionality
-and performance.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="quickstart">Getting Started Quickly (A Summary)</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>The LLVM Getting Started documentation may be out of date. So, the Clang
-<a href="http://clang.llvm.org/get_started.html">Getting Started</a> page might
-also be a good place to start.</p>
-
-<p>Here's the short story for getting up and running quickly with LLVM:</p>
-
-<ol>
- <li>Read the documentation.</li>
- <li>Read the documentation.</li>
- <li>Remember that you were warned twice about reading the documentation.</li>
-
- <li>Checkout LLVM:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
- </ul>
- </li>
-
- <li>Checkout Clang:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/tools</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
- </ul>
- </li>
-
- <li>Checkout Compiler-RT:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/projects</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
- compiler-rt</tt></li>
- </ul>
- </li>
-
- <li>Get the Test Suite Source Code <b>[Optional]</b>
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/projects</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite</tt></li>
- </ul>
- </li>
-
- <li>Configure and build LLVM and Clang:
- <ul>
- <li><tt>cd <i>where-you-want-to-build-llvm</i></tt></li>
- <li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
- <li><tt>cd build</tt></li>
- <li><tt>../llvm/configure [options]</tt>
- <br>Some common options:
-
- <ul>
- <li><tt>--prefix=<i>directory</i></tt> -
- Specify for <i>directory</i> the full pathname of where you
- want the LLVM tools and libraries to be installed (default
- <tt>/usr/local</tt>).</li>
- </ul>
-
- <ul>
- <li><tt>--enable-optimized</tt> -
- Compile with optimizations enabled (default is NO).</li>
- </ul>
-
- <ul>
- <li><tt>--enable-assertions</tt> -
- Compile with assertion checks enabled (default is YES).</li>
- </ul>
- </li>
- <li><tt>make [-j]</tt> - The -j specifies the number of jobs (commands) to
- run simultaneously. This builds both LLVM and Clang for Debug+Asserts mode.
- The --enabled-optimized configure option is used to specify a Release build.</li>
- <li><tt>make check-all</tt> -
- This run the regression tests to ensure everything is in working order.</li>
- <li><tt>make update</tt> -
- This command is used to update all the svn repositories at once, rather then
- having to <tt>cd</tt> into the individual repositories and running
- <tt>svn update</tt>.</li>
- <li>It is also possible to use CMake instead of the makefiles. With CMake
- it is also possible to generate project files for several IDEs: Eclipse
- CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</li>
- <li>If you get an "internal compiler error (ICE)" or test failures, see
- <a href="#brokengcc">below</a>.</li>
-
- </ul>
- </li>
-
-</ol>
-
-<p>Consult the <a href="#starting">Getting Started with LLVM</a> section for
-detailed information on configuring and compiling LLVM. See <a
-href="#environment">Setting Up Your Environment</a> for tips that simplify
-working with the Clang front end and LLVM tools. Go to <a href="#layout">Program
-Layout</a> to learn about the layout of the source code tree.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="requirements">Requirements</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Before you begin to use the LLVM system, review the requirements given below.
-This may save you some trouble by knowing ahead of time what hardware and
-software you will need.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="hardware">Hardware</a>
-</h3>
-
-<div>
-
-<p>LLVM is known to work on the following platforms:</p>
-
-<table cellpadding="3" summary="Known LLVM platforms">
-<tr>
- <th>OS</th>
- <th>Arch</th>
- <th>Compilers</th>
-</tr>
-<tr>
- <td>AuroraUX</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux</td>
- <td>amd64</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Solaris</td>
- <td>V9 (Ultrasparc)</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>FreeBSD</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>FreeBSD</td>
- <td>amd64</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>MacOS X<sup><a href="#pf_2">2</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>MacOS X<sup><a href="#pf_2">2</a>,<a href="#pf_9">9</a></sup></td>
- <td>x86</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Cygwin/Win32</td>
- <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_8">8</a>,
- <a href="#pf_11">11</a></sup></td>
- <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-<tr>
- <td>MinGW/Win32</td>
- <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_6">6</a>,
- <a href="#pf_8">8</a>, <a href="#pf_10">10</a>,
- <a href="#pf_11">11</a></sup></td>
- <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-</table>
-
-<p>LLVM has partial support for the following platforms:</p>
-
-<table summary="LLVM partial platform support">
-<tr>
- <th>OS</th>
- <th>Arch</th>
- <th>Compilers</th>
-</tr>
-<tr>
- <td>Windows</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>Visual Studio 2008 or higher<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
-<tr>
- <td>AIX<sup><a href="#pf_3">3</a>,<a href="#pf_4">4</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux<sup><a href="#pf_3">3</a>,<a href="#pf_5">5</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-
-<tr>
- <td>Linux<sup><a href="#pf_7">7</a></sup></td>
- <td>Alpha</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux<sup><a href="#pf_7">7</a></sup></td>
- <td>Itanium (IA-64)</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>HP-UX<sup><a href="#pf_7">7</a></sup></td>
- <td>Itanium (IA-64)</td>
- <td>HP aCC</td>
-</tr>
-<tr>
- <td>Windows x64</td>
- <td>x86-64</td>
- <td>mingw-w64's GCC-4.5.x<sup><a href="#pf_12">12</a></sup></td>
-</tr>
-</table>
-
-<p><b>Notes:</b></p>
-
-<div class="doc_notes">
-<ol>
-<li><a name="pf_1">Code generation supported for Pentium processors and
-up</a></li>
-<li><a name="pf_2">Code generation supported for 32-bit ABI only</a></li>
-<li><a name="pf_3">No native code generation</a></li>
-<li><a name="pf_4">Build is not complete: one or more tools do not link or function</a></li>
-<li><a name="pf_5">The GCC-based C/C++ frontend does not build</a></li>
-<li><a name="pf_6">The port is done using the MSYS shell.</a></li>
-<li><a name="pf_7">Native code generation exists but is not complete.</a></li>
-<li><a name="pf_8">Binutils 2.20 or later is required to build the assembler
- generated by LLVM properly.</a></li>
-<li><a name="pf_9">Xcode 2.5 and gcc 4.0.1</a> (Apple Build 5370) will trip
- internal LLVM assert messages when compiled for Release at optimization
- levels greater than 0 (i.e., <i>"-O1"</i> and higher).
- Add <i>OPTIMIZE_OPTION="-O0"</i> to the build command line
- if compiling for LLVM Release or bootstrapping the LLVM toolchain.</li>
-<li><a name="pf_10">For MSYS/MinGW on Windows, be sure to install the MSYS
- version of the perl package, and be sure it appears in your path
- before any Windows-based versions such as Strawberry Perl and
- ActivePerl, as these have Windows-specifics that will cause the
- build to fail.</a></li>
-<li><a name="pf_11">To use LLVM modules on Win32-based system,
- you may configure LLVM with <i>&quot;--enable-shared&quot;</i>.</a></li>
-<li><a name="pf_12">To compile SPU backend, you need to add
- <tt>&quot;LDFLAGS=-Wl,--stack,16777216&quot;</tt> to configure.</a></li>
-</ol>
-</div>
-
-<p>Note that you will need about 1-3 GB of space for a full LLVM build in Debug
-mode, depending on the system (it is so large because of all the debugging
-information and the fact that the libraries are statically linked into multiple
-tools). If you do not need many of the tools and you are space-conscious, you
-can pass <tt>ONLY_TOOLS="tools you need"</tt> to make. The Release build
-requires considerably less space.</p>
-
-<p>The LLVM suite <i>may</i> compile on other platforms, but it is not
-guaranteed to do so. If compilation is successful, the LLVM utilities should be
-able to assemble, disassemble, analyze, and optimize LLVM bitcode. Code
-generation should work as well, although the generated native code may not work
-on your platform.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="software">Software</a>
-</h3>
-<div>
- <p>Compiling LLVM requires that you have several software packages
- installed. The table below lists those required packages. The Package column
- is the usual name for the software package that LLVM depends on. The Version
- column provides "known to work" versions of the package. The Notes column
- describes how LLVM uses the package and provides other details.</p>
- <table summary="Packages required to compile LLVM">
- <tr><th>Package</th><th>Version</th><th>Notes</th></tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/make">GNU Make</a></td>
- <td>3.79, 3.79.1</td>
- <td>Makefile/build processor</td>
- </tr>
-
- <tr>
- <td><a href="http://gcc.gnu.org/">GCC</a></td>
- <td>3.4.2</td>
- <td>C/C++ compiler<sup><a href="#sf1">1</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/texinfo/">TeXinfo</a></td>
- <td>4.5</td>
- <td>For building the CFE</td>
- </tr>
-
- <tr>
- <td><a href="http://subversion.tigris.org/project_packages.html">SVN</a></td>
- <td>&ge;1.3</td>
- <td>Subversion access to LLVM<sup><a href="#sf2">2</a></sup></td>
- </tr>
-
- <!-- FIXME:
- Do we support dg?
- Are DejaGnu and expect obsolete?
- Shall we mention Python? -->
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/dejagnu">DejaGnu</a></td>
- <td>1.4.2</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.tcl.tk/software/tcltk/">tcl</a></td>
- <td>8.3, 8.4</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://expect.nist.gov/">expect</a></td>
- <td>5.38.0</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.perl.com/download.csp">perl</a></td>
- <td>&ge;5.6.0</td>
- <td>Utilities</td>
- </tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/m4">GNU M4</a>
- <td>1.4</td>
- <td>Macro processor for configuration<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/autoconf/">GNU Autoconf</a></td>
- <td>2.60</td>
- <td>Configuration script builder<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/automake/">GNU Automake</a></td>
- <td>1.9.6</td>
- <td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/libtool">libtool</a></td>
- <td>1.5.22</td>
- <td>Shared library manager<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- </table>
-
- <p><b>Notes:</b></p>
- <div class="doc_notes">
- <ol>
- <li><a name="sf1">Only the C and C++ languages are needed so there's no
- need to build the other languages for LLVM's purposes.</a> See
- <a href="#brokengcc">below</a> for specific version info.</li>
- <li><a name="sf2">You only need Subversion if you intend to build from the
- latest LLVM sources. If you're working from a release distribution, you
- don't need Subversion.</a></li>
- <li><a name="sf3">Only needed if you want to run the automated test
- suite in the <tt>llvm/test</tt> directory.</a></li>
- <li><a name="sf4">If you want to make changes to the configure scripts,
- you will need GNU autoconf (2.60), and consequently, GNU M4 (version 1.4
- or higher). You will also need automake (1.9.6). We only use aclocal
- from that package.</a></li>
- </ol>
- </div>
-
- <p>Additionally, your compilation host is expected to have the usual
- plethora of Unix utilities. Specifically:</p>
- <ul>
- <li><b>ar</b> - archive library builder</li>
- <li><b>bzip2*</b> - bzip2 command for distribution generation</li>
- <li><b>bunzip2*</b> - bunzip2 command for distribution checking</li>
- <li><b>chmod</b> - change permissions on a file</li>
- <li><b>cat</b> - output concatenation utility</li>
- <li><b>cp</b> - copy files</li>
- <li><b>date</b> - print the current date/time </li>
- <li><b>echo</b> - print to standard output</li>
- <li><b>egrep</b> - extended regular expression search utility</li>
- <li><b>find</b> - find files/dirs in a file system</li>
- <li><b>grep</b> - regular expression search utility</li>
- <li><b>gzip*</b> - gzip command for distribution generation</li>
- <li><b>gunzip*</b> - gunzip command for distribution checking</li>
- <li><b>install</b> - install directories/files </li>
- <li><b>mkdir</b> - create a directory</li>
- <li><b>mv</b> - move (rename) files</li>
- <li><b>ranlib</b> - symbol table builder for archive libraries</li>
- <li><b>rm</b> - remove (delete) files and directories</li>
- <li><b>sed</b> - stream editor for transforming output</li>
- <li><b>sh</b> - Bourne shell for make build scripts</li>
- <li><b>tar</b> - tape archive for distribution generation</li>
- <li><b>test</b> - test things in file system</li>
- <li><b>unzip*</b> - unzip command for distribution checking</li>
- <li><b>zip*</b> - zip command for distribution generation</li>
- </ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="brokengcc">Broken versions of GCC and other tools</a>
-</h3>
-
-<div>
-
-<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
-bugs in the compiler. In particular, several versions of GCC crash when trying
-to compile LLVM. We routinely use GCC 4.2 (and higher) or Clang.
-Other versions of GCC will probably work as well. GCC versions listed
-here are known to not work. If you are using one of these versions, please try
-to upgrade your GCC to something more recent. If you run into a problem with a
-version of GCC not listed here, please <a href="mailto:llvmdev@cs.uiuc.edu">let
-us know</a>. Please use the "<tt>gcc -v</tt>" command to find out which version
-of GCC you are using.
-</p>
-
-<p><b>GCC versions prior to 3.0</b>: GCC 2.96.x and before had several
-problems in the STL that effectively prevent it from compiling LLVM.
-</p>
-
-<p><b>GCC 3.2.2 and 3.2.3</b>: These versions of GCC fails to compile LLVM with
-a bogus template error. This was fixed in later GCCs.</p>
-
-<p><b>GCC 3.3.2</b>: This version of GCC suffered from a <a
-href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in
-the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
-
-<p><b>Cygwin GCC 3.3.3</b>: The version of GCC 3.3.3 commonly shipped with
- Cygwin does not work.</p>
-<p><b>SuSE GCC 3.3.3</b>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and
- possibly others) does not compile LLVM correctly (it appears that exception
- handling is broken in some cases). Please download the FSF 3.3.3 or upgrade
- to a newer version of GCC.</p>
-<p><b>GCC 3.4.0 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
- code generator, causing an infinite loop in the llvm-gcc build when built
- with optimizations enabled (i.e. a release build).</p>
-<p><b>GCC 3.4.2 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
- code generator at -O3, as with 3.4.0. However gcc 3.4.2 (unlike 3.4.0)
- correctly compiles LLVM at -O2. A work around is to build release LLVM
- builds with "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ..."</p>
-<p><b>GCC 3.4.x on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1056">
- miscompiles portions of LLVM</a>.</p>
-<p><b>GCC 3.4.4 (CodeSourcery ARM 2005q3-2)</b>: this compiler miscompiles LLVM
- when building with optimizations enabled. It appears to work with
- "<tt>make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1</tt>" or build a debug
- build.</p>
-<p><b>IA-64 GCC 4.0.0</b>: The IA-64 version of GCC 4.0.0 is known to
- miscompile LLVM.</p>
-<p><b>Apple Xcode 2.3</b>: GCC crashes when compiling LLVM at -O3 (which is the
- default with ENABLE_OPTIMIZED=1. To work around this, build with
- "ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2".</p>
-<p><b>GCC 4.1.1</b>: GCC fails to build LLVM with template concept check errors
- compiling some files. At the time of this writing, GCC mainline (4.2)
- did not share the problem.</p>
-<p><b>GCC 4.1.1 on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1063">
- miscompiles portions of LLVM</a> when compiling llvm itself into 64-bit
- code. LLVM will appear to mostly work but will be buggy, e.g. failing
- portions of its testsuite.</p>
-<p><b>GCC 4.1.2 on OpenSUSE</b>: Seg faults during libstdc++ build and on x86_64
-platforms compiling md5.c gets a mangled constant.</p>
-<p><b>GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian</b>: Appears
-to miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining
-about symbols remaining in the table on destruction.</p>
-<p><b>GCC 4.1.2 20071124 (Red Hat 4.1.2-42)</b>: Suffers from the same symptoms
-as the previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).</p>
-<p><b>Cygwin GCC 4.3.2 20080827 (beta) 2</b>:
- Users <a href="http://llvm.org/PR4145">reported</a> various problems related
- with link errors when using this GCC version.</p>
-<p><b>Debian GCC 4.3.2 on X86</b>: Crashes building some files in LLVM 2.6.</p>
-<p><b>GCC 4.3.3 (Debian 4.3.3-10) on ARM</b>: Miscompiles parts of LLVM 2.6
-when optimizations are turned on. The symptom is an infinite loop in
-FoldingSetImpl::RemoveNode while running the code generator.</p>
-<p><b>SUSE 11 GCC 4.3.4</b>: Miscompiles LLVM, causing crashes in ValueHandle logic.</p>
-<p><b>GCC 4.3.5 and GCC 4.4.5 on ARM</b>: These can miscompile <tt>value >>
-1</tt> even at -O0. A test failure in <tt>test/Assembler/alignstack.ll</tt> is
-one symptom of the problem.
-<p><b>GNU ld 2.16.X</b>. Some 2.16.X versions of the ld linker will produce very
-long warning messages complaining that some ".gnu.linkonce.t.*" symbol was
-defined in a discarded section. You can safely ignore these messages as they are
-erroneous and the linkage is correct. These messages disappear using ld
-2.17.</p>
-
-<p><b>GNU binutils 2.17</b>: Binutils 2.17 contains <a
-href="http://sourceware.org/bugzilla/show_bug.cgi?id=3111">a bug</a> which
-causes huge link times (minutes instead of seconds) when building LLVM. We
-recommend upgrading to a newer version (2.17.50.0.4 or later).</p>
-
-<p><b>GNU Binutils 2.19.1 Gold</b>: This version of Gold contained
-<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=9836">a bug</a>
-which causes intermittent failures when building LLVM with position independent
-code. The symptom is an error about cyclic dependencies. We recommend
-upgrading to a newer version of Gold.</p>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="starting">Getting Started with LLVM</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>The remainder of this guide is meant to get you up and running with
-LLVM and to give you some basic information about the LLVM environment.</p>
-
-<p>The later sections of this guide describe the <a
-href="#layout">general layout</a> of the LLVM source tree, a <a
-href="#tutorial">simple example</a> using the LLVM tool chain, and <a
-href="#links">links</a> to find more information about LLVM or to get
-help via e-mail.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="terminology">Terminology and Notation</a>
-</h3>
-
-<div>
-
-<p>Throughout this manual, the following names are used to denote paths
-specific to the local system and working environment. <i>These are not
-environment variables you need to set but just strings used in the rest
-of this document below</i>. In any of the examples below, simply replace
-each of these names with the appropriate pathname on your local system.
-All these paths are absolute:</p>
-
-<dl>
- <dt>SRC_ROOT
- <dd>
- This is the top level directory of the LLVM source tree.
- <br><br>
-
- <dt>OBJ_ROOT
- <dd>
- This is the top level directory of the LLVM object tree (i.e. the
- tree where object files and compiled programs will be placed. It
- can be the same as SRC_ROOT).
- <br><br>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="environment">Setting Up Your Environment</a>
-</h3>
-
-<div>
-
-<p>
-In order to compile and use LLVM, you may need to set some environment
-variables.
-
-<dl>
- <dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bitcode/libs</tt></dt>
- <dd>[Optional] This environment variable helps LLVM linking tools find the
- locations of your bitcode libraries. It is provided only as a
- convenience since you can specify the paths using the -L options of the
- tools and the C/C++ front-end will automatically use the bitcode files
- installed in its
- <tt>lib</tt> directory.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="unpack">Unpacking the LLVM Archives</a>
-</h3>
-
-<div>
-
-<p>
-If you have the LLVM distribution, you will need to unpack it before you
-can begin to compile it. LLVM is distributed as a set of two files: the LLVM
-suite and the LLVM GCC front end compiled for your platform. There is an
-additional test suite that is optional. Each file is a TAR archive that is
-compressed with the gzip program.
-</p>
-
-<p>The files are as follows, with <em>x.y</em> marking the version number:
-<dl>
- <dt><tt>llvm-x.y.tar.gz</tt></dt>
- <dd>Source release for the LLVM libraries and tools.<br></dd>
-
- <dt><tt>llvm-test-x.y.tar.gz</tt></dt>
- <dd>Source release for the LLVM test-suite.</dd>
-
- <dt><tt>llvm-gcc-4.2-x.y.source.tar.gz</tt></dt>
- <dd>Source release of the llvm-gcc-4.2 front end. See README.LLVM in the root
- directory for build instructions.<br></dd>
-
- <dt><tt>llvm-gcc-4.2-x.y-platform.tar.gz</tt></dt>
- <dd>Binary release of the llvm-gcc-4.2 front end for a specific platform.<br></dd>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="checkout">Checkout LLVM from Subversion</a>
-</h3>
-
-<div>
-
-<p>If you have access to our Subversion repository, you can get a fresh copy of
-the entire source code. All you need to do is check it out from Subversion as
-follows:</p>
-
-<ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
- <li>Read-Only: <tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
- <li>Read-Write:<tt>svn co https://user@llvm.org/svn/llvm-project/llvm/trunk
- llvm</tt></li>
-</ul>
-
-
-<p>This will create an '<tt>llvm</tt>' directory in the current
-directory and fully populate it with the LLVM source code, Makefiles,
-test directories, and local copies of documentation files.</p>
-
-<p>If you want to get a specific release (as opposed to the most recent
-revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
-'<tt>trunk</tt>'). The following releases are located in the following
-subdirectories of the '<tt>tags</tt>' directory:</p>
-
-<ul>
-<li>Release 3.1: <b>RELEASE_31/final</b></li>
-<li>Release 3.0: <b>RELEASE_30/final</b></li>
-<li>Release 2.9: <b>RELEASE_29/final</b></li>
-<li>Release 2.8: <b>RELEASE_28</b></li>
-<li>Release 2.7: <b>RELEASE_27</b></li>
-<li>Release 2.6: <b>RELEASE_26</b></li>
-<li>Release 2.5: <b>RELEASE_25</b></li>
-<li>Release 2.4: <b>RELEASE_24</b></li>
-<li>Release 2.3: <b>RELEASE_23</b></li>
-<li>Release 2.2: <b>RELEASE_22</b></li>
-<li>Release 2.1: <b>RELEASE_21</b></li>
-<li>Release 2.0: <b>RELEASE_20</b></li>
-<li>Release 1.9: <b>RELEASE_19</b></li>
-<li>Release 1.8: <b>RELEASE_18</b></li>
-<li>Release 1.7: <b>RELEASE_17</b></li>
-<li>Release 1.6: <b>RELEASE_16</b></li>
-<li>Release 1.5: <b>RELEASE_15</b></li>
-<li>Release 1.4: <b>RELEASE_14</b></li>
-<li>Release 1.3: <b>RELEASE_13</b></li>
-<li>Release 1.2: <b>RELEASE_12</b></li>
-<li>Release 1.1: <b>RELEASE_11</b></li>
-<li>Release 1.0: <b>RELEASE_1</b></li>
-</ul>
-
-<p>If you would like to get the LLVM test suite (a separate package as of 1.4),
-you get it from the Subversion repository:</p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects
-% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
-</pre>
-</div>
-
-<p>By placing it in the <tt>llvm/projects</tt>, it will be automatically
-configured by the LLVM configure script as well as automatically updated when
-you run <tt>svn update</tt>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="git_mirror">GIT mirror</a>
-</h3>
-
-<div>
-
-<p>GIT mirrors are available for a number of LLVM subprojects. These mirrors
- sync automatically with each Subversion commit and contain all necessary
- git-svn marks (so, you can recreate git-svn metadata locally). Note that right
- now mirrors reflect only <tt>trunk</tt> for each project. You can do the
- read-only GIT clone of LLVM via:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-</pre>
-
-<p>If you want to check out clang too, run:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-cd llvm/tools
-git clone http://llvm.org/git/clang.git
-</pre>
-
-<p>
-Since the upstream repository is in Subversion, you should use
-<tt>&quot;git pull --rebase&quot;</tt>
-instead of <tt>&quot;git pull&quot;</tt> to avoid generating a non-linear
-history in your clone.
-To configure <tt>&quot;git pull&quot;</tt> to pass <tt>--rebase</tt> by default
-on the master branch, run the following command:
-</p>
-
-<pre class="doc_code">
-git config branch.master.rebase true
-</pre>
-
-<h4>Sending patches with Git</h4>
-<div>
-<p>
-Please read <a href="DeveloperPolicy.html#patches">Developer Policy</a>, too.
-</p>
-
-<p>
-Assume <tt>master</tt> points the upstream and <tt>mybranch</tt> points your
-working branch, and <tt>mybranch</tt> is rebased onto <tt>master</tt>.
-At first you may check sanity of whitespaces:
-</p>
-
-<pre class="doc_code">
-git diff --check master..mybranch
-</pre>
-
-<p>
-The easiest way to generate a patch is as below:
-</p>
-
-<pre class="doc_code">
-git diff master..mybranch &gt; /path/to/mybranch.diff
-</pre>
-
-<p>
-It is a little different from svn-generated diff. git-diff-generated diff has
-prefixes like <tt>a/</tt> and <tt>b/</tt>. Don't worry, most developers might
-know it could be accepted with <tt>patch -p1 -N</tt>.
-</p>
-
-<p>
-But you may generate patchset with git-format-patch. It generates
-by-each-commit patchset. To generate patch files to attach to your article:
-</p>
-
-<pre class="doc_code">
-git format-patch --no-attach master..mybranch -o /path/to/your/patchset
-</pre>
-
-<p>
-If you would like to send patches directly, you may use git-send-email or
-git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
-</p>
-
-<pre class="doc_code">
-git format-patch --attach master..mybranch --stdout | git imap-send
-</pre>
-
-<p>
-Then, your .git/config should have [imap] sections.
-</p>
-
-<pre class="doc_code">
-[imap]
- host = imaps://imap.gmail.com
- user = <em>your.gmail.account</em>@gmail.com
- pass = <em>himitsu!</em>
- port = 993
- sslverify = false
-; in English
- folder = "[Gmail]/Drafts"
-; example for Japanese, "Modified UTF-7" encoded.
- folder = "[Gmail]/&amp;Tgtm+DBN-"
-; example for Traditional Chinese
- folder = "[Gmail]/&amp;g0l6Pw-"
-</pre>
-
-</div>
-
-<h4>For developers to work with git-svn</h4>
-<div>
-
-<p>To set up clone from which you can submit code using
- <tt>git-svn</tt>, run:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-cd llvm
-git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=&lt;username>
-git config svn-remote.svn.fetch :refs/remotes/origin/master
-git svn rebase -l # -l avoids fetching ahead of the git mirror.
-
-# If you have clang too:
-cd tools
-git clone http://llvm.org/git/clang.git
-cd clang
-git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username=&lt;username>
-git config svn-remote.svn.fetch :refs/remotes/origin/master
-git svn rebase -l
-</pre>
-
-<p>To update this clone without generating git-svn tags that conflict
-with the upstream git repo, run:</p>
-
-<pre class="doc_code">
-git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
-git checkout master
-git svn rebase -l
-(cd tools/clang &&
- git checkout master &&
- git svn rebase -l)
-</pre>
-
-<p>This leaves your working directories on their master branches, so
-you'll need to <tt>checkout</tt> each working branch individually and
-<tt>rebase</tt> it on top of its parent branch. (Note: This script is
-intended for relative newbies to git. If you have more experience,
-you can likely improve on it.)</p>
-
-<p>The git-svn metadata can get out of sync after you mess around with
-branches and <code>dcommit</code>. When that happens, <code>git svn
-dcommit</code> stops working, complaining about files with uncommitted
-changes. The fix is to rebuild the metadata:</p>
-
-<pre class="doc_code">
-rm -rf .git/svn
-git svn rebase -l
-</pre>
-
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="config">Local LLVM Configuration</a>
-</h3>
-
-<div>
-
- <p>Once checked out from the Subversion repository, the LLVM suite source
- code must be
-configured via the <tt>configure</tt> script. This script sets variables in the
-various <tt>*.in</tt> files, most notably <tt>llvm/Makefile.config</tt> and
-<tt>llvm/include/Config/config.h</tt>. It also populates <i>OBJ_ROOT</i> with
-the Makefiles needed to begin building LLVM.</p>
-
-<p>The following environment variables are used by the <tt>configure</tt>
-script to configure the build system:</p>
-
-<table summary="LLVM configure script environment variables">
- <tr><th>Variable</th><th>Purpose</th></tr>
- <tr>
- <td>CC</td>
- <td>Tells <tt>configure</tt> which C compiler to use. By default,
- <tt>configure</tt> will look for the first GCC C compiler in
- <tt>PATH</tt>. Use this variable to override
- <tt>configure</tt>'s default behavior.</td>
- </tr>
- <tr>
- <td>CXX</td>
- <td>Tells <tt>configure</tt> which C++ compiler to use. By default,
- <tt>configure</tt> will look for the first GCC C++ compiler in
- <tt>PATH</tt>. Use this variable to override
- <tt>configure</tt>'s default behavior.</td>
- </tr>
-</table>
-
-<p>The following options can be used to set or enable LLVM specific options:</p>
-
-<dl>
- <dt><i>--enable-optimized</i></dt>
- <dd>
- Enables optimized compilation (debugging symbols are removed
- and GCC optimization flags are enabled). Note that this is the default
- setting if you are using the LLVM distribution. The default behavior
- of an Subversion checkout is to use an unoptimized build (also known as a
- debug build).
- <br><br>
- </dd>
- <dt><i>--enable-debug-runtime</i></dt>
- <dd>
- Enables debug symbols in the runtime libraries. The default is to strip
- debug symbols from the runtime libraries.
- </dd>
- <dt><i>--enable-jit</i></dt>
- <dd>
- Compile the Just In Time (JIT) compiler functionality. This is not
- available
- on all platforms. The default is dependent on platform, so it is best
- to explicitly enable it if you want it.
- <br><br>
- </dd>
- <dt><i>--enable-targets=</i><tt>target-option</tt></dt>
- <dd>Controls which targets will be built and linked into llc. The default
- value for <tt>target_options</tt> is "all" which builds and links all
- available targets. The value "host-only" can be specified to build only a
- native compiler (no cross-compiler targets available). The "native" target is
- selected as the target of the build host. You can also specify a comma
- separated list of target names that you want available in llc. The target
- names use all lower case. The current set of targets is: <br>
- <tt>arm, cpp, hexagon, mblaze, mips, mipsel, msp430, powerpc, ptx, sparc, spu, x86, x86_64, xcore</tt>.
- <br><br></dd>
- <dt><i>--enable-doxygen</i></dt>
- <dd>Look for the doxygen program and enable construction of doxygen based
- documentation from the source code. This is disabled by default because
- generating the documentation can take a long time and producess 100s of
- megabytes of output.</dd>
- <dt><i>--with-udis86</i></dt>
- <dd>LLVM can use external disassembler library for various purposes (now it's
- used only for examining code produced by JIT). This option will enable usage
- of <a href="http://udis86.sourceforge.net/">udis86</a> x86 (both 32 and 64
- bits) disassembler library.</dd>
-</dl>
-
-<p>To configure LLVM, follow these steps:</p>
-
-<ol>
- <li><p>Change directory into the object root directory:</p>
-
- <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
- <li><p>Run the <tt>configure</tt> script located in the LLVM source
- tree:</p>
-
- <div class="doc_code">
- <pre>% <i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</pre>
- </div></li>
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="compile">Compiling the LLVM Suite Source Code</a>
-</h3>
-
-<div>
-
-<p>Once you have configured LLVM, you can build it. There are three types of
-builds:</p>
-
-<dl>
- <dt>Debug Builds
- <dd>
- These builds are the default when one is using an Subversion checkout and
- types <tt>gmake</tt> (unless the <tt>--enable-optimized</tt> option was
- used during configuration). The build system will compile the tools and
- libraries with debugging information. To get a Debug Build using the
- LLVM distribution the <tt>--disable-optimized</tt> option must be passed
- to <tt>configure</tt>.
- <br><br>
-
- <dt>Release (Optimized) Builds
- <dd>
- These builds are enabled with the <tt>--enable-optimized</tt> option to
- <tt>configure</tt> or by specifying <tt>ENABLE_OPTIMIZED=1</tt> on the
- <tt>gmake</tt> command line. For these builds, the build system will
- compile the tools and libraries with GCC optimizations enabled and strip
- debugging information from the libraries and executables it generates.
- Note that Release Builds are default when using an LLVM distribution.
- <br><br>
-
- <dt>Profile Builds
- <dd>
- These builds are for use with profiling. They compile profiling
- information into the code for use with programs like <tt>gprof</tt>.
- Profile builds must be started by specifying <tt>ENABLE_PROFILING=1</tt>
- on the <tt>gmake</tt> command line.
-</dl>
-
-<p>Once you have LLVM configured, you can build it by entering the
-<i>OBJ_ROOT</i> directory and issuing the following command:</p>
-
-<div class="doc_code"><pre>% gmake</pre></div>
-
-<p>If the build fails, please <a href="#brokengcc">check here</a> to see if you
-are using a version of GCC that is known not to compile LLVM.</p>
-
-<p>
-If you have multiple processors in your machine, you may wish to use some of
-the parallel build options provided by GNU Make. For example, you could use the
-command:</p>
-
-<div class="doc_code"><pre>% gmake -j2</pre></div>
-
-<p>There are several special targets which are useful when working with the LLVM
-source code:</p>
-
-<dl>
- <dt><tt>gmake clean</tt>
- <dd>
- Removes all files generated by the build. This includes object files,
- generated C/C++ files, libraries, and executables.
- <br><br>
-
- <dt><tt>gmake dist-clean</tt>
- <dd>
- Removes everything that <tt>gmake clean</tt> does, but also removes files
- generated by <tt>configure</tt>. It attempts to return the source tree to the
- original state in which it was shipped.
- <br><br>
-
- <dt><tt>gmake install</tt>
- <dd>
- Installs LLVM header files, libraries, tools, and documentation in a
- hierarchy
- under $PREFIX, specified with <tt>./configure --prefix=[dir]</tt>, which
- defaults to <tt>/usr/local</tt>.
- <br><br>
-
- <dt><tt>gmake -C runtime install-bytecode</tt>
- <dd>
- Assuming you built LLVM into $OBJDIR, when this command is run, it will
- install bitcode libraries into the GCC front end's bitcode library
- directory. If you need to update your bitcode libraries,
- this is the target to use once you've built them.
- <br><br>
-</dl>
-
-<p>Please see the <a href="MakefileGuide.html">Makefile Guide</a> for further
-details on these <tt>make</tt> targets and descriptions of other targets
-available.</p>
-
-<p>It is also possible to override default values from <tt>configure</tt> by
-declaring variables on the command line. The following are some examples:</p>
-
-<dl>
- <dt><tt>gmake ENABLE_OPTIMIZED=1</tt>
- <dd>
- Perform a Release (Optimized) build.
- <br><br>
-
- <dt><tt>gmake ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</tt>
- <dd>
- Perform a Release (Optimized) build without assertions enabled.
- <br><br>
-
- <dt><tt>gmake ENABLE_OPTIMIZED=0</tt>
- <dd>
- Perform a Debug build.
- <br><br>
-
- <dt><tt>gmake ENABLE_PROFILING=1</tt>
- <dd>
- Perform a Profiling build.
- <br><br>
-
- <dt><tt>gmake VERBOSE=1</tt>
- <dd>
- Print what <tt>gmake</tt> is doing on standard output.
- <br><br>
-
- <dt><tt>gmake TOOL_VERBOSE=1</tt></dt>
- <dd>Ask each tool invoked by the makefiles to print out what it is doing on
- the standard output. This also implies <tt>VERBOSE=1</tt>.
- <br><br></dd>
-</dl>
-
-<p>Every directory in the LLVM object tree includes a <tt>Makefile</tt> to build
-it and any subdirectories that it contains. Entering any directory inside the
-LLVM object tree and typing <tt>gmake</tt> should rebuild anything in or below
-that directory that is out of date.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="cross-compile">Cross-Compiling LLVM</a>
-</h3>
-
-<div>
- <p>It is possible to cross-compile LLVM itself. That is, you can create LLVM
- executables and libraries to be hosted on a platform different from the
- platform where they are build (a Canadian Cross build). To configure a
- cross-compile, supply the configure script with <tt>--build</tt> and
- <tt>--host</tt> options that are different. The values of these options must
- be legal target triples that your GCC compiler supports.</p>
-
- <p>The result of such a build is executables that are not runnable on
- on the build host (--build option) but can be executed on the compile host
- (--host option).</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="objfiles">The Location of LLVM Object Files</a>
-</h3>
-
-<div>
-
-<p>The LLVM build system is capable of sharing a single LLVM source tree among
-several LLVM builds. Hence, it is possible to build LLVM for several different
-platforms or configurations using the same source tree.</p>
-
-<p>This is accomplished in the typical autoconf manner:</p>
-
-<ul>
- <li><p>Change directory to where the LLVM object files should live:</p>
-
- <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
- <li><p>Run the <tt>configure</tt> script found in the LLVM source
- directory:</p>
-
- <div class="doc_code"><pre>% <i>SRC_ROOT</i>/configure</pre></div></li>
-</ul>
-
-<p>The LLVM build will place files underneath <i>OBJ_ROOT</i> in directories
-named after the build type:</p>
-
-<dl>
- <dt>Debug Builds with assertions enabled (the default)
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Debug+Asserts/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Debug+Asserts/lib</tt>
- </dl>
- <br><br>
-
- <dt>Release Builds
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Release/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Release/lib</tt>
- </dl>
- <br><br>
-
- <dt>Profile Builds
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Profile/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Profile/lib</tt>
- </dl>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="optionalconfig">Optional Configuration Items</a>
-</h3>
-
-<div>
-
-<p>
-If you're running on a Linux system that supports the "<a
-href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">binfmt_misc</a>"
-module, and you have root access on the system, you can set your system up to
-execute LLVM bitcode files directly. To do this, use commands like this (the
-first command may not be required if you are already using the module):</p>
-
-<div class="doc_code">
-<pre>
-$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
-$ echo ':llvm:M::BC::/path/to/lli:' &gt; /proc/sys/fs/binfmt_misc/register
-$ chmod u+x hello.bc (if needed)
-$ ./hello.bc
-</pre>
-</div>
-
-<p>
-This allows you to execute LLVM bitcode files directly. On Debian, you
-can also use this command instead of the 'echo' command above:
-</p>
-
-<div class="doc_code">
-<pre>
-$ sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
-</pre>
-</div>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="layout">Program Layout</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>One useful source of information about the LLVM source base is the LLVM <a
-href="http://www.doxygen.org/">doxygen</a> documentation available at <tt><a
-href="http://llvm.org/doxygen/">http://llvm.org/doxygen/</a></tt>.
-The following is a brief introduction to code layout:</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="examples"><tt>llvm/examples</tt></a>
-</h3>
-
-<div>
- <p>This directory contains some simple examples of how to use the LLVM IR and
- JIT.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="include"><tt>llvm/include</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains public header files exported from the LLVM
-library. The three main subdirectories of this directory are:</p>
-
-<dl>
- <dt><tt><b>llvm/include/llvm</b></tt></dt>
- <dd>This directory contains all of the LLVM specific header files. This
- directory also has subdirectories for different portions of LLVM:
- <tt>Analysis</tt>, <tt>CodeGen</tt>, <tt>Target</tt>, <tt>Transforms</tt>,
- etc...</dd>
-
- <dt><tt><b>llvm/include/llvm/Support</b></tt></dt>
- <dd>This directory contains generic support libraries that are provided with
- LLVM but not necessarily specific to LLVM. For example, some C++ STL utilities
- and a Command Line option processing library store their header files here.
- </dd>
-
- <dt><tt><b>llvm/include/llvm/Config</b></tt></dt>
- <dd>This directory contains header files configured by the <tt>configure</tt>
- script. They wrap "standard" UNIX and C header files. Source code can
- include these header files which automatically take care of the conditional
- #includes that the <tt>configure</tt> script generates.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="lib"><tt>llvm/lib</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains most of the source files of the LLVM system. In LLVM,
-almost all code exists in libraries, making it very easy to share code among the
-different <a href="#tools">tools</a>.</p>
-
-<dl>
- <dt><tt><b>llvm/lib/VMCore/</b></tt></dt>
- <dd> This directory holds the core LLVM source files that implement core
- classes like Instruction and BasicBlock.</dd>
-
- <dt><tt><b>llvm/lib/AsmParser/</b></tt></dt>
- <dd>This directory holds the source code for the LLVM assembly language parser
- library.</dd>
-
- <dt><tt><b>llvm/lib/BitCode/</b></tt></dt>
- <dd>This directory holds code for reading and write LLVM bitcode.</dd>
-
- <dt><tt><b>llvm/lib/Analysis/</b></tt><dd>This directory contains a variety of
- different program analyses, such as Dominator Information, Call Graphs,
- Induction Variables, Interval Identification, Natural Loop Identification,
- etc.</dd>
-
- <dt><tt><b>llvm/lib/Transforms/</b></tt></dt>
- <dd> This directory contains the source code for the LLVM to LLVM program
- transformations, such as Aggressive Dead Code Elimination, Sparse Conditional
- Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global
- Elimination, and many others.</dd>
-
- <dt><tt><b>llvm/lib/Target/</b></tt></dt>
- <dd> This directory contains files that describe various target architectures
- for code generation. For example, the <tt>llvm/lib/Target/X86</tt>
- directory holds the X86 machine description while
- <tt>llvm/lib/Target/ARM</tt> implements the ARM backend.</dd>
-
- <dt><tt><b>llvm/lib/CodeGen/</b></tt></dt>
- <dd> This directory contains the major parts of the code generator: Instruction
- Selector, Instruction Scheduling, and Register Allocation.</dd>
-
- <dt><tt><b>llvm/lib/MC/</b></tt></dt>
- <dd>(FIXME: T.B.D.)</dd>
-
- <!--FIXME: obsoleted -->
- <dt><tt><b>llvm/lib/Debugger/</b></tt></dt>
- <dd> This directory contains the source level debugger library that makes
- it possible to instrument LLVM programs so that a debugger could identify
- source code locations at which the program is executing.</dd>
-
- <dt><tt><b>llvm/lib/ExecutionEngine/</b></tt></dt>
- <dd> This directory contains libraries for executing LLVM bitcode directly
- at runtime in both interpreted and JIT compiled fashions.</dd>
-
- <dt><tt><b>llvm/lib/Support/</b></tt></dt>
- <dd> This directory contains the source code that corresponds to the header
- files located in <tt>llvm/include/ADT/</tt>
- and <tt>llvm/include/Support/</tt>.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="projects"><tt>llvm/projects</tt></a>
-</h3>
-
-<div>
- <p>This directory contains projects that are not strictly part of LLVM but are
- shipped with LLVM. This is also the directory where you should create your own
- LLVM-based projects. See <tt>llvm/projects/sample</tt> for an example of how
- to set up your own project.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="runtime"><tt>llvm/runtime</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains libraries which are compiled into LLVM bitcode and
-used when linking programs with the Clang front end. Most of these libraries are
-skeleton versions of real libraries; for example, libc is a stripped down
-version of glibc.</p>
-
-<p>Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front
-end to compile.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="test"><tt>llvm/test</tt></a>
-</h3>
-
-<div>
- <p>This directory contains feature and regression tests and other basic sanity
- checks on the LLVM infrastructure. These are intended to run quickly and cover
- a lot of territory without being exhaustive.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="test-suite"><tt>test-suite</tt></a>
-</h3>
-
-<div>
- <p>This is not a directory in the normal llvm module; it is a separate
- Subversion
- module that must be checked out (usually to <tt>projects/test-suite</tt>).
- This
- module contains a comprehensive correctness, performance, and benchmarking
- test
- suite for LLVM. It is a separate Subversion module because not every LLVM
- user is
- interested in downloading or building such a comprehensive test suite. For
- further details on this test suite, please see the
- <a href="TestingGuide.html">Testing Guide</a> document.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="tools"><tt>llvm/tools</tt></a>
-</h3>
-
-<div>
-
-<p>The <b>tools</b> directory contains the executables built out of the
-libraries above, which form the main part of the user interface. You can
-always get help for a tool by typing <tt>tool_name -help</tt>. The
-following is a brief introduction to the most important tools. More detailed
-information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
-
-<dl>
-
- <dt><tt><b>bugpoint</b></tt></dt>
- <dd><tt>bugpoint</tt> is used to debug
- optimization passes or code generation backends by narrowing down the
- given test case to the minimum number of passes and/or instructions that
- still cause a problem, whether it is a crash or miscompilation. See <a
- href="HowToSubmitABug.html">HowToSubmitABug.html</a> for more information
- on using <tt>bugpoint</tt>.</dd>
-
- <dt><tt><b>llvm-ar</b></tt></dt>
- <dd>The archiver produces an archive containing
- the given LLVM bitcode files, optionally with an index for faster
- lookup.</dd>
-
- <dt><tt><b>llvm-as</b></tt></dt>
- <dd>The assembler transforms the human readable LLVM assembly to LLVM
- bitcode.</dd>
-
- <dt><tt><b>llvm-dis</b></tt></dt>
- <dd>The disassembler transforms the LLVM bitcode to human readable
- LLVM assembly.</dd>
-
- <dt><tt><b>llvm-link</b></tt></dt>
- <dd><tt>llvm-link</tt>, not surprisingly, links multiple LLVM modules into
- a single program.</dd>
-
- <dt><tt><b>lli</b></tt></dt>
- <dd><tt>lli</tt> is the LLVM interpreter, which
- can directly execute LLVM bitcode (although very slowly...). For architectures
- that support it (currently x86, Sparc, and PowerPC), by default, <tt>lli</tt>
- will function as a Just-In-Time compiler (if the functionality was compiled
- in), and will execute the code <i>much</i> faster than the interpreter.</dd>
-
- <dt><tt><b>llc</b></tt></dt>
- <dd> <tt>llc</tt> is the LLVM backend compiler, which
- translates LLVM bitcode to a native code assembly file or to C code (with
- the -march=c option).</dd>
-
- <dt><tt><b>llvm-gcc</b></tt></dt>
- <dd><tt>llvm-gcc</tt> is a GCC-based C frontend that has been retargeted to
- use LLVM as its backend instead of GCC's RTL backend. It can also emit LLVM
- bitcode or assembly (with the <tt>-emit-llvm</tt> option) instead of the
- usual machine code output. It works just like any other GCC compiler,
- taking the typical <tt>-c, -S, -E, -o</tt> options that are typically used.
- Additionally, the source code for <tt>llvm-gcc</tt> is available as a
- separate Subversion module.</dd>
-
- <dt><tt><b>opt</b></tt></dt>
- <dd><tt>opt</tt> reads LLVM bitcode, applies a series of LLVM to LLVM
- transformations (which are specified on the command line), and then outputs
- the resultant bitcode. The '<tt>opt -help</tt>' command is a good way to
- get a list of the program transformations available in LLVM.<br>
- <dd><tt>opt</tt> can also be used to run a specific analysis on an input
- LLVM bitcode file and print out the results. It is primarily useful for
- debugging analyses, or familiarizing yourself with what an analysis does.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="utils"><tt>llvm/utils</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains utilities for working with LLVM source code, and some
-of the utilities are actually required as part of the build process because they
-are code generators for parts of LLVM infrastructure.</p>
-
-<dl>
- <dt><tt><b>codegen-diff</b></tt> <dd><tt>codegen-diff</tt> is a script
- that finds differences between code that LLC generates and code that LLI
- generates. This is a useful tool if you are debugging one of them,
- assuming that the other generates correct output. For the full user
- manual, run <tt>`perldoc codegen-diff'</tt>.<br><br>
-
- <dt><tt><b>emacs/</b></tt> <dd>The <tt>emacs</tt> directory contains
- syntax-highlighting files which will work with Emacs and XEmacs editors,
- providing syntax highlighting support for LLVM assembly files and TableGen
- description files. For information on how to use the syntax files, consult
- the <tt>README</tt> file in that directory.<br><br>
-
- <dt><tt><b>getsrcs.sh</b></tt> <dd>The <tt>getsrcs.sh</tt> script finds
- and outputs all non-generated source files, which is useful if one wishes
- to do a lot of development across directories and does not want to
- individually find each file. One way to use it is to run, for example:
- <tt>xemacs `utils/getsources.sh`</tt> from the top of your LLVM source
- tree.<br><br>
-
- <dt><tt><b>llvmgrep</b></tt></dt>
- <dd>This little tool performs an "egrep -H -n" on each source file in LLVM and
- passes to it a regular expression provided on <tt>llvmgrep</tt>'s command
- line. This is a very efficient way of searching the source base for a
- particular regular expression.</dd>
-
- <dt><tt><b>makellvm</b></tt> <dd>The <tt>makellvm</tt> script compiles all
- files in the current directory and then compiles and links the tool that
- is the first argument. For example, assuming you are in the directory
- <tt>llvm/lib/Target/Sparc</tt>, if <tt>makellvm</tt> is in your path,
- simply running <tt>makellvm llc</tt> will make a build of the current
- directory, switch to directory <tt>llvm/tools/llc</tt> and build it,
- causing a re-linking of LLC.<br><br>
-
- <dt><tt><b>TableGen/</b></tt> <dd>The <tt>TableGen</tt> directory contains
- the tool used to generate register descriptions, instruction set
- descriptions, and even assemblers from common TableGen description
- files.<br><br>
-
- <dt><tt><b>vim/</b></tt> <dd>The <tt>vim</tt> directory contains
- syntax-highlighting files which will work with the VIM editor, providing
- syntax highlighting support for LLVM assembly files and TableGen
- description files. For information on how to use the syntax files, consult
- the <tt>README</tt> file in that directory.<br><br>
-
-</dl>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="tutorial">An Example Using the LLVM Tool Chain</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-<p>This section gives an example of using LLVM with the Clang front end.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="tutorial4">Example with clang</a>
-</h3>
-
-<div>
-
-<ol>
- <li><p>First, create a simple C file, name it 'hello.c':</p>
-
-<div class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-int main() {
- printf("hello world\n");
- return 0;
-}
-</pre></div></li>
-
- <li><p>Next, compile the C file into a native executable:</p>
-
- <div class="doc_code"><pre>% clang hello.c -o hello</pre></div>
-
- <p>Note that clang works just like GCC by default. The standard -S and
- -c arguments work as usual (producing a native .s or .o file,
- respectively).</p></li>
-
- <li><p>Next, compile the C file into a LLVM bitcode file:</p>
-
- <div class="doc_code">
- <pre>% clang -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
-
- <p>The -emit-llvm option can be used with the -S or -c options to emit an
- LLVM ".ll" or ".bc" file (respectively) for the code. This allows you
- to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
- the bitcode file.</p></li>
-
- <li><p>Run the program in both forms. To run the program, use:</p>
-
- <div class="doc_code"><pre>% ./hello</pre></div>
-
- <p>and</p>
-
- <div class="doc_code"><pre>% lli hello.bc</pre></div>
-
- <p>The second examples shows how to invoke the LLVM JIT, <a
- href="CommandGuide/html/lli.html">lli</a>.</p></li>
-
- <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
- code:</p>
-
-<div class="doc_code">
-<pre>llvm-dis &lt; hello.bc | less</pre>
-</div></li>
-
- <li><p>Compile the program to native assembly using the LLC code
- generator:</p>
-
- <div class="doc_code"><pre>% llc hello.bc -o hello.s</pre></div></li>
-
- <li><p>Assemble the native assembly language file into a program:</p>
-
-<div class="doc_code">
-<pre>
-<b>Solaris:</b> % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
-
-<b>Others:</b> % gcc hello.s -o hello.native
-</pre>
-</div></li>
-
- <li><p>Execute the native code program:</p>
-
- <div class="doc_code"><pre>% ./hello.native</pre></div>
-
- <p>Note that using clang to compile directly to native code (i.e. when
- the -emit-llvm option is not present) does steps 6/7/8 for you.</p>
- </li>
-
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="problems">Common Problems</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>If you are having problems building or using LLVM, or if you have any other
-general questions about LLVM, please consult the <a href="FAQ.html">Frequently
-Asked Questions</a> page.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="links">Links</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>This document is just an <b>introduction</b> on how to use LLVM to do
-some simple things... there are many more interesting and complicated things
-that you can do that aren't documented here (but we'll gladly accept a patch
-if you want to write something up!). For more information about LLVM, check
-out:</p>
-
-<ul>
- <li><a href="http://llvm.org/">LLVM homepage</a></li>
- <li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li>
- <li><a href="http://llvm.org/docs/Projects.html">Starting a Project
- that Uses LLVM</a></li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
- <a href="http://llvm.x10sys.com/rspencer/">Reid Spencer</a><br>
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/docs/GettingStarted.rst b/docs/GettingStarted.rst
new file mode 100644
index 00000000000..d78c78f1cc2
--- /dev/null
+++ b/docs/GettingStarted.rst
@@ -0,0 +1,1304 @@
+.. _getting_started:
+
+====================================
+Getting Started with the LLVM System
+====================================
+
+Overview
+========
+
+Welcome to LLVM! In order to get started, you first need to know some basic
+information.
+
+First, LLVM comes in three pieces. The first piece is the LLVM suite. This
+contains all of the tools, libraries, and header files needed to use LLVM. It
+contains an assembler, disassembler, bitcode analyzer and bitcode optimizer. It
+also contains basic regression tests that can be used to test the LLVM tools and
+the Clang front end.
+
+The second piece is the `Clang <http://clang.llvm.org/>`_ front end. This
+component compiles C, C++, Objective C, and Objective C++ code into LLVM
+bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the
+LLVM tools from the LLVM suite.
+
+There is a third, optional piece called Test Suite. It is a suite of programs
+with a testing harness that can be used to further test LLVM's functionality
+and performance.
+
+Getting Started Quickly (A Summary)
+===================================
+
+The LLVM Getting Started documentation may be out of date. So, the `Clang
+Getting Started <http://clang.llvm.org/get_started.html>`_ page might also be a
+good place to start.
+
+Here's the short story for getting up and running quickly with LLVM:
+
+#. Read the documentation.
+#. Read the documentation.
+#. Remember that you were warned twice about reading the documentation.
+#. Checkout LLVM:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+
+#. Checkout Clang:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/tools``
+ * ``svn co http://llvm.org/svn/llvm-project/cfe/trunk clang``
+
+#. Checkout Compiler-RT:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/projects``
+ * ``svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt``
+
+#. Get the Test Suite Source Code **[Optional]**
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/projects``
+ * ``svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite``
+
+#. Configure and build LLVM and Clang:
+
+ * ``cd where-you-want-to-build-llvm``
+ * ``mkdir build`` (for building without polluting the source dir)
+ * ``cd build``
+ * ``../llvm/configure [options]``
+ Some common options:
+
+ * ``--prefix=directory`` ---
+
+ Specify for *directory* the full pathname of where you want the LLVM
+ tools and libraries to be installed (default ``/usr/local``).
+
+ * ``--enable-optimized`` ---
+
+ Compile with optimizations enabled (default is NO).
+
+ * ``--enable-assertions`` ---
+
+ Compile with assertion checks enabled (default is YES).
+
+ * ``make [-j]`` --- The ``-j`` specifies the number of jobs (commands) to run
+ simultaneously. This builds both LLVM and Clang for Debug+Asserts mode.
+ The --enabled-optimized configure option is used to specify a Release
+ build.
+
+ * ``make check-all`` --- This run the regression tests to ensure everything
+ is in working order.
+
+ * ``make update`` --- This command is used to update all the svn repositories
+ at once, rather then having to ``cd`` into the individual repositories and
+ running ``svn update``.
+
+ * It is also possible to use CMake instead of the makefiles. With CMake it is
+ also possible to generate project files for several IDEs: Eclipse CDT4,
+ CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.
+
+ * If you get an "internal compiler error (ICE)" or test failures, see
+ `below`.
+
+Consult the `Getting Started with LLVM`_ section for detailed information on
+configuring and compiling LLVM. See `Setting Up Your Environment`_ for tips
+that simplify working with the Clang front end and LLVM tools. Go to `Program
+Layout`_ to learn about the layout of the source code tree.
+
+Requirements
+============
+
+Before you begin to use the LLVM system, review the requirements given below.
+This may save you some trouble by knowing ahead of time what hardware and
+software you will need.
+
+Hardware
+--------
+
+LLVM is known to work on the following platforms:
+
++-----------------+----------------------+-------------------------+
+|OS | Arch | Compilers |
++=================+======================+=========================+
+|AuroraUX | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|Linux | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|Linux | amd64 | GCC |
++-----------------+----------------------+-------------------------+
+|Solaris | V9 (Ultrasparc) | GCC |
++-----------------+----------------------+-------------------------+
+|FreeBSD | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|FreeBSD | amd64 | GCC |
++-----------------+----------------------+-------------------------+
+|MacOS X\ :sup:`2`| PowerPC | GCC |
++-----------------+----------------------+-------------------------+
+|MacOS X\ :sup:`9`| x86 | GCC |
++-----------------+----------------------+-------------------------+
+|Cygwin/Win32 | x86\ :sup:`1, 8, 11` | GCC 3.4.X, binutils 2.20|
++-----------------+----------------------+-------------------------+
+
+LLVM has partial support for the following platforms:
+
++-------------------+----------------------+-------------------------------------------+
+|OS | Arch | Compilers |
++===================+======================+===========================================+
+| Windows | x86\ :sup:`1` | Visual Studio 2000 or higher\ :sup:`4,5` |
++-------------------+----------------------+-------------------------------------------+
+| AIX\ :sup:`3,4` | PowerPC | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`3,5` | PowerPC | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`7` | Alpha | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`7` | Itanium (IA-64) | GCC |
++-------------------+----------------------+-------------------------------------------+
+| HP-UX\ :sup:`7` | Itanium (IA-64) | HP aCC |
++-------------------+----------------------+-------------------------------------------+
+| Windows x64 | x86-64 | mingw-w64's GCC-4.5.x\ :sup:`12` |
++-------------------+----------------------+-------------------------------------------+
+
+.. note::
+
+ Code generation supported for Pentium processors and up
+
+ #. Code generation supported for Pentium processors and up
+ #. Code generation supported for 32-bit ABI only
+ #. No native code generation
+ #. Build is not complete: one or more tools do not link or function
+ #. The GCC-based C/C++ frontend does not build
+ #. The port is done using the MSYS shell.
+ #. Native code generation exists but is not complete.
+ #. Binutils 2.20 or later is required to build the assembler generated by LLVM properly.
+ #. Xcode 2.5 and gcc 4.0.1 (Apple Build 5370) will trip internal LLVM assert
+ messages when compiled for Release at optimization levels greater than 0
+ (i.e., ``-O1`` and higher). Add ``OPTIMIZE_OPTION="-O0"`` to the build
+ command line if compiling for LLVM Release or bootstrapping the LLVM
+ toolchain.
+ #. For MSYS/MinGW on Windows, be sure to install the MSYS version of the perl
+ package, and be sure it appears in your path before any Windows-based
+ versions such as Strawberry Perl and ActivePerl, as these have
+ Windows-specifics that will cause the build to fail.
+ #. To use LLVM modules on Win32-based system, you may configure LLVM
+ with ``--enable-shared``.
+
+ #. To compile SPU backend, you need to add ``LDFLAGS=-Wl,--stack,16777216`` to
+ configure.
+
+Note that you will need about 1-3 GB of space for a full LLVM build in Debug
+mode, depending on the system (it is so large because of all the debugging
+information and the fact that the libraries are statically linked into multiple
+tools). If you do not need many of the tools and you are space-conscious, you
+can pass ``ONLY_TOOLS="tools you need"`` to make. The Release build requires
+considerably less space.
+
+The LLVM suite *may* compile on other platforms, but it is not guaranteed to do
+so. If compilation is successful, the LLVM utilities should be able to
+assemble, disassemble, analyze, and optimize LLVM bitcode. Code generation
+should work as well, although the generated native code may not work on your
+platform.
+
+Software
+--------
+
+Compiling LLVM requires that you have several software packages installed. The
+table below lists those required packages. The Package column is the usual name
+for the software package that LLVM depends on. The Version column provides
+"known to work" versions of the package. The Notes column describes how LLVM
+uses the package and provides other details.
+
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| Package | Version | Notes |
++==============================================================+=================+=============================================+
+| `GNU Make <http://savannah.gnu.org/projects/make>`_ | 3.79, 3.79.1 | Makefile/build processor |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GCC <http://gcc.gnu.org/>`_ | 3.4.2 | C/C++ compiler\ :sup:`1` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `TeXinfo <http://www.gnu.org/software/texinfo/>`_ | 4.5 | For building the CFE |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `SVN <http://subversion.tigris.org/project_packages.html>`_ | >=1.3 | Subversion access to LLVM\ :sup:`2` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `DejaGnu <http://savannah.gnu.org/projects/dejagnu>`_ | 1.4.2 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `tcl <http://www.tcl.tk/software/tcltk/>`_ | 8.3, 8.4 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `expect <http://expect.nist.gov/>`_ | 5.38.0 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `perl <http://www.perl.com/download.csp>`_ | >=5.6.0 | Utilities |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU M4 <http://savannah.gnu.org/projects/m4>`_ | 1.4 | Macro processor for configuration\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU Autoconf <http://www.gnu.org/software/autoconf/>`_ | 2.60 | Configuration script builder\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU Automake <http://www.gnu.org/software/automake/>`_ | 1.9.6 | aclocal macro generator\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `libtool <http://savannah.gnu.org/projects/libtool>`_ | 1.5.22 | Shared library manager\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+
+.. note::
+
+ #. Only the C and C++ languages are needed so there's no need to build the
+ other languages for LLVM's purposes. See `below` for specific version
+ info.
+ #. You only need Subversion if you intend to build from the latest LLVM
+ sources. If you're working from a release distribution, you don't need
+ Subversion.
+ #. Only needed if you want to run the automated test suite in the
+ ``llvm/test`` directory.
+ #. If you want to make changes to the configure scripts, you will need GNU
+ autoconf (2.60), and consequently, GNU M4 (version 1.4 or higher). You
+ will also need automake (1.9.6). We only use aclocal from that package.
+
+Additionally, your compilation host is expected to have the usual plethora of
+Unix utilities. Specifically:
+
+* **ar** --- archive library builder
+* **bzip2** --- bzip2 command for distribution generation
+* **bunzip2** --- bunzip2 command for distribution checking
+* **chmod** --- change permissions on a file
+* **cat** --- output concatenation utility
+* **cp** --- copy files
+* **date** --- print the current date/time
+* **echo** --- print to standard output
+* **egrep** --- extended regular expression search utility
+* **find** --- find files/dirs in a file system
+* **grep** --- regular expression search utility
+* **gzip** --- gzip command for distribution generation
+* **gunzip** --- gunzip command for distribution checking
+* **install** --- install directories/files
+* **mkdir** --- create a directory
+* **mv** --- move (rename) files
+* **ranlib** --- symbol table builder for archive libraries
+* **rm** --- remove (delete) files and directories
+* **sed** --- stream editor for transforming output
+* **sh** --- Bourne shell for make build scripts
+* **tar** --- tape archive for distribution generation
+* **test** --- test things in file system
+* **unzip** --- unzip command for distribution checking
+* **zip** --- zip command for distribution generation
+
+.. _below:
+.. _check here:
+
+Broken versions of GCC and other tools
+--------------------------------------
+
+LLVM is very demanding of the host C++ compiler, and as such tends to expose
+bugs in the compiler. In particular, several versions of GCC crash when trying
+to compile LLVM. We routinely use GCC 4.2 (and higher) or Clang. Other
+versions of GCC will probably work as well. GCC versions listed here are known
+to not work. If you are using one of these versions, please try to upgrade your
+GCC to something more recent. If you run into a problem with a version of GCC
+not listed here, please `let us know <mailto:llvmdev@cs.uiuc.edu>`_. Please use
+the "``gcc -v``" command to find out which version of GCC you are using.
+
+**GCC versions prior to 3.0**: GCC 2.96.x and before had several problems in the
+STL that effectively prevent it from compiling LLVM.
+
+**GCC 3.2.2 and 3.2.3**: These versions of GCC fails to compile LLVM with a
+bogus template error. This was fixed in later GCCs.
+
+**GCC 3.3.2**: This version of GCC suffered from a `serious bug
+<http://gcc.gnu.org/PR13392>`_ which causes it to crash in the
+"``convert_from_eh_region_ranges_1``" GCC function.
+
+**Cygwin GCC 3.3.3**: The version of GCC 3.3.3 commonly shipped with Cygwin does
+not work.
+
+**SuSE GCC 3.3.3**: The version of GCC 3.3.3 shipped with SuSE 9.1 (and possibly
+others) does not compile LLVM correctly (it appears that exception handling is
+broken in some cases). Please download the FSF 3.3.3 or upgrade to a newer
+version of GCC.
+
+**GCC 3.4.0 on linux/x86 (32-bit)**: GCC miscompiles portions of the code
+generator, causing an infinite loop in the llvm-gcc build when built with
+optimizations enabled (i.e. a release build).
+
+**GCC 3.4.2 on linux/x86 (32-bit)**: GCC miscompiles portions of the code
+generator at -O3, as with 3.4.0. However gcc 3.4.2 (unlike 3.4.0) correctly
+compiles LLVM at -O2. A work around is to build release LLVM builds with
+"``make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ...``"
+
+**GCC 3.4.x on X86-64/amd64**: GCC `miscompiles portions of LLVM
+<http://llvm.org/PR1056>`__.
+
+**GCC 3.4.4 (CodeSourcery ARM 2005q3-2)**: this compiler miscompiles LLVM when
+building with optimizations enabled. It appears to work with "``make
+ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1``" or build a debug build.
+
+**IA-64 GCC 4.0.0**: The IA-64 version of GCC 4.0.0 is known to miscompile LLVM.
+
+**Apple Xcode 2.3**: GCC crashes when compiling LLVM at -O3 (which is the
+default with ENABLE_OPTIMIZED=1. To work around this, build with
+"``ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2``".
+
+**GCC 4.1.1**: GCC fails to build LLVM with template concept check errors
+compiling some files. At the time of this writing, GCC mainline (4.2) did not
+share the problem.
+
+**GCC 4.1.1 on X86-64/amd64**: GCC `miscompiles portions of LLVM
+<http://llvm.org/PR1063>`__ when compiling llvm itself into 64-bit code. LLVM
+will appear to mostly work but will be buggy, e.g. failing portions of its
+testsuite.
+
+**GCC 4.1.2 on OpenSUSE**: Seg faults during libstdc++ build and on x86_64
+platforms compiling md5.c gets a mangled constant.
+
+**GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian**: Appears to
+miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining about
+symbols remaining in the table on destruction.
+
+**GCC 4.1.2 20071124 (Red Hat 4.1.2-42)**: Suffers from the same symptoms as the
+previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).
+
+**Cygwin GCC 4.3.2 20080827 (beta) 2**: Users `reported
+<http://llvm.org/PR4145>`_ various problems related with link errors when using
+this GCC version.
+
+**Debian GCC 4.3.2 on X86**: Crashes building some files in LLVM 2.6.
+
+**GCC 4.3.3 (Debian 4.3.3-10) on ARM**: Miscompiles parts of LLVM 2.6 when
+optimizations are turned on. The symptom is an infinite loop in
+``FoldingSetImpl::RemoveNode`` while running the code generator.
+
+**SUSE 11 GCC 4.3.4**: Miscompiles LLVM, causing crashes in ValueHandle logic.
+
+**GCC 4.3.5 and GCC 4.4.5 on ARM**: These can miscompile ``value >> 1`` even at
+``-O0``. A test failure in ``test/Assembler/alignstack.ll`` is one symptom of
+the problem.
+
+**GNU ld 2.16.X**. Some 2.16.X versions of the ld linker will produce very long
+warning messages complaining that some "``.gnu.linkonce.t.*``" symbol was
+defined in a discarded section. You can safely ignore these messages as they are
+erroneous and the linkage is correct. These messages disappear using ld 2.17.
+
+**GNU binutils 2.17**: Binutils 2.17 contains `a bug
+<http://sourceware.org/bugzilla/show_bug.cgi?id=3111>`__ which causes huge link
+times (minutes instead of seconds) when building LLVM. We recommend upgrading
+to a newer version (2.17.50.0.4 or later).
+
+**GNU Binutils 2.19.1 Gold**: This version of Gold contained `a bug
+<http://sourceware.org/bugzilla/show_bug.cgi?id=9836>`__ which causes
+intermittent failures when building LLVM with position independent code. The
+symptom is an error about cyclic dependencies. We recommend upgrading to a
+newer version of Gold.
+
+.. _Getting Started with LLVM:
+
+Getting Started with LLVM
+=========================
+
+The remainder of this guide is meant to get you up and running with LLVM and to
+give you some basic information about the LLVM environment.
+
+The later sections of this guide describe the `general layout`_ of the LLVM
+source tree, a `simple example`_ using the LLVM tool chain, and `links`_ to find
+more information about LLVM or to get help via e-mail.
+
+Terminology and Notation
+------------------------
+
+Throughout this manual, the following names are used to denote paths specific to
+the local system and working environment. *These are not environment variables
+you need to set but just strings used in the rest of this document below*. In
+any of the examples below, simply replace each of these names with the
+appropriate pathname on your local system. All these paths are absolute:
+
+``SRC_ROOT``
+
+ This is the top level directory of the LLVM source tree.
+
+``OBJ_ROOT``
+
+ This is the top level directory of the LLVM object tree (i.e. the tree where
+ object files and compiled programs will be placed. It can be the same as
+ SRC_ROOT).
+
+.. _Setting Up Your Environment:
+
+Setting Up Your Environment
+---------------------------
+
+In order to compile and use LLVM, you may need to set some environment
+variables.
+
+``LLVM_LIB_SEARCH_PATH=/path/to/your/bitcode/libs``
+
+ [Optional] This environment variable helps LLVM linking tools find the
+ locations of your bitcode libraries. It is provided only as a convenience
+ since you can specify the paths using the -L options of the tools and the
+ C/C++ front-end will automatically use the bitcode files installed in its
+ ``lib`` directory.
+
+Unpacking the LLVM Archives
+---------------------------
+
+If you have the LLVM distribution, you will need to unpack it before you can
+begin to compile it. LLVM is distributed as a set of two files: the LLVM suite
+and the LLVM GCC front end compiled for your platform. There is an additional
+test suite that is optional. Each file is a TAR archive that is compressed with
+the gzip program.
+
+The files are as follows, with *x.y* marking the version number:
+
+``llvm-x.y.tar.gz``
+
+ Source release for the LLVM libraries and tools.
+
+``llvm-test-x.y.tar.gz``
+
+ Source release for the LLVM test-suite.
+
+``llvm-gcc-4.2-x.y.source.tar.gz``
+
+ Source release of the llvm-gcc-4.2 front end. See README.LLVM in the root
+ directory for build instructions.
+
+``llvm-gcc-4.2-x.y-platform.tar.gz``
+
+ Binary release of the llvm-gcc-4.2 front end for a specific platform.
+
+Checkout LLVM from Subversion
+-----------------------------
+
+If you have access to our Subversion repository, you can get a fresh copy of the
+entire source code. All you need to do is check it out from Subversion as
+follows:
+
+* ``cd where-you-want-llvm-to-live``
+* Read-Only: ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+* Read-Write:``svn co https://user@llvm.org/svn/llvm-project/llvm/trunk llvm``
+
+This will create an '``llvm``' directory in the current directory and fully
+populate it with the LLVM source code, Makefiles, test directories, and local
+copies of documentation files.
+
+If you want to get a specific release (as opposed to the most recent revision),
+you can checkout it from the '``tags``' directory (instead of '``trunk``'). The
+following releases are located in the following subdirectories of the '``tags``'
+directory:
+
+* Release 3.1: **RELEASE_31/final**
+* Release 3.0: **RELEASE_30/final**
+* Release 2.9: **RELEASE_29/final**
+* Release 2.8: **RELEASE_28**
+* Release 2.7: **RELEASE_27**
+* Release 2.6: **RELEASE_26**
+* Release 2.5: **RELEASE_25**
+* Release 2.4: **RELEASE_24**
+* Release 2.3: **RELEASE_23**
+* Release 2.2: **RELEASE_22**
+* Release 2.1: **RELEASE_21**
+* Release 2.0: **RELEASE_20**
+* Release 1.9: **RELEASE_19**
+* Release 1.8: **RELEASE_18**
+* Release 1.7: **RELEASE_17**
+* Release 1.6: **RELEASE_16**
+* Release 1.5: **RELEASE_15**
+* Release 1.4: **RELEASE_14**
+* Release 1.3: **RELEASE_13**
+* Release 1.2: **RELEASE_12**
+* Release 1.1: **RELEASE_11**
+* Release 1.0: **RELEASE_1**
+
+If you would like to get the LLVM test suite (a separate package as of 1.4), you
+get it from the Subversion repository:
+
+.. code:: bash
+
+ % cd llvm/projects
+ % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
+
+By placing it in the ``llvm/projects``, it will be automatically configured by
+the LLVM configure script as well as automatically updated when you run ``svn
+update``.
+
+GIT mirror
+----------
+
+GIT mirrors are available for a number of LLVM subprojects. These mirrors sync
+automatically with each Subversion commit and contain all necessary git-svn
+marks (so, you can recreate git-svn metadata locally). Note that right now
+mirrors reflect only ``trunk`` for each project. You can do the read-only GIT
+clone of LLVM via:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+
+If you want to check out clang too, run:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+ % cd llvm/tools
+ % git clone http://llvm.org/git/clang.git
+
+Since the upstream repository is in Subversion, you should use ``git
+pull --rebase`` instead of ``git pull`` to avoid generating a non-linear history
+in your clone. To configure ``git pull`` to pass ``--rebase`` by default on the
+master branch, run the following command:
+
+.. code:: bash
+
+ % git config branch.master.rebase true
+
+Sending patches with Git
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Please read `Developer Policy <DeveloperPolicy.html#patches>`_, too.
+
+Assume ``master`` points the upstream and ``mybranch`` points your working
+branch, and ``mybranch`` is rebased onto ``master``. At first you may check
+sanity of whitespaces:
+
+.. code:: bash
+
+ % git diff --check master..mybranch
+
+The easiest way to generate a patch is as below:
+
+.. code:: bash
+
+ % git diff master..mybranch > /path/to/mybranch.diff
+
+It is a little different from svn-generated diff. git-diff-generated diff has
+prefixes like ``a/`` and ``b/``. Don't worry, most developers might know it
+could be accepted with ``patch -p1 -N``.
+
+But you may generate patchset with git-format-patch. It generates by-each-commit
+patchset. To generate patch files to attach to your article:
+
+.. code:: bash
+
+ % git format-patch --no-attach master..mybranch -o /path/to/your/patchset
+
+If you would like to send patches directly, you may use git-send-email or
+git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
+
+.. code:: bash
+
+ % git format-patch --attach master..mybranch --stdout | git imap-send
+
+Then, your .git/config should have [imap] sections.
+
+.. code:: bash
+
+ [imap]
+ host = imaps://imap.gmail.com
+ user = your.gmail.account@gmail.com
+ pass = himitsu!
+ port = 993
+ sslverify = false
+ ; in English
+ folder = "[Gmail]/Drafts"
+ ; example for Japanese, "Modified UTF-7" encoded.
+ folder = "[Gmail]/&amp;Tgtm+DBN-"
+ ; example for Traditional Chinese
+ folder = "[Gmail]/&amp;g0l6Pw-"
+
+For developers to work with git-svn
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To set up clone from which you can submit code using ``git-svn``, run:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+ % cd llvm
+ % git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
+ % git config svn-remote.svn.fetch :refs/remotes/origin/master
+ % git svn rebase -l # -l avoids fetching ahead of the git mirror.
+
+ # If you have clang too:
+ % cd tools
+ % git clone http://llvm.org/git/clang.git
+ % cd clang
+ % git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username=<username>
+ % git config svn-remote.svn.fetch :refs/remotes/origin/master
+ % git svn rebase -l
+
+To update this clone without generating git-svn tags that conflict with the
+upstream git repo, run:
+
+.. code:: bash
+
+ % git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
+ % git checkout master
+ % git svn rebase -l
+ % (cd tools/clang &&
+ git checkout master &&
+ git svn rebase -l)
+
+This leaves your working directories on their master branches, so you'll need to
+``checkout`` each working branch individually and ``rebase`` it on top of its
+parent branch. (Note: This script is intended for relative newbies to git. If
+you have more experience, you can likely improve on it.)
+
+The git-svn metadata can get out of sync after you mess around with branches and
+``dcommit``. When that happens, ``git svn dcommit`` stops working, complaining
+about files with uncommitted changes. The fix is to rebuild the metadata:
+
+.. code:: bash
+
+ % rm -rf .git/svn
+ % git svn rebase -l
+
+Local LLVM Configuration
+------------------------
+
+Once checked out from the Subversion repository, the LLVM suite source code must
+be configured via the ``configure`` script. This script sets variables in the
+various ``*.in`` files, most notably ``llvm/Makefile.config`` and
+``llvm/include/Config/config.h``. It also populates *OBJ_ROOT* with the
+Makefiles needed to begin building LLVM.
+
+The following environment variables are used by the ``configure`` script to
+configure the build system:
+
++------------+-----------------------------------------------------------+
+| Variable | Purpose |
++============+===========================================================+
+| CC | Tells ``configure`` which C compiler to use. By default, |
+| | ``configure`` will look for the first GCC C compiler in |
+| | ``PATH``. Use this variable to override ``configure``\'s |
+| | default behavior. |
++------------+-----------------------------------------------------------+
+| CXX | Tells ``configure`` which C++ compiler to use. By |
+| | default, ``configure`` will look for the first GCC C++ |
+| | compiler in ``PATH``. Use this variable to override |
+| | ``configure``'s default behavior. |
++------------+-----------------------------------------------------------+
+
+The following options can be used to set or enable LLVM specific options:
+
+``--enable-optimized``
+
+ Enables optimized compilation (debugging symbols are removed and GCC
+ optimization flags are enabled). Note that this is the default setting if you
+ are using the LLVM distribution. The default behavior of an Subversion
+ checkout is to use an unoptimized build (also known as a debug build).
+
+``--enable-debug-runtime``
+
+ Enables debug symbols in the runtime libraries. The default is to strip debug
+ symbols from the runtime libraries.
+
+``--enable-jit``
+
+ Compile the Just In Time (JIT) compiler functionality. This is not available
+ on all platforms. The default is dependent on platform, so it is best to
+ explicitly enable it if you want it.
+
+``--enable-targets=target-option``
+
+ Controls which targets will be built and linked into llc. The default value
+ for ``target_options`` is "all" which builds and links all available targets.
+ The value "host-only" can be specified to build only a native compiler (no
+ cross-compiler targets available). The "native" target is selected as the
+ target of the build host. You can also specify a comma separated list of
+ target names that you want available in llc. The target names use all lower
+ case. The current set of targets is:
+
+ ``arm, cpp, hexagon, mblaze, mips, mipsel, msp430, powerpc, ptx, sparc, spu,
+ x86, x86_64, xcore``.
+
+``--enable-doxygen``
+
+ Look for the doxygen program and enable construction of doxygen based
+ documentation from the source code. This is disabled by default because
+ generating the documentation can take a long time and producess 100s of
+ megabytes of output.
+
+``--with-udis86``
+
+ LLVM can use external disassembler library for various purposes (now it's used
+ only for examining code produced by JIT). This option will enable usage of
+ `udis86 <http://udis86.sourceforge.net/>`_ x86 (both 32 and 64 bits)
+ disassembler library.
+
+To configure LLVM, follow these steps:
+
+#. Change directory into the object root directory:
+
+ .. code:: bash
+
+ % cd OBJ_ROOT
+
+#. Run the ``configure`` script located in the LLVM source tree:
+
+ .. code:: bash
+
+ % SRC_ROOT/configure --prefix=/install/path [other options]
+
+Compiling the LLVM Suite Source Code
+------------------------------------
+
+Once you have configured LLVM, you can build it. There are three types of
+builds:
+
+Debug Builds
+
+ These builds are the default when one is using an Subversion checkout and
+ types ``gmake`` (unless the ``--enable-optimized`` option was used during
+ configuration). The build system will compile the tools and libraries with
+ debugging information. To get a Debug Build using the LLVM distribution the
+ ``--disable-optimized`` option must be passed to ``configure``.
+
+Release (Optimized) Builds
+
+ These builds are enabled with the ``--enable-optimized`` option to
+ ``configure`` or by specifying ``ENABLE_OPTIMIZED=1`` on the ``gmake`` command
+ line. For these builds, the build system will compile the tools and libraries
+ with GCC optimizations enabled and strip debugging information from the
+ libraries and executables it generates. Note that Release Builds are default
+ when using an LLVM distribution.
+
+Profile Builds
+
+ These builds are for use with profiling. They compile profiling information
+ into the code for use with programs like ``gprof``. Profile builds must be
+ started by specifying ``ENABLE_PROFILING=1`` on the ``gmake`` command line.
+
+Once you have LLVM configured, you can build it by entering the *OBJ_ROOT*
+directory and issuing the following command:
+
+.. code:: bash
+
+ % gmake
+
+If the build fails, please `check here`_ to see if you are using a version of
+GCC that is known not to compile LLVM.
+
+If you have multiple processors in your machine, you may wish to use some of the
+parallel build options provided by GNU Make. For example, you could use the
+command:
+
+.. code:: bash
+
+ % gmake -j2
+
+There are several special targets which are useful when working with the LLVM
+source code:
+
+``gmake clean``
+
+ Removes all files generated by the build. This includes object files,
+ generated C/C++ files, libraries, and executables.
+
+``gmake dist-clean``
+
+ Removes everything that ``gmake clean`` does, but also removes files generated
+ by ``configure``. It attempts to return the source tree to the original state
+ in which it was shipped.
+
+``gmake install``
+
+ Installs LLVM header files, libraries, tools, and documentation in a hierarchy
+ under ``$PREFIX``, specified with ``./configure --prefix=[dir]``, which
+ defaults to ``/usr/local``.
+
+``gmake -C runtime install-bytecode``
+
+ Assuming you built LLVM into $OBJDIR, when this command is run, it will
+ install bitcode libraries into the GCC front end's bitcode library directory.
+ If you need to update your bitcode libraries, this is the target to use once
+ you've built them.
+
+Please see the `Makefile Guide <MakefileGuide.html>`_ for further details on
+these ``make`` targets and descriptions of other targets available.
+
+It is also possible to override default values from ``configure`` by declaring
+variables on the command line. The following are some examples:
+
+``gmake ENABLE_OPTIMIZED=1``
+
+ Perform a Release (Optimized) build.
+
+``gmake ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1``
+
+ Perform a Release (Optimized) build without assertions enabled.
+
+``gmake ENABLE_OPTIMIZED=0``
+
+ Perform a Debug build.
+
+``gmake ENABLE_PROFILING=1``
+
+ Perform a Profiling build.
+
+``gmake VERBOSE=1``
+
+ Print what ``gmake`` is doing on standard output.
+
+``gmake TOOL_VERBOSE=1``
+
+ Ask each tool invoked by the makefiles to print out what it is doing on
+ the standard output. This also implies ``VERBOSE=1``.
+
+Every directory in the LLVM object tree includes a ``Makefile`` to build it and
+any subdirectories that it contains. Entering any directory inside the LLVM
+object tree and typing ``gmake`` should rebuild anything in or below that
+directory that is out of date.
+
+Cross-Compiling LLVM
+--------------------
+
+It is possible to cross-compile LLVM itself. That is, you can create LLVM
+executables and libraries to be hosted on a platform different from the platform
+where they are build (a Canadian Cross build). To configure a cross-compile,
+supply the configure script with ``--build`` and ``--host`` options that are
+different. The values of these options must be legal target triples that your
+GCC compiler supports.
+
+The result of such a build is executables that are not runnable on on the build
+host (--build option) but can be executed on the compile host (--host option).
+
+The Location of LLVM Object Files
+---------------------------------
+
+The LLVM build system is capable of sharing a single LLVM source tree among
+several LLVM builds. Hence, it is possible to build LLVM for several different
+platforms or configurations using the same source tree.
+
+This is accomplished in the typical autoconf manner:
+
+* Change directory to where the LLVM object files should live:
+
+ .. code:: bash
+
+ % cd OBJ_ROOT
+
+* Run the ``configure`` script found in the LLVM source directory:
+
+ .. code:: bash
+
+ % SRC_ROOT/configure
+
+The LLVM build will place files underneath *OBJ_ROOT* in directories named after
+the build type:
+
+Debug Builds with assertions enabled (the default)
+
+ Tools
+
+ ``OBJ_ROOT/Debug+Asserts/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Debug+Asserts/lib``
+
+Release Builds
+
+ Tools
+
+ ``OBJ_ROOT/Release/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Release/lib``
+
+Profile Builds
+
+ Tools
+
+ ``OBJ_ROOT/Profile/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Profile/lib``
+
+Optional Configuration Items
+----------------------------
+
+If you're running on a Linux system that supports the `binfmt_misc
+<http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html>`_
+module, and you have root access on the system, you can set your system up to
+execute LLVM bitcode files directly. To do this, use commands like this (the
+first command may not be required if you are already using the module):
+
+.. code:: bash
+
+ % mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
+ % echo ':llvm:M::BC::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
+ % chmod u+x hello.bc (if needed)
+ % ./hello.bc
+
+This allows you to execute LLVM bitcode files directly. On Debian, you can also
+use this command instead of the 'echo' command above:
+
+.. code:: bash
+
+ % sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
+
+.. _Program Layout:
+.. _general layout:
+
+Program Layout
+==============
+
+One useful source of information about the LLVM source base is the LLVM `doxygen
+<http://www.doxygen.org/>`_ documentation available at
+`<http://llvm.org/doxygen/>`_. The following is a brief introduction to code
+layout:
+
+``llvm/examples``
+-----------------
+
+This directory contains some simple examples of how to use the LLVM IR and JIT.
+
+``llvm/include``
+----------------
+
+This directory contains public header files exported from the LLVM library. The
+three main subdirectories of this directory are:
+
+``llvm/include/llvm``
+
+ This directory contains all of the LLVM specific header files. This directory
+ also has subdirectories for different portions of LLVM: ``Analysis``,
+ ``CodeGen``, ``Target``, ``Transforms``, etc...
+
+``llvm/include/llvm/Support``
+
+ This directory contains generic support libraries that are provided with LLVM
+ but not necessarily specific to LLVM. For example, some C++ STL utilities and
+ a Command Line option processing library store their header files here.
+
+``llvm/include/llvm/Config``
+
+ This directory contains header files configured by the ``configure`` script.
+ They wrap "standard" UNIX and C header files. Source code can include these
+ header files which automatically take care of the conditional #includes that
+ the ``configure`` script generates.
+
+``llvm/lib``
+------------
+
+This directory contains most of the source files of the LLVM system. In LLVM,
+almost all code exists in libraries, making it very easy to share code among the
+different `tools`_.
+
+``llvm/lib/VMCore/``
+
+ This directory holds the core LLVM source files that implement core classes
+ like Instruction and BasicBlock.
+
+``llvm/lib/AsmParser/``
+
+ This directory holds the source code for the LLVM assembly language parser
+ library.
+
+``llvm/lib/BitCode/``
+
+ This directory holds code for reading and write LLVM bitcode.
+
+``llvm/lib/Analysis/``
+
+ This directory contains a variety of different program analyses, such as
+ Dominator Information, Call Graphs, Induction Variables, Interval
+ Identification, Natural Loop Identification, etc.
+
+``llvm/lib/Transforms/``
+
+ This directory contains the source code for the LLVM to LLVM program
+ transformations, such as Aggressive Dead Code Elimination, Sparse Conditional
+ Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global
+ Elimination, and many others.
+
+``llvm/lib/Target/``
+
+ This directory contains files that describe various target architectures for
+ code generation. For example, the ``llvm/lib/Target/X86`` directory holds the
+ X86 machine description while ``llvm/lib/Target/ARM`` implements the ARM
+ backend.
+
+``llvm/lib/CodeGen/``
+
+ This directory contains the major parts of the code generator: Instruction
+ Selector, Instruction Scheduling, and Register Allocation.
+
+``llvm/lib/MC/``
+
+ (FIXME: T.B.D.)
+
+``llvm/lib/Debugger/``
+
+ This directory contains the source level debugger library that makes it
+ possible to instrument LLVM programs so that a debugger could identify source
+ code locations at which the program is executing.
+
+``llvm/lib/ExecutionEngine/``
+
+ This directory contains libraries for executing LLVM bitcode directly at
+ runtime in both interpreted and JIT compiled fashions.
+
+``llvm/lib/Support/``
+
+ This directory contains the source code that corresponds to the header files
+ located in ``llvm/include/ADT/`` and ``llvm/include/Support/``.
+
+``llvm/projects``
+-----------------
+
+This directory contains projects that are not strictly part of LLVM but are
+shipped with LLVM. This is also the directory where you should create your own
+LLVM-based projects. See ``llvm/projects/sample`` for an example of how to set
+up your own project.
+
+``llvm/runtime``
+----------------
+
+This directory contains libraries which are compiled into LLVM bitcode and used
+when linking programs with the Clang front end. Most of these libraries are
+skeleton versions of real libraries; for example, libc is a stripped down
+version of glibc.
+
+Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front end
+to compile.
+
+``llvm/test``
+-------------
+
+This directory contains feature and regression tests and other basic sanity
+checks on the LLVM infrastructure. These are intended to run quickly and cover a
+lot of territory without being exhaustive.
+
+``test-suite``
+--------------
+
+This is not a directory in the normal llvm module; it is a separate Subversion
+module that must be checked out (usually to ``projects/test-suite``). This
+module contains a comprehensive correctness, performance, and benchmarking test
+suite for LLVM. It is a separate Subversion module because not every LLVM user
+is interested in downloading or building such a comprehensive test suite. For
+further details on this test suite, please see the `Testing
+Guide <TestingGuide.html>`_ document.
+
+.. _tools:
+
+``llvm/tools``
+--------------
+
+The **tools** directory contains the executables built out of the libraries
+above, which form the main part of the user interface. You can always get help
+for a tool by typing ``tool_name -help``. The following is a brief introduction
+to the most important tools. More detailed information is in
+the `Command Guide <CommandGuide/index.html>`_.
+
+``bugpoint``
+
+ ``bugpoint`` is used to debug optimization passes or code generation backends
+ by narrowing down the given test case to the minimum number of passes and/or
+ instructions that still cause a problem, whether it is a crash or
+ miscompilation. See `<HowToSubmitABug.html>`_ for more information on using
+ ``bugpoint``.
+
+``llvm-ar``
+
+ The archiver produces an archive containing the given LLVM bitcode files,
+ optionally with an index for faster lookup.
+
+``llvm-as``
+
+ The assembler transforms the human readable LLVM assembly to LLVM bitcode.
+
+``llvm-dis``
+
+ The disassembler transforms the LLVM bitcode to human readable LLVM assembly.
+
+``llvm-link``
+
+ ``llvm-link``, not surprisingly, links multiple LLVM modules into a single
+ program.
+
+``lli``
+
+ ``lli`` is the LLVM interpreter, which can directly execute LLVM bitcode
+ (although very slowly...). For architectures that support it (currently x86,
+ Sparc, and PowerPC), by default, ``lli`` will function as a Just-In-Time
+ compiler (if the functionality was compiled in), and will execute the code
+ *much* faster than the interpreter.
+
+``llc``
+
+ ``llc`` is the LLVM backend compiler, which translates LLVM bitcode to a
+ native code assembly file or to C code (with the ``-march=c`` option).
+
+``opt``
+
+ ``opt`` reads LLVM bitcode, applies a series of LLVM to LLVM transformations
+ (which are specified on the command line), and then outputs the resultant
+ bitcode. The '``opt -help``' command is a good way to get a list of the
+ program transformations available in LLVM.
+
+ ``opt`` can also be used to run a specific analysis on an input LLVM bitcode
+ file and print out the results. It is primarily useful for debugging
+ analyses, or familiarizing yourself with what an analysis does.
+
+``llvm/utils``
+--------------
+
+This directory contains utilities for working with LLVM source code, and some of
+the utilities are actually required as part of the build process because they
+are code generators for parts of LLVM infrastructure.
+
+
+``codegen-diff``
+
+ ``codegen-diff`` is a script that finds differences between code that LLC
+ generates and code that LLI generates. This is a useful tool if you are
+ debugging one of them, assuming that the other generates correct output. For
+ the full user manual, run ```perldoc codegen-diff'``.
+
+``emacs/``
+
+ The ``emacs`` directory contains syntax-highlighting files which will work
+ with Emacs and XEmacs editors, providing syntax highlighting support for LLVM
+ assembly files and TableGen description files. For information on how to use
+ the syntax files, consult the ``README`` file in that directory.
+
+``getsrcs.sh``
+
+ The ``getsrcs.sh`` script finds and outputs all non-generated source files,
+ which is useful if one wishes to do a lot of development across directories
+ and does not want to individually find each file. One way to use it is to run,
+ for example: ``xemacs `utils/getsources.sh``` from the top of your LLVM source
+ tree.
+
+``llvmgrep``
+
+ This little tool performs an ``egrep -H -n`` on each source file in LLVM and
+ passes to it a regular expression provided on ``llvmgrep``'s command
+ line. This is a very efficient way of searching the source base for a
+ particular regular expression.
+
+``makellvm``
+
+ The ``makellvm`` script compiles all files in the current directory and then
+ compiles and links the tool that is the first argument. For example, assuming
+ you are in the directory ``llvm/lib/Target/Sparc``, if ``makellvm`` is in your
+ path, simply running ``makellvm llc`` will make a build of the current
+ directory, switch to directory ``llvm/tools/llc`` and build it, causing a
+ re-linking of LLC.
+
+``TableGen/``
+
+ The ``TableGen`` directory contains the tool used to generate register
+ descriptions, instruction set descriptions, and even assemblers from common
+ TableGen description files.
+
+``vim/``
+
+ The ``vim`` directory contains syntax-highlighting files which will work with
+ the VIM editor, providing syntax highlighting support for LLVM assembly files
+ and TableGen description files. For information on how to use the syntax
+ files, consult the ``README`` file in that directory.
+
+.. _simple example:
+
+An Example Using the LLVM Tool Chain
+====================================
+
+This section gives an example of using LLVM with the Clang front end.
+
+Example with clang
+------------------
+
+#. First, create a simple C file, name it 'hello.c':
+
+ .. code:: c
+
+ #include <stdio.h>
+
+ int main() {
+ printf("hello world\n");
+ return 0;
+ }
+
+#. Next, compile the C file into a native executable:
+
+ .. code:: bash
+
+ % clang hello.c -o hello
+
+ .. note::
+
+ Clang works just like GCC by default. The standard -S and -c arguments
+ work as usual (producing a native .s or .o file, respectively).
+
+#. Next, compile the C file into a LLVM bitcode file:
+
+ .. code:: bash
+
+ % clang -O3 -emit-llvm hello.c -c -o hello.bc
+
+ The -emit-llvm option can be used with the -S or -c options to emit an LLVM
+ ``.ll`` or ``.bc`` file (respectively) for the code. This allows you to use
+ the `standard LLVM tools <CommandGuide/index.html>`_ on the bitcode file.
+
+#. Run the program in both forms. To run the program, use:
+
+ .. code:: bash
+
+ % ./hello
+
+ and
+
+ .. code:: bash
+
+ % lli hello.bc
+
+ The second examples shows how to invoke the LLVM JIT, `lli
+ <CommandGuide/html/lli.html>`_.
+
+#. Use the ``llvm-dis`` utility to take a look at the LLVM assembly code:
+
+ .. code:: bash
+
+ % llvm-dis < hello.bc | less
+
+#. Compile the program to native assembly using the LLC code generator:
+
+ .. code:: bash
+
+ % llc hello.bc -o hello.s
+
+#. Assemble the native assembly language file into a program:
+
+ .. code:: bash
+
+ **Solaris:** % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
+
+ **Others:** % gcc hello.s -o hello.native
+
+#. Execute the native code program:
+
+ .. code:: bash
+
+ % ./hello.native
+
+ Note that using clang to compile directly to native code (i.e. when the
+ ``-emit-llvm`` option is not present) does steps 6/7/8 for you.
+
+Common Problems
+===============
+
+If you are having problems building or using LLVM, or if you have any other
+general questions about LLVM, please consult the `Frequently Asked
+Questions <FAQ.html>`_ page.
+
+.. _links:
+
+Links
+=====
+
+This document is just an **introduction** on how to use LLVM to do some simple
+things... there are many more interesting and complicated things that you can do
+that aren't documented here (but we'll gladly accept a patch if you want to
+write something up!). For more information about LLVM, check out:
+
+* `LLVM Homepage <http://llvm.org/>`_
+* `LLVM Doxygen Tree <http://llvm.org/doxygen/>`_
+* `Starting a Project that Uses LLVM <http://llvm.org/docs/Projects.html>`_
diff --git a/docs/GoldPlugin.html b/docs/GoldPlugin.html
deleted file mode 100644
index 1e99a5a3d6a..00000000000
--- a/docs/GoldPlugin.html
+++ /dev/null
@@ -1,227 +0,0 @@
-<!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 gold plugin</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-<body>
-
-<h1>LLVM gold plugin</h1>
-<ol>
- <li><a href="#introduction">Introduction</a></li>
- <li><a href="#build">How to build it</a></li>
- <li><a href="#usage">Usage</a>
- <ul>
- <li><a href="#example1">Example of link time optimization</a></li>
- <li><a href="#lto_autotools">Quickstart for using LTO with autotooled projects</a></li>
- </ul></li>
- <li><a href="#licensing">Licensing</a></li>
-</ol>
-<div class="doc_author">Written by Nick Lewycky</div>
-
-<!--=========================================================================-->
-<h2><a name="introduction">Introduction</a></h2>
-<!--=========================================================================-->
-<div>
- <p>Building with link time optimization requires cooperation from the
-system linker. LTO support on Linux systems requires that you use
-the <a href="http://sourceware.org/binutils">gold linker</a> which supports
-LTO via plugins. This is the same mechanism used by the
-<a href="http://gcc.gnu.org/wiki/LinkTimeOptimization">GCC LTO</a>
-project.</p>
- <p>The LLVM gold plugin implements the
-<a href="http://gcc.gnu.org/wiki/whopr/driver">gold plugin interface</a>
-on top of
-<a href="LinkTimeOptimization.html#lto">libLTO</a>.
-The same plugin can also be used by other tools such as <tt>ar</tt> and
-<tt>nm</tt>.
-</div>
-<!--=========================================================================-->
-<h2><a name="build">How to build it</a></h2>
-<!--=========================================================================-->
-<div>
- <p>You need to have gold with plugin support and build the LLVMgold
-plugin. Check whether you have gold running <tt>/usr/bin/ld -v</tt>. It will
-report &#8220;GNU gold&#8221; or else &#8220GNU ld&#8221; if not. If you have
-gold, check for plugin support by running <tt>/usr/bin/ld -plugin</tt>. If it
-complains &#8220missing argument&#8221 then you have plugin support. If not,
-such as an &#8220;unknown option&#8221; error then you will either need to
-build gold or install a version with plugin support.</p>
-<ul>
- <li>To build gold with plugin support:
- <pre class="doc_code">
-mkdir binutils
-cd binutils
-cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
-<em>{enter "anoncvs" as the password}</em>
-cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
-mkdir build
-cd build
-../src/configure --enable-gold --enable-plugins
-make all-gold
-</pre>
- That should leave you with <tt>binutils/build/gold/ld-new</tt> which supports the <tt>-plugin</tt> option. It also built would have
-<tt>binutils/build/binutils/ar</tt> and <tt>nm-new</tt> which support plugins
-but don't have a visible -plugin option, instead relying on the gold plugin
-being present in <tt>../lib/bfd-plugins</tt> relative to where the binaries are
-placed.
- <li>Build the LLVMgold plugin: Configure LLVM with
- <tt>--with-binutils-include=/path/to/binutils/src/include</tt> and run
- <tt>make</tt>.
-</ul>
-</div>
-<!--=========================================================================-->
-<h2><a name="usage">Usage</a></h2>
-<!--=========================================================================-->
-<div>
-
- <p>The linker takes a <tt>-plugin</tt> option that points to the path of
- the plugin <tt>.so</tt> file. To find out what link command <tt>gcc</tt>
- would run in a given situation, run <tt>gcc -v <em>[...]</em></tt> and look
- for the line where it runs <tt>collect2</tt>. Replace that with
- <tt>ld-new -plugin /path/to/LLVMgold.so</tt> to test it out. Once you're
- ready to switch to using gold, backup your existing <tt>/usr/bin/ld</tt>
- then replace it with <tt>ld-new</tt>.</p>
-
- <p>You can produce bitcode files from <tt>clang</tt> using
- <tt>-emit-llvm</tt> or <tt>-flto</tt>, or the <tt>-O4</tt> flag which is
- synonymous with <tt>-O3 -flto</tt>.</p>
-
- <p>Any of these flags will also cause <tt>clang</tt> to look for the
- gold plugin in the <tt>lib</tt> directory under its prefix and pass the
- <tt>-plugin</tt> option to <tt>ld</tt>. It will not look for an alternate
- linker, which is why you need gold to be the installed system linker in
- your path.</p>
-
- <p>If you want <tt>ar</tt> and <tt>nm</tt> to work seamlessly as well, install
- <tt>LLVMgold.so</tt> to <tt>/usr/lib/bfd-plugins</tt>. If you built your
- own gold, be sure to install the <tt>ar</tt> and <tt>nm-new</tt> you built to
- <tt>/usr/bin</tt>.<p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="example1">Example of link time optimization</a>
-</h3>
-
-<div>
- <p>The following example shows a worked example of the gold plugin mixing
- LLVM bitcode and native code.
-<pre class="doc_code">
---- a.c ---
-#include &lt;stdio.h&gt;
-
-extern void foo1(void);
-extern void foo4(void);
-
-void foo2(void) {
- printf("Foo2\n");
-}
-
-void foo3(void) {
- foo4();
-}
-
-int main(void) {
- foo1();
-}
-
---- b.c ---
-#include &lt;stdio.h&gt;
-
-extern void foo2(void);
-
-void foo1(void) {
- foo2();
-}
-
-void foo4(void) {
- printf("Foo4");
-}
-
---- command lines ---
-$ clang -flto a.c -c -o a.o # &lt;-- a.o is LLVM bitcode file
-$ ar q a.a a.o # &lt;-- a.a is an archive with LLVM bitcode
-$ clang b.c -c -o b.o # &lt;-- b.o is native object file
-$ clang -flto a.a b.o -o main # &lt;-- link with LLVMgold plugin
-</pre>
-
- <p>Gold informs the plugin that foo3 is never referenced outside the IR,
- leading LLVM to delete that function. However, unlike in the
- <a href="LinkTimeOptimization.html#example1">libLTO
- example</a> gold does not currently eliminate foo4.</p>
-</div>
-
-</div>
-
-<!--=========================================================================-->
-<h2>
- <a name="lto_autotools">
- Quickstart for using LTO with autotooled projects
- </a>
-</h2>
-<!--=========================================================================-->
-<div>
- <p>Once your system <tt>ld</tt>, <tt>ar</tt>, and <tt>nm</tt> all support LLVM
- bitcode, everything is in place for an easy to use LTO build of autotooled
- projects:</p>
-
- <ul>
- <li>Follow the instructions <a href="#build">on how to build LLVMgold.so</a>.</li>
- <li>Install the newly built binutils to <tt>$PREFIX</tt></li>
- <li>Copy <tt>Release/lib/LLVMgold.so</tt> to
- <tt>$PREFIX/lib/bfd-plugins/</tt></li>
- <li>Set environment variables (<tt>$PREFIX</tt> is where you installed clang and
- binutils):
-<pre class="doc_code">
-export CC="$PREFIX/bin/clang -flto"
-export CXX="$PREFIX/bin/clang++ -flto"
-export AR="$PREFIX/bin/ar"
-export NM="$PREFIX/bin/nm"
-export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
-export CFLAGS="-O4"
-</pre>
- </li>
- <li>Or you can just set your path:
-<pre class="doc_code">
-export PATH="$PREFIX/bin:$PATH"
-export CC="clang -flto"
-export CXX="clang++ -flto"
-export RANLIB=/bin/true
-export CFLAGS="-O4"
-</pre></li>
- <li>Configure &amp; build the project as usual:
-<pre class="doc_code">
-% ./configure &amp;&amp; make &amp;&amp; make check
-</pre></li>
- </ul>
-
- <p>The environment variable settings may work for non-autotooled projects
- too, but you may need to set the <tt>LD</tt> environment variable as
- well.</p>
-</div>
-
-<!--=========================================================================-->
-<h2><a name="licensing">Licensing</a></h2>
-<!--=========================================================================-->
-<div>
- <p>Gold is licensed under the GPLv3. LLVMgold uses the interface file
-<tt>plugin-api.h</tt> from gold which means that the resulting LLVMgold.so
-binary is also GPLv3. This can still be used to link non-GPLv3 programs just
-as much as gold could without the plugin.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
- <a href="mailto:nicholas@metrix.on.ca">Nick Lewycky</a><br>
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2010-04-16 23:58:21 -0800 (Fri, 16 Apr 2010) $
-</address>
-</body>
-</html>
diff --git a/docs/GoldPlugin.rst b/docs/GoldPlugin.rst
new file mode 100644
index 00000000000..300aea9f9a4
--- /dev/null
+++ b/docs/GoldPlugin.rst
@@ -0,0 +1,186 @@
+.. _gold-plugin:
+
+====================
+The LLVM gold plugin
+====================
+
+.. sectionauthor:: Nick Lewycky
+
+Introduction
+============
+
+Building with link time optimization requires cooperation from
+the system linker. LTO support on Linux systems requires that you use the
+`gold linker`_ which supports LTO via plugins. This is the same mechanism
+used by the `GCC LTO`_ project.
+
+The LLVM gold plugin implements the gold plugin interface on top of
+:ref:`libLTO`. The same plugin can also be used by other tools such as
+``ar`` and ``nm``.
+
+.. _`gold linker`: http://sourceware.org/binutils
+.. _`GCC LTO`: http://gcc.gnu.org/wiki/LinkTimeOptimization
+.. _`gold plugin interface`: http://gcc.gnu.org/wiki/whopr/driver
+
+.. _lto-how-to-build:
+
+How to build it
+===============
+
+You need to have gold with plugin support and build the LLVMgold plugin.
+Check whether you have gold running ``/usr/bin/ld -v``. It will report "GNU
+gold" or else "GNU ld" if not. If you have gold, check for plugin support
+by running ``/usr/bin/ld -plugin``. If it complains "missing argument" then
+you have plugin support. If not, such as an "unknown option" error then you
+will either need to build gold or install a version with plugin support.
+
+* To build gold with plugin support:
+
+ .. code-block:: bash
+
+ $ mkdir binutils
+ $ cd binutils
+ $ cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src login
+ {enter "anoncvs" as the password}
+ $ cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
+ $ mkdir build
+ $ cd build
+ $ ../src/configure --enable-gold --enable-plugins
+ $ make all-gold
+
+ That should leave you with ``binutils/build/gold/ld-new`` which supports
+ the ``-plugin`` option. It also built would have
+ ``binutils/build/binutils/ar`` and ``nm-new`` which support plugins but
+ don't have a visible -plugin option, instead relying on the gold plugin
+ being present in ``../lib/bfd-plugins`` relative to where the binaries
+ are placed.
+
+* Build the LLVMgold plugin: Configure LLVM with
+ ``--with-binutils-include=/path/to/binutils/src/include`` and run
+ ``make``.
+
+Usage
+=====
+
+The linker takes a ``-plugin`` option that points to the path of
+the plugin ``.so`` file. To find out what link command ``gcc``
+would run in a given situation, run ``gcc -v [...]`` and
+look for the line where it runs ``collect2``. Replace that with
+``ld-new -plugin /path/to/LLVMgold.so`` to test it out. Once you're
+ready to switch to using gold, backup your existing ``/usr/bin/ld``
+then replace it with ``ld-new``.
+
+You can produce bitcode files from ``clang`` using ``-emit-llvm`` or
+``-flto``, or the ``-O4`` flag which is synonymous with ``-O3 -flto``.
+
+Any of these flags will also cause ``clang`` to look for the gold plugin in
+the ``lib`` directory under its prefix and pass the ``-plugin`` option to
+``ld``. It will not look for an alternate linker, which is why you need
+gold to be the installed system linker in your path.
+
+If you want ``ar`` and ``nm`` to work seamlessly as well, install
+``LLVMgold.so`` to ``/usr/lib/bfd-plugins``. If you built your own gold, be
+sure to install the ``ar`` and ``nm-new`` you built to ``/usr/bin``.
+
+
+Example of link time optimization
+---------------------------------
+
+The following example shows a worked example of the gold plugin mixing LLVM
+bitcode and native code.
+
+.. code-block:: c
+
+ --- a.c ---
+ #include <stdio.h>
+
+ extern void foo1(void);
+ extern void foo4(void);
+
+ void foo2(void) {
+ printf("Foo2\n");
+ }
+
+ void foo3(void) {
+ foo4();
+ }
+
+ int main(void) {
+ foo1();
+ }
+
+ --- b.c ---
+ #include <stdio.h>
+
+ extern void foo2(void);
+
+ void foo1(void) {
+ foo2();
+ }
+
+ void foo4(void) {
+ printf("Foo4");
+ }
+
+.. code-block:: bash
+
+ --- command lines ---
+ $ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file
+ $ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode
+ $ clang b.c -c -o b.o # <-- b.o is native object file
+ $ clang -flto a.a b.o -o main # <-- link with LLVMgold plugin
+
+Gold informs the plugin that foo3 is never referenced outside the IR,
+leading LLVM to delete that function. However, unlike in the :ref:`libLTO
+example <libLTO-example>` gold does not currently eliminate foo4.
+
+Quickstart for using LTO with autotooled projects
+=================================================
+
+Once your system ``ld``, ``ar``, and ``nm`` all support LLVM bitcode,
+everything is in place for an easy to use LTO build of autotooled projects:
+
+* Follow the instructions :ref:`on how to build LLVMgold.so
+ <lto-how-to-build>`.
+
+* Install the newly built binutils to ``$PREFIX``
+
+* Copy ``Release/lib/LLVMgold.so`` to ``$PREFIX/lib/bfd-plugins/``
+
+* Set environment variables (``$PREFIX`` is where you installed clang and
+ binutils):
+
+ .. code-block:: bash
+
+ export CC="$PREFIX/bin/clang -flto"
+ export CXX="$PREFIX/bin/clang++ -flto"
+ export AR="$PREFIX/bin/ar"
+ export NM="$PREFIX/bin/nm"
+ export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
+ export CFLAGS="-O4"
+
+* Or you can just set your path:
+
+ .. code-block:: bash
+
+ export PATH="$PREFIX/bin:$PATH"
+ export CC="clang -flto"
+ export CXX="clang++ -flto"
+ export RANLIB=/bin/true
+ export CFLAGS="-O4"
+* Configure and build the project as usual:
+
+ .. code-block:: bash
+
+ % ./configure && make && make check
+
+The environment variable settings may work for non-autotooled projects too,
+but you may need to set the ``LD`` environment variable as well.
+
+Licensing
+=========
+
+Gold is licensed under the GPLv3. LLVMgold uses the interface file
+``plugin-api.h`` from gold which means that the resulting ``LLVMgold.so``
+binary is also GPLv3. This can still be used to link non-GPLv3 programs
+just as much as gold could without the plugin.
diff --git a/docs/HowToSetUpLLVMStyleRTTI.rst b/docs/HowToSetUpLLVMStyleRTTI.rst
new file mode 100644
index 00000000000..b5c1b78afeb
--- /dev/null
+++ b/docs/HowToSetUpLLVMStyleRTTI.rst
@@ -0,0 +1,281 @@
+.. _how-to-set-up-llvm-style-rtti:
+
+======================================================
+How to set up LLVM-style RTTI for your class hierarchy
+======================================================
+
+.. sectionauthor:: Sean Silva <silvas@purdue.edu>
+
+.. contents::
+
+Background
+==========
+
+LLVM avoids using C++'s built in RTTI. Instead, it pervasively uses its
+own hand-rolled form of RTTI which is much more efficient and flexible,
+although it requires a bit more work from you as a class author.
+
+A description of how to use LLVM-style RTTI from a client's perspective is
+given in the `Programmer's Manual <ProgrammersManual.html#isa>`_. This
+document, in contrast, discusses the steps you need to take as a class
+hierarchy author to make LLVM-style RTTI available to your clients.
+
+Before diving in, make sure that you are familiar with the Object Oriented
+Programming concept of "`is-a`_".
+
+.. _is-a: http://en.wikipedia.org/wiki/Is-a
+
+Basic Setup
+===========
+
+This section describes how to set up the most basic form of LLVM-style RTTI
+(which is sufficient for 99.9% of the cases). We will set up LLVM-style
+RTTI for this class hierarchy:
+
+.. code-block:: c++
+
+ class Shape {
+ public:
+ Shape() {}
+ virtual double computeArea() = 0;
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ Square(double S) : SideLength(S) {}
+ double computeArea() /* override */;
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ Circle(double R) : Radius(R) {}
+ double computeArea() /* override */;
+ };
+
+The most basic working setup for LLVM-style RTTI requires the following
+steps:
+
+#. In the header where you declare ``Shape``, you will want to ``#include
+ "llvm/Support/Casting.h"``, which declares LLVM's RTTI templates. That
+ way your clients don't even have to think about it.
+
+ .. code-block:: c++
+
+ #include "llvm/Support/Casting.h"
+
+
+#. In the base class, introduce an enum which discriminates all of the
+ different classes in the hierarchy, and stash the enum value somewhere in
+ the base class.
+
+ Here is the code after introducing this change:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ + /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ + enum ShapeKind {
+ + SquareKind,
+ + CircleKind
+ + };
+ +private:
+ + const ShapeKind Kind;
+ +public:
+ + ShapeKind getKind() const { return Kind; }
+ +
+ Shape() {}
+ virtual double computeArea() = 0;
+ };
+
+ You will usually want to keep the ``Kind`` member encapsulated and
+ private, but let the enum ``ShapeKind`` be public along with providing a
+ ``getKind()`` method. This is convenient for clients so that they can do
+ a ``switch`` over the enum.
+
+ A common naming convention is that these enums are "kind"s, to avoid
+ ambiguity with the words "type" or "class" which have overloaded meanings
+ in many contexts within LLVM. Sometimes there will be a natural name for
+ it, like "opcode". Don't bikeshed over this; when in doubt use ``Kind``.
+
+ You might wonder why the ``Kind`` enum doesn't have an entry for
+ ``Shape``. The reason for this is that since ``Shape`` is abstract
+ (``computeArea() = 0;``), you will never actually have non-derived
+ instances of exactly that class (only subclasses). See `Concrete Bases
+ and Deeper Hierarchies`_ for information on how to deal with
+ non-abstract bases. It's worth mentioning here that unlike
+ ``dynamic_cast<>``, LLVM-style RTTI can be used (and is often used) for
+ classes that don't have v-tables.
+
+#. Next, you need to make sure that the ``Kind`` gets initialized to the
+ value corresponding to the dynamic type of the class. Typically, you will
+ want to have it be an argument to the constructor of the base class, and
+ then pass in the respective ``XXXKind`` from subclass constructors.
+
+ Here is the code after that change:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ enum ShapeKind {
+ SquareKind,
+ CircleKind
+ };
+ private:
+ const ShapeKind Kind;
+ public:
+ ShapeKind getKind() const { return Kind; }
+
+ - Shape() {}
+ + Shape(ShapeKind K) : Kind(K) {}
+ virtual double computeArea() = 0;
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ - Square(double S) : SideLength(S) {}
+ + Square(double S) : Shape(SquareKind), SideLength(S) {}
+ double computeArea() /* override */;
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ - Circle(double R) : Radius(R) {}
+ + Circle(double R) : Shape(CircleKind), Radius(R) {}
+ double computeArea() /* override */;
+ };
+
+#. Finally, you need to inform LLVM's RTTI templates how to dynamically
+ determine the type of a class (i.e. whether the ``isa<>``/``dyn_cast<>``
+ should succeed). The default "99.9% of use cases" way to accomplish this
+ is through a small static member function ``classof``. In order to have
+ proper context for an explanation, we will display this code first, and
+ then below describe each part:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ enum ShapeKind {
+ SquareKind,
+ CircleKind
+ };
+ private:
+ const ShapeKind Kind;
+ public:
+ ShapeKind getKind() const { return Kind; }
+
+ Shape(ShapeKind K) : Kind(K) {}
+ virtual double computeArea() = 0;
+ +
+ + static bool classof(const Shape *) { return true; }
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ Square(double S) : Shape(SquareKind), SideLength(S) {}
+ double computeArea() /* override */;
+ +
+ + static bool classof(const Square *) { return true; }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() == SquareKind;
+ + }
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ Circle(double R) : Shape(CircleKind), Radius(R) {}
+ double computeArea() /* override */;
+ +
+ + static bool classof(const Circle *) { return true; }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() == CircleKind;
+ + }
+ };
+
+ Basically, the job of ``classof`` is to return ``true`` if its argument
+ is of the enclosing class's type. As you can see, there are two general
+ overloads of ``classof`` in use here.
+
+ #. The first, which just returns ``true``, means that if we know that the
+ argument of the cast is of the enclosing type *at compile time*, then
+ we don't need to bother to check anything since we already know that
+ the type is convertible. This is an optimization for the case that we
+ statically know the conversion is OK.
+
+ #. The other overload takes a pointer to an object of the base of the
+ class hierarchy: this is the "general case" of the cast. We need to
+ check the ``Kind`` to dynamically decide if the argument is of (or
+ derived from) the enclosing type.
+
+ To be more precise, let ``classof`` be inside a class ``C``. Then the
+ contract for ``classof`` is "return ``true`` if the argument is-a
+ ``C``". As long as your implementation fulfills this contract, you can
+ tweak and optimize it as much as you want.
+
+Although for this small example setting up LLVM-style RTTI seems like a lot
+of "boilerplate", if your classes are doing anything interesting then this
+will end up being a tiny fraction of the code.
+
+Concrete Bases and Deeper Hierarchies
+=====================================
+
+For concrete bases (i.e. non-abstract interior nodes of the inheritance
+tree), the ``Kind`` check inside ``classof`` needs to be a bit more
+complicated. Say that ``SpecialSquare`` and ``OtherSpecialSquare`` derive
+from ``Square``, and so ``ShapeKind`` becomes:
+
+.. code-block:: c++
+
+ enum ShapeKind {
+ SquareKind,
+ + SpecialSquareKind,
+ + OtherSpecialSquareKind,
+ CircleKind
+ }
+
+Then in ``Square``, we would need to modify the ``classof`` like so:
+
+.. code-block:: c++
+
+ static bool classof(const Square *) { return true; }
+ - static bool classof(const Shape *S) {
+ - return S->getKind() == SquareKind;
+ - }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() >= SquareKind &&
+ + S->getKind() <= OtherSpecialSquareKind;
+ + }
+
+The reason that we need to test a range like this instead of just equality
+is that both ``SpecialSquare`` and ``OtherSpecialSquare`` "is-a"
+``Square``, and so ``classof`` needs to return ``true`` for them.
+
+This approach can be made to scale to arbitrarily deep hierarchies. The
+trick is that you arrange the enum values so that they correspond to a
+preorder traversal of the class hierarchy tree. With that arrangement, all
+subclass tests can be done with two comparisons as shown above. If you just
+list the class hierarchy like a list of bullet points, you'll get the
+ordering right::
+
+ | Shape
+ | Square
+ | SpecialSquare
+ | OtherSpecialSquare
+ | Circle
+
+.. TODO::
+
+ Touch on some of the more advanced features, like ``isa_impl`` and
+ ``simplify_type``. However, those two need reference documentation in
+ the form of doxygen comments as well. We need the doxygen so that we can
+ say "for full details, see http://llvm.org/doxygen/..."
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 89b9227b722..167397ff53d 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -1107,9 +1107,9 @@ declare signext i8 @returns_signed_char()
<dd>This indicates that the pointer parameter specifies the address of a
structure that is the return value of the function in the source program.
This pointer must be guaranteed by the caller to be valid: loads and
- stores to the structure may be assumed by the callee to not to trap. This
- may only be applied to the first parameter. This is not a valid attribute
- for return values. </dd>
+ stores to the structure may be assumed by the callee to not to trap and
+ to be properly aligned. This may only be applied to the first parameter.
+ This is not a valid attribute for return values. </dd>
<dt><tt><b><a name="noalias">noalias</a></b></tt></dt>
<dd>This indicates that pointer values
@@ -2104,7 +2104,7 @@ in signal handlers).</p>
<p>Structures may optionally be "packed" structures, which indicate that the
alignment of the struct is one byte, and that there is no padding between
the elements. In non-packed structs, padding between field types is inserted
- as defined by the TargetData string in the module, which is required to match
+ as defined by the DataLayout string in the module, which is required to match
what the underlying code generator expects.</p>
<p>Structures can either be "literal" or "identified". A literal structure is
diff --git a/docs/LinkTimeOptimization.rst b/docs/LinkTimeOptimization.rst
index 53d673e4066..7eacf0bd0d0 100644
--- a/docs/LinkTimeOptimization.rst
+++ b/docs/LinkTimeOptimization.rst
@@ -29,6 +29,8 @@ bitcode files. This tight integration between the linker and LLVM optimizer
helps to do optimizations that are not possible in other models. The linker
input allows the optimizer to avoid relying on conservative escape analysis.
+.. _libLTO-example:
+
Example of link time optimization
---------------------------------
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html
index 036c387d7a5..64ddb9d105d 100644
--- a/docs/ProgrammersManual.html
+++ b/docs/ProgrammersManual.html
@@ -98,6 +98,7 @@ option</a></li>
<li><a href="#dss_valuemap">"llvm/ADT/ValueMap.h"</a></li>
<li><a href="#dss_intervalmap">"llvm/ADT/IntervalMap.h"</a></li>
<li><a href="#dss_map">&lt;map&gt;</a></li>
+ <li><a href="#dss_mapvector">"llvm/ADT/MapVector.h"</a></li>
<li><a href="#dss_inteqclasses">"llvm/ADT/IntEqClasses.h"</a></li>
<li><a href="#dss_immutablemap">"llvm/ADT/ImmutableMap.h"</a></li>
<li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
@@ -432,10 +433,10 @@ if (<a href="#AllocationInst">AllocationInst</a> *AI = dyn_cast&lt;<a href="#All
</dl>
<p>These five templates can be used with any classes, whether they have a
-v-table or not. To add support for these templates, you simply need to add
-<tt>classof</tt> static methods to the class you are interested casting
-to. Describing this is currently outside the scope of this document, but there
-are lots of examples in the LLVM source base.</p>
+v-table or not. If you want to add support for these templates, see the
+document <a href="HowToSetUpLLVMStyleRTTI.html">How to set up LLVM-style
+RTTI for your class hierarchy </a>.
+</p>
</div>
@@ -1848,6 +1849,24 @@ another element takes place).</p>
</div>
+
+<!-- _______________________________________________________________________ -->
+<h4>
+ <a name="dss_mapvector">"llvm/ADT/MapVector.h"</a>
+</h4>
+<div>
+
+<p> MapVector&lt;KeyT,ValueT&gt provides a subset of the DenseMap interface.
+ The main difference is that the iteration order is guaranteed to be
+ the insertion order, making it an easy (but somewhat expensive) solution
+ for non-deterministic iteration over maps of pointers. </p>
+
+<p> It is implemented by mapping from key to an index in a vector of key,value
+ pairs. This provides fast lookup and iteration, but has two main drawbacks:
+ The key is stored twice and it doesn't support removing elements. </p>
+
+</div>
+
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_inteqclasses">"llvm/ADT/IntEqClasses.h"</a>
diff --git a/docs/SourceLevelDebugging.html b/docs/SourceLevelDebugging.html
index 918383bc213..546aab9d1aa 100644
--- a/docs/SourceLevelDebugging.html
+++ b/docs/SourceLevelDebugging.html
@@ -2367,11 +2367,11 @@ bucket contents:
| HEADER.header_data_len | uint32_t
| HEADER_DATA | HeaderData
|-------------------------|
-| BUCKETS | uint32_t[n_buckets] // 32 bit hash indexes
+| BUCKETS | uint32_t[bucket_count] // 32 bit hash indexes
|-------------------------|
-| HASHES | uint32_t[n_buckets] // 32 bit hash values
+| HASHES | uint32_t[hashes_count] // 32 bit hash values
|-------------------------|
-| OFFSETS | uint32_t[n_buckets] // 32 bit offsets to hash value data
+| OFFSETS | uint32_t[hashes_count] // 32 bit offsets to hash value data
|-------------------------|
| ALL HASH DATA |
`-------------------------'
diff --git a/docs/WritingAnLLVMBackend.html b/docs/WritingAnLLVMBackend.html
index 441d122f539..7576d490d7a 100644
--- a/docs/WritingAnLLVMBackend.html
+++ b/docs/WritingAnLLVMBackend.html
@@ -314,14 +314,14 @@ represent target components. These methods are named <tt>get*Info</tt>, and are
intended to obtain the instruction set (<tt>getInstrInfo</tt>), register set
(<tt>getRegisterInfo</tt>), stack frame layout (<tt>getFrameInfo</tt>), and
similar information. <tt>XXXTargetMachine</tt> must also implement the
-<tt>getTargetData</tt> method to access an object with target-specific data
+<tt>getDataLayout</tt> method to access an object with target-specific data
characteristics, such as data type size and alignment requirements.
</p>
<p>
For instance, for the SPARC target, the header file
<tt>SparcTargetMachine.h</tt> declares prototypes for several <tt>get*Info</tt>
-and <tt>getTargetData</tt> methods that simply return a class member.
+and <tt>getDataLayout</tt> methods that simply return a class member.
</p>
<div class="doc_code">
@@ -331,7 +331,7 @@ namespace llvm {
class Module;
class SparcTargetMachine : public LLVMTargetMachine {
- const TargetData DataLayout; // Calculates type size &amp; alignment
+ const DataLayout DataLayout; // Calculates type size &amp; alignment
SparcSubtarget Subtarget;
SparcInstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
@@ -348,7 +348,7 @@ public:
virtual const TargetRegisterInfo *getRegisterInfo() const {
return &amp;InstrInfo.getRegisterInfo();
}
- virtual const TargetData *getTargetData() const { return &amp;DataLayout; }
+ virtual const DataLayout *getDataLayout() const { return &amp;DataLayout; }
static unsigned getModuleMatchQuality(const Module &amp;M);
// Pass Pipeline Configuration
@@ -364,7 +364,7 @@ public:
<li><tt>getInstrInfo()</tt></li>
<li><tt>getRegisterInfo()</tt></li>
<li><tt>getFrameInfo()</tt></li>
-<li><tt>getTargetData()</tt></li>
+<li><tt>getDataLayout()</tt></li>
<li><tt>getSubtargetImpl()</tt></li>
</ul>
diff --git a/docs/index.rst b/docs/index.rst
index 50f76a3e3f4..d406b525744 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -26,7 +26,7 @@ targeted at different audiences:
* **User Guides**
- Those new to the LLVM system should first vist the :ref:`userguides`.
+ Those new to the LLVM system should first visit the :ref:`userguides`.
NOTE: If you are a user who is only interested in using LLVM-based
compilers, you should look into `Clang <http://clang.llvm.org>`_ or
diff --git a/docs/programming.rst b/docs/programming.rst
index 5d000cb3c2e..c4eec59417e 100644
--- a/docs/programming.rst
+++ b/docs/programming.rst
@@ -6,9 +6,12 @@ Programming Documentation
.. toctree::
:hidden:
+ Atomics
CodingStandards
CommandLine
- Atomics
+ CompilerWriterInfo
+ ExtendingLLVM
+ HowToSetUpLLVMStyleRTTI
* `LLVM Language Reference Manual <LangRef.html>`_
@@ -33,7 +36,12 @@ Programming Documentation
Details the LLVM coding standards and provides useful information on writing
efficient C++ code.
-* `Extending LLVM <ExtendingLLVM.html>`_
+* :doc:`HowToSetUpLLVMStyleRTTI`
+
+ How to make ``isa<>``, ``dyn_cast<>``, etc. available for clients of your
+ class hierarchy.
+
+* :ref:`extending_llvm`
Look here to see how to add instructions and intrinsics to LLVM.
@@ -43,3 +51,7 @@ Programming Documentation
(`tarball <http://llvm.org/doxygen/doxygen.tar.gz>`_)
* `ViewVC Repository Browser <http://llvm.org/viewvc/>`_
+
+* :ref:`compiler_writer_info`
+
+ A list of helpful links for compiler writers.
diff --git a/docs/subsystems.rst b/docs/subsystems.rst
index 6c20a61c606..8c3cdf2417b 100644
--- a/docs/subsystems.rst
+++ b/docs/subsystems.rst
@@ -16,6 +16,7 @@ Subsystem Documentation
SegmentedStacks
TableGenFundamentals
DebuggingJITedCode
+ GoldPlugin
* `Writing an LLVM Pass <WritingAnLLVMPass.html>`_
@@ -75,7 +76,7 @@ Subsystem Documentation
This document describes the interface between LLVM intermodular optimizer
and the linker and its design
-* `The LLVM gold plugin <GoldPlugin.html>`_
+* :ref:`gold-plugin`
How to build your programs with link-time optimization on Linux.
diff --git a/docs/tutorial/LangImpl4.html b/docs/tutorial/LangImpl4.html
index 453e43a02e5..53695924b22 100644
--- a/docs/tutorial/LangImpl4.html
+++ b/docs/tutorial/LangImpl4.html
@@ -173,7 +173,7 @@ add a set of optimizations to run. The code looks like this:</p>
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -523,7 +523,7 @@ at runtime.</p>
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include &lt;cstdio&gt;
@@ -1103,7 +1103,7 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine-&gt;getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
diff --git a/docs/tutorial/LangImpl5.html b/docs/tutorial/LangImpl5.html
index 2d406df3aaf..768d9a0e115 100644
--- a/docs/tutorial/LangImpl5.html
+++ b/docs/tutorial/LangImpl5.html
@@ -901,7 +901,7 @@ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include &lt;cstdio&gt;
@@ -1723,7 +1723,7 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine-&gt;getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
diff --git a/docs/tutorial/LangImpl6.html b/docs/tutorial/LangImpl6.html
index a76298012fd..bf502e7da97 100644
--- a/docs/tutorial/LangImpl6.html
+++ b/docs/tutorial/LangImpl6.html
@@ -840,7 +840,7 @@ library, although doing that will cause problems on Windows.</p>
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include &lt;cstdio&gt;
@@ -1780,7 +1780,7 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine-&gt;getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
diff --git a/docs/tutorial/LangImpl7.html b/docs/tutorial/LangImpl7.html
index 08c0c716b6f..8fa99b19039 100644
--- a/docs/tutorial/LangImpl7.html
+++ b/docs/tutorial/LangImpl7.html
@@ -524,7 +524,7 @@ good codegen once again:</p>
<pre>
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine-&gt;getDataLayout()));
<b>// Promote allocas to registers.
OurFPM.add(createPromoteMemoryToRegisterPass());</b>
// Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -1008,7 +1008,7 @@ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include &lt;cstdio&gt;
@@ -2113,7 +2113,7 @@ int main() {
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine-&gt;getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Promote allocas to registers.
diff --git a/docs/tutorial/OCamlLangImpl4.html b/docs/tutorial/OCamlLangImpl4.html
index ca427eb0e08..eb97d986c2d 100644
--- a/docs/tutorial/OCamlLangImpl4.html
+++ b/docs/tutorial/OCamlLangImpl4.html
@@ -189,7 +189,7 @@ add a set of optimizations to run. The code looks like this:</p>
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combining the_fpm;
@@ -965,7 +965,7 @@ let main () =
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
diff --git a/docs/tutorial/OCamlLangImpl5.html b/docs/tutorial/OCamlLangImpl5.html
index feeed6a5337..d25f1dc9bbf 100644
--- a/docs/tutorial/OCamlLangImpl5.html
+++ b/docs/tutorial/OCamlLangImpl5.html
@@ -1498,7 +1498,7 @@ let main () =
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
diff --git a/docs/tutorial/OCamlLangImpl6.html b/docs/tutorial/OCamlLangImpl6.html
index 2ee5089721c..56883d539b8 100644
--- a/docs/tutorial/OCamlLangImpl6.html
+++ b/docs/tutorial/OCamlLangImpl6.html
@@ -1506,7 +1506,7 @@ let main () =
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
diff --git a/docs/tutorial/OCamlLangImpl7.html b/docs/tutorial/OCamlLangImpl7.html
index d106ad0701c..fd66b10c1a1 100644
--- a/docs/tutorial/OCamlLangImpl7.html
+++ b/docs/tutorial/OCamlLangImpl7.html
@@ -545,7 +545,7 @@ let main () =
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
<b>(* Promote allocas to registers. *)
add_memory_to_register_promotion the_fpm;</b>
@@ -1834,7 +1834,7 @@ let main () =
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Promote allocas to registers. *)
add_memory_to_register_promotion the_fpm;
diff --git a/docs/userguides.rst b/docs/userguides.rst
index c5dd9792243..6ff46ade480 100644
--- a/docs/userguides.rst
+++ b/docs/userguides.rst
@@ -10,6 +10,7 @@ User Guides
HowToBuildOnARM
CommandGuide/index
DeveloperPolicy
+ GettingStarted
GettingStartedVS
FAQ
Lexicon
@@ -18,7 +19,7 @@ User Guides
yaml2obj
HowToSubmitABug
-* `The LLVM Getting Started Guide <GettingStarted.html>`_
+* :ref:`getting_started`
Discusses how to get up and running quickly with the LLVM infrastructure.
Everything from unpacking and compilation of the distribution to execution