Corrected the Table of Contents.

Corrected capitalization of subheadings.
Created a new subsection for compiling the C front end and moved all references
to it there.
Updated the disk space requirements to reflect the need for the binary C front
end and the optional C front end source.
Added information on unpacking the distribution to the summary section.
Moved autoconf environment variables to the autoconf section.
Changed make to gmake.
Removed some of the precise directions for unpacking the archives.
Fixed some formatting inconsistencies (headings that were not centered).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John Criswell 2003-07-08 20:35:59 +00:00
parent 0df8adc0e6
commit 0b459204af

View File

@ -27,25 +27,27 @@
</ol>
<li><a href="#starting">Getting started with LLVM</a>
<ol>
<li><a href="#quickstart">Getting started quickly (a summary)</a>
<li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
<li><a href="#terminology">Terminology and Notation</tt></a>
<li><a href="#environment">Setting up your environment</a>
<li><a href="#environment">Setting Up Your Environment</a>
<li><a href="#unpack">Unpacking the LLVM Archives</a>
<li><a href="#checkout">Checkout LLVM from CVS</a>
<li><a href="#config">Local LLVM Configuration</tt></a>
<li><a href="#installcf">Install the C Front End</a>
<li><a href="#config">Local LLVM Configuration</tt></a>
<li><a href="#compile">Compiling the LLVM Suite Source Code</a>
<li><a href="#build">Compiling the LLVM C Front End</a>
<li><a href="#objfiles">The location for object files</tt></a>
<li><a href="#objfiles">The Location of LLVM Object Files</tt></a>
</ol>
<li><a href="#layout">Program layout</a>
<ol>
<li><a href="#cvsdir">CVS directories</a>
<li><a href="#cvsdir"><tt>CVS</tt> directories</a>
<li><a href="#include"><tt>llvm/include</tt></a>
<li><a href="#lib"><tt>llvm/lib</tt></a>
<li><a href="#test"><tt>llvm/test</tt></a>
<li><a href="#tools"><tt>llvm/tools</tt></a>
</ol>
<li><a href="#tutorial">An example using the LLVM tool chain</a>
<li><a href="#cfront">Compiling the LLVM C Front End</a>
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
<li><a href="#problems">Common Problems</a>
<li><a href="#links">Links</a>
</ul>
@ -63,13 +65,13 @@
First, LLVM comes in two pieces. The first piece is the LLVM suite. This
contains all of the tools, libraries, and header files needed to use the
low level virtual machine. It also contains a test suite that can be used
to test the LLVM tools and the GCC front end.
to test the LLVM tools and the C front end.
<p>
The second piece is the GCC front end. This component provides a version
The second piece is the C front end. This component provides a version
of GCC that compiles C code into LLVM bytecode. Currently, the C front end
is a modified version of GCC 3.4 (we track the GCC 3.4 development).
Once compiled into LLVM bytecode, a program can be manipulated with the
LLVM tools.
LLVM tools from the LLVM suite.
<!--=====================================================================-->
<h3><a name="requirements"><b>Requirements</b></a></h3>
@ -86,27 +88,63 @@
<ul>
<li> Linux on x86
<ul>
<li> Approximately 700 MB of Free Disk Space
<li> Approximately 760 MB of Free Disk Space
<ul>
<li>Source code: 30 MB
<li>Object code: 670 MB
<li>C front end: 60 MB
</ul>
</ul>
<p>
<li> Solaris on SparcV9 (Ultrasparc)
<ul>
<li> Approximately 1.03 GB of Free Disk Space
<li> Approximately 1.24 GB of Free Disk Space
<ul>
<li>Source code: 30 MB
<li>Object code: 1000 MB
<li>C front end: 210 MB
</ul>
</ul>
</ul>
<p>
If you want to compile your own version of the C front end, you will need
additional disk space:
</p>
<ul>
<li>Linux on x86
<ul>
<li> Approximately 249 MB of Free Disk Space
<ul>
<li>Source code: 146 MB
<li>Object code: 82 MB
<li>Installed binaries: 21 MB
</ul>
</ul>
<p>
<li>Solaris on Sparc
<ul>
<li> Approximately 264 MB of Free Disk Space
<ul>
<li>Source code: 146 MB
<li>Object code: 93 MB
<li>Installed binaries: 25 MB
</ul>
</ul>
</ul>
<p>
LLVM <i>may</i> compile on other platforms. The LLVM utilities should work
on other platforms, so it should be possible to generate and produce LLVM
bytecode on unsupported platforms (although bytecode generated on one
platform may not work on another platform). However, the code generators
and Just-In-Time (JIT) compilers only generate SparcV9 or x86 machine code.
</p>
<!--=====================================================================-->
<h4><a name="software"><b>Software</b></a></h4>
@ -184,7 +222,7 @@
<!--=====================================================================-->
<center>
<h2><a name="starting"><b>Getting Started</b></a></h2>
<h2><a name="starting"><b>Getting Started with LLVM</b></a></h2>
</center>
<!--=====================================================================-->
@ -194,43 +232,75 @@
Here's the short story for getting up and running quickly with LLVM:
<ol>
<li>Build the LLVM suite
<li>Install the C front end:
<ol>
<li>Find the path to the CVS repository containing LLVM (we'll call this <i>CVSROOTDIR</i>).
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cvs -d <i>CVSROOTDIR</i> checkout llvm</tt>
<li><tt>cd llvm</tt>
<li>Run <tt>configure</tt> to configure the Makefiles and header files.
Useful options include:
<ul>
<li><tt>--with-objroot=<i>directory</i></tt>
<br>
Specify where object files should be placed during the build.
<li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt>
<li><tt>gunzip --stdout cfrontend.<i>platform</i>.tar.gz | tar -xvf
-</tt>
</ol>
<li><tt>--with-llvmgccdir=<i>directory</i></tt>
<br>
Specify where the LLVM C frontend is going to be installed.
</ul>
<li>Set your LLVM_LIB_SEARCH_PATH environment variable.
<li><tt>gmake -k |& tee gnumake.out
<p>
<li>Get the Source Code
<ul>
<li>With the distributed files:
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>gunzip --stdout llvm.tar.gz | tar -xvf -</tt>
<li><tt>gunzip --stdout cfrontend.<i>platform</i>.tar.gz | tar -xvf -</tt>
<li><tt>cd llvm</tt>
</ol>
<p>
<li>With anonymous CVS access:
<ol>
<li>Find the path to the CVS repository containing LLVM (we'll call this <i>CVSROOTDIR</i>).
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cvs -d <i>CVSROOTDIR</i> checkout llvm</tt>
<li><tt>cd llvm</tt>
</ol>
</ul>
</ul>
<p>
<li>Configure the LLVM Build Environment
<ol>
<li>Run <tt>configure</tt> to configure the Makefiles and header
files for the default platform.
Useful options include:
<ul>
<li><tt>--with-objroot=<i>directory</i></tt>
<br>
Specify where object files should be placed during the build.
<li><tt>--with-llvmgccdir=<i>directory</i></tt>
<br>
Specify where the LLVM C frontend is going to be installed.
</ul>
</ol>
<p>
<li>Build the LLVM Suite
<ol>
<li>Set your LLVM_LIB_SEARCH_PATH environment variable.
<li><tt>gmake -k |& tee gnumake.out
&nbsp;&nbsp;&nbsp;# this is csh or tcsh syntax</tt>
</ol>
<p>
<li>Build the LLVM C Front End <b>(optional)</b>
<ol>
<li>Create a directory for the object files to live.
<li><tt>cd <i>object file directory</i></tt>
<li>Run <tt><i>Pathname-to-where-the-source-code-lives</i>/configure --prefix=<i>LLVMGCCDIR</i></tt> to configure GCC.
<li><tt>make bootstrap</tt>
<li><tt>make install</tt>
</ol>
</ol>
<p>See <a href="#environment">Setting up your environment</a> on tips to
<p>See <a href="#environment">Setting Up Your Environment</a> on tips to
simplify working with the LLVM front-end and compiled tools. See the
other sub-sections below for other useful details in working with LLVM,
or go straight to <a href="#layout">Program Layout</a> to learn about the
layout of the source code tree.
layout of the source code tree. For information on building the C front
end yourself, see <a href="#cfront">Compiling the LLVM C Front End</a> for
information.
<!------------------------------------------------------------------------->
<h3><a name="terminology">Terminology and Notation</a></h3>
@ -280,7 +350,7 @@
</dl>
<!------------------------------------------------------------------------->
<h3><a name="environment">Setting up your environment</a></h3>
<h3><a name="environment">Setting Up Your Environment</a></h3>
<!------------------------------------------------------------------------->
<p>
@ -296,32 +366,6 @@
libraries that it will need for compilation.
<p>
<dt><tt>PATH</tt>=<tt>${PATH}:<i>OBJ_ROOT</i>/llvm/tools/Debug</tt>
<dd>
Adding this directory to the end of your path will allow the
compilation of the C front end to find the LLVM tools. The LLVM tools
are needed for the C front end compile.
<p>
<dt><tt>CC</tt>=<i>Pathname to your GCC compiler</i>
<dd>
The GCC compiler that you want to use must be the first C compiler in
your <tt>PATH</tt>. Otherwise, set this variable so that
<tt>configure</tt> will use the GCC compiler that you want to use.
<p>
<dt><tt>CXX</tt>=<i>Pathname to your GCC C++ compiler</i>
<dd>
The GCC compiler that you want to use must be the first C++ compiler in
your <tt>PATH</tt>. Otherwise, set this variable so that
<tt>configure</tt> will use the GCC compiler that you want to use.
<p>
<dt><tt>CVSROOT</tt>=<i>CVSROOT</i>
<dd>
This environment variable tells CVS where to find the CVS repository.
<p>
<dt>alias llvmgcc <i>LLVMGCCDIR</i><tt>/bin/llvm-gcc</tt>
<dd>
This alias allows you to use the LLVM C front end without putting it in
@ -338,7 +382,7 @@
file is a TAR archive that is compressed with the gzip program.
</p>
<p> The four files are the following:
<p> The four files are as follows:
<dl compact>
<dt>llvm.tar.gz
<dd>This is the source code to the LLVM suite.
@ -357,19 +401,6 @@
<p>
</dl>
<p>
To unpack the files, take each one, unzip it, and then untar it. A fast
way to do that is with the following:
</p>
<tt>gunzip --stdout <i>name of file</i> | tar -xvf -</tt>
<p>
For example, to extract the LLVM source code, use the following command:
</p>
<tt>gunzip --stdout llvm.tar.gz | tar -xvf -</tt>
<!------------------------------------------------------------------------->
<h3><a name="checkout">Checkout LLVM from CVS</a></h3>
<!------------------------------------------------------------------------->
@ -392,6 +423,25 @@
binary distribution for your platform.
</p>
<!------------------------------------------------------------------------->
<h3><a name="installcf">Install the C Front End</a></h3>
<!------------------------------------------------------------------------->
<p>
Before configuring and compiling the LLVM suite, it is best to extract the
LLVM C front end. While not used in building, the C front end is used by
the LLVM test suite, and its location must be given to the
<tt>configure</tt> script before the LLVM suite can be built.
</p>
<p>
To install the C front end, do the following:
<ol>
<li><tt>cd <i>where-you-want-the-front-end-to-live</i></tt>
<li><tt>gunzip --stdout cfrontend.<i>platform</i>.tar.gz | tar -xvf
-</tt>
</ol>
<!------------------------------------------------------------------------->
<h3><a name="config">Local LLVM Configuration</a></h3>
<!------------------------------------------------------------------------->
@ -402,16 +452,42 @@
<tt>llvm/include/Config/config.h</tt>.
<p>
The following environment variables are used by <tt>configure</tt> to
configure Makefile.config:
The following environment variables are used by the <tt>configure</tt>
script to configure the build system:
</p>
<ul>
<p><li><i>CXX</i> = Pathname of the C++ compiler to use.
<p><li><i>CC</i> = Pathname of the C compiler to use.
</ul>
<table border=1>
<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 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 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 compact>
<dt><i>--with-objroot=OBJ_ROOT</i>
@ -422,7 +498,7 @@
within the source code tree. If left unspecified, the default value is
<tt>.</tt>.
(See the Section on <a href=#objfiles>
The location for LLVM object files</a>
The Location of LLVM Object Files</a>
for more information.)
<p>
<dt><i>--with-llvmgccdir=LLVMGCCDIR</i>
@ -480,13 +556,13 @@
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 setting variables on the
<tt>make</tt> command line.
<tt>gmake</tt> command line.
</dl>
Once you have LLVM configured, you can build it by entering the top level
<tt>llvm</tt> directory and issuing the following command:
<p>
<tt>make</tt>
<tt>gmake</tt>
<p>
If you have multiple processors in your machine, you may wish to use some
@ -495,22 +571,22 @@
</p>
<p>
<tt>make -j2</tt>
<tt>gmake -j2</tt>
<p>
There are several other targets which are useful when working with the LLVM
source code:
<dl compact>
<dt><tt>make clean</tt>
<dt><tt>gmake clean</tt>
<dd>
Removes all files generated by the build. This includes object files,
generated C/C++ files, libraries, and executables.
<p>
<dt><tt>make distclean</tt>
<dt><tt>gmake distclean</tt>
<dd>
Removes everything that <tt>make clean</tt> does, but also removes
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.
<p>
@ -520,79 +596,29 @@
declaring variables on the command line. The following are some examples:
<dl compact>
<dt><tt>make ENABLE_OPTIMIZED=1</tt>
<dt><tt>gmake ENABLE_OPTIMIZED=1</tt>
<dd>
Perform a Release (Optimized) build.
<p>
<dt><tt>make ENABLE_PROFILING=1</tt>
<dt><tt>gmake ENABLE_PROFILING=1</tt>
<dd>
Perform a Profiling build.
<p>
<dt><tt>make VERBOSE=1</tt>
<dt><tt>gmake VERBOSE=1</tt>
<dd>
Print what <tt>make</tt> is doing on standard output.
Print what <tt>gmake</tt> is doing on standard output.
<p>
</dl>
Every directory in the LLVM source tree includes a <tt>Makefile</tt> to
build it and any subdirectories that it contains. Entering any directory
inside the LLVM source tree and typing <tt>make</tt> should rebuild
inside the LLVM source tree and typing <tt>gmake</tt> should rebuild
anything in or below that directory that is out of date.
<!------------------------------------------------------------------------->
<h3><a name="build">Compiling the LLVM C Front End</a></h3>
<!------------------------------------------------------------------------->
<b>
<p>
This step is optional if you have the C front end binary distrubtion for
your platform.
</p>
</b>
Now that you have the LLVM Suite built, you can build the C front end. For
those of you that have built GCC before, the process is very similar.
<p>
Be forewarned, though: the build system for the C front end is not as
polished as the rest of the LLVM code, so there will be many warnings and
errors that you will need to ignore for now:
<ol>
<li>Ensure that <tt><i>OBJ_ROOT</i>/llvm/tools/Debug</tt> is at the
<i>end</i> of your <tt>PATH</tt> environment variable.
<li><tt>cd <i>GCCOBJ</i></tt>
<li>Configure the source code:
<ul>
<li>On Linux/x86, use
<ul>
<li><tt><i>GCCSRC</i>/configure --prefix=<i>LLVMGCCDIR</i>
--enable-languages=c</tt>
</ul>
<li>On Solaris/Sparc, use
<ul>
<li><tt><i>GCCSRC</i>/configure --prefix=<i>LLVMGCCDIR</i>
--enable-languages=c --target=sparcv9-sun-solaris2</tt>
</ul>
</ul>
<li><tt>make</tt>
<li>The build will eventually fail. Don't worry; chances are good that
everything that needed to build is built.
<li><tt>make -k install</tt>
</ol>
At this point, you should have a working copy of the LLVM C front end
installed in <i>LLVMGCCDIR</i>.
<!------------------------------------------------------------------------->
<h3><a name="objfiles">The location for LLVM object files</a></h3>
<h3><a name="objfiles">The Location of LLVM Object Files</a></h3>
<!------------------------------------------------------------------------->
<p>The LLVM build system sends most output files generated during the build
@ -825,9 +851,66 @@
what an analysis does.<p>
</dl>
<!--=====================================================================-->
<h2><a name="tutorial">An example using the LLVM tool chain</h2>
<h2><center><a name="cfront">Compiling the LLVM C Front End</center></h2>
<!--=====================================================================-->
<p>
<b>
This step is optional if you have the C front end binary distrubtion for
your platform.
</b>
</p>
Now that you have the LLVM suite built, you can build the C front end. For
those of you that have built GCC before, the process is very similar.
<p>
Be forewarned, though: the build system for the C front end is not as
polished as the rest of the LLVM code, so there will be many warnings and
errors that you will need to ignore for now:
<ol>
<li>Ensure that <tt><i>OBJ_ROOT</i>/llvm/tools/Debug</tt> is at the
<i>end</i> of your <tt>PATH</tt> environment variable. The front end
build needs to know where to find the LLVM tools, but you want to
ensure that these tools are not found before the system assembler and
linker that you normally use for compilation.
<li><tt>cd <i>GCCOBJ</i></tt>
<li>Configure the source code:
<ul>
<li>On Linux/x86, use
<ul>
<li><tt><i>GCCSRC</i>/configure --prefix=<i>LLVMGCCDIR</i>
--enable-languages=c</tt>
</ul>
<li>On Solaris/Sparc, use
<ul>
<li><tt><i>GCCSRC</i>/configure --prefix=<i>LLVMGCCDIR</i>
--enable-languages=c --target=sparcv9-sun-solaris2</tt>
</ul>
</ul>
<li><tt>gmake</tt>
<li>The build will eventually fail. Don't worry; chances are good that
everything that needed to build is built.
<li><tt>gmake -k install</tt>
</ol>
<p>
Once this is done, you should have a built front end compiler in
<tt><i>LLVMGCCDIR</i></tt>.
</p>
<!--=====================================================================-->
<h2>
<center><a name="tutorial">An Example Using the LLVM Tool Chain</center>
</h2>
<!--=====================================================================-->
<ol>
@ -881,7 +964,9 @@
<!--=====================================================================-->
<h2><a name="help">Common Problems</a></h2>
<h2>
<center><a name="problems">Common Problems</a></center>
</h2>
<!--=====================================================================-->
Below are common problems and their remedies:
@ -933,7 +1018,7 @@
</dl>
<!--=====================================================================-->
<h2><a name="links">Links</a></h2>
<h2><center><a name="links">Links</a></center></h2>
<!--=====================================================================-->
<p>This document is just an <b>introduction</b> to how to use LLVM to do