diff options
-rw-r--r-- | docs/GettingStarted.html | 1964 |
1 files changed, 1006 insertions, 958 deletions
diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 3aab1932ff..3eae0d10bb 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -1,1049 +1,1097 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> <html> - <head> - <title>Getting Started with LLVM System</title> - </head> - - <body bgcolor=white> - <center><h1>Getting Started with the LLVM System<br><font size=3>By: <a - href="mailto:gshi1@uiuc.edu">Guochun Shi</a>, - <a href="mailto:sabre@nondot.org">Chris Lattner</a>, - <a href="mailto:criswell@uiuc.edu">John Criswell</a>, - <a href="http://misha.brukman.net">Misha Brukman</a>, and - <a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a> - </font></h1></center> - - <!--=====================================================================--> - <h2><a name="Contents">Contents</a></h2> - <!--=====================================================================--> - - <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><a href="#software">Software</a> - </ol> - - <li><a href="#starting">Getting Started with LLVM</a> - <ol> - <li><a href="#terminology">Terminology and Notation</tt></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="#installcf">Install the GCC 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="#objfiles">The Location of LLVM Object Files</tt></a> - </ol> - <li><a href="#layout">Program layout</a> - <ol> - <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="#runtime"><tt>llvm/runtime</tt></a> - <li><a href="#test"><tt>llvm/test</tt></a> - <li><a href="#tools"><tt>llvm/tools</tt></a> - <li><a href="#utils"><tt>llvm/utils</tt></a> - </ol> - <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> - - - <!--=====================================================================--> - <center> - <h2><a name="overview"><b>Overview</b></a></h2> - </center> - <hr> - <!--=====================================================================--> - - Welcome to LLVM! In order to get started, you first need to know some - basic information. +<head> + <title>Getting Started with LLVM System</title> + <link rel="stylesheet" href="llvm.css" type="text/css"> +</head> +<body> + +<div class="doc_title"> + Getting Started with the LLVM System +</div> + +<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><a href="#software">Software</a> + </ol></li> - <p> - 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 contains an assembler, disassembler, - bytecode analyzer, and bytecode optimizer. It also contains a test suite - that can be used to test the LLVM tools and the GCC front end. - <p> - The second piece is the GCC front end. This component provides a version - of GCC that compiles C and C++ code into LLVM bytecode. Currently, the - GCC 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 from the LLVM suite. - - <!--=====================================================================--> - <center> - <h2><a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a></h2> - </center> - <hr> - <!--=====================================================================--> - - Here's the short story for getting up and running quickly with LLVM: + <li><a href="#starting">Getting Started with LLVM</a> <ol> - <li>Install the GCC front end: - <ol> - <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> - <li><b>Sparc Only:</b><br> - <tt> - cd cfrontend/sparc<br> - ./fixheaders - </tt> - </ol> - - <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>cd llvm</tt> - </ol> - - <p> - - <li>With anonymous CVS access: - <ol> - <li><tt>cd <i>where-you-want-llvm-to-live</i></tt> - <li><tt>cvs -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt> - <li>Hit the return key when prompted for the password. - <li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co llvm</tt> - <li><tt>cd llvm</tt> - </ol> - </ul> - </ul> - - <p> - - <li>Configure the LLVM Build Environment - <ol> - <li>Change directory to where you want to store the LLVM object - files and run <tt>configure</tt> to configure the Makefiles and - header files for the default platform. - Useful options include: - <ul> - <li><tt>--with-llvmgccdir=<i>directory</i></tt> - <br> - Specify where the LLVM GCC frontend is installed. - <p> - - <li><tt>--enable-spec2000=<i>directory</i></tt> - <br> - Enable the SPEC2000 benchmarks for testing. The SPEC2000 - benchmarks should be available in <tt><i>directory</i></tt>. - </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 - # this is csh or tcsh syntax</tt> - </ol> - - <p> - - </ol> + <li><a href="#terminology">Terminology and Notation</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="#installcf">Install the GCC Front End</a> + <li><a href="#config">Local LLVM Configuration</a> + <li><a href="#compile">Compiling the LLVM Suite Source Code</a> + <li><a href="#objfiles">The Location of LLVM Object Files</a> + </ol></li> + + <li><a href="#layout">Program layout</a> + <ol> + <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="#runtime"><tt>llvm/runtime</tt></a> + <li><a href="#test"><tt>llvm/test</tt></a> + <li><a href="#tools"><tt>llvm/tools</tt></a> + <li><a href="#utils"><tt>llvm/utils</tt></a> + </ol></li> + + <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> + +<p>By: + <a href="mailto:gshi1@uiuc.edu">Guochun Shi</a>, + <a href="mailto:sabre@nondot.org">Chris Lattner</a>, + <a href="mailto:criswell@uiuc.edu">John Criswell</a>, + <a href="http://misha.brukman.net">Misha Brukman</a>, and + <a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a>.</p> + + +<!-- *********************************************************************** --> +<div class="doc_section"> + <a name="overview"><b>Overview</b></a> +</div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + +<p>Welcome to LLVM! In order to get started, you first need to know some +basic information.</p> + +<p>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 contains an assembler, disassembler, bytecode +analyzer, and bytecode optimizer. It also contains a test suite that can be +used to test the LLVM tools and the GCC front end.</p> + +<p>The second piece is the GCC front end. This component provides a version of +GCC that compiles C and C++ code into LLVM bytecode. Currently, the GCC 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 +from the LLVM suite.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"> + <a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a> +</div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + +<p>Here's the short story for getting up and running quickly with LLVM:</p> + +<ol> + <li>Install the GCC front end: + <ol> + <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> + <li><b>Sparc Only:</b><br> + <tt>cd cfrontend/sparc<br> + ./fixheaders</tt> + </ol></li> + + <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>cd llvm</tt> + </ol></li> - <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 GCC front end and LLVM tools. Go to - <a href="#layout">Program Layout</a> to learn about the layout of the - source code tree. - - <!--=====================================================================--> - <center> - <h2><a name="requirements"><b>Requirements</b></a></h2> - </center> - <hr> - <!--=====================================================================--> - - 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. - - <!--=====================================================================--> - <h3><a name="hardware"><b>Hardware</b></a></h3> - <!--=====================================================================--> - LLVM is known to work on the following platforms: + <li>With anonymous CVS access: + <ol> + <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li> + <li><tt>cvs -d + :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt></li> + <li>Hit the return key when prompted for the password. + <li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm + co llvm</tt></li> + <li><tt>cd llvm</tt></li> + </ol></li> + </ul></li> + + <li>Configure the LLVM Build Environment + <ol> + <li>Change directory to where you want to store the LLVM object + files and run <tt>configure</tt> to configure the Makefiles and + header files for the default platform. Useful options include: + <ul> + <li><tt>--with-llvmgccdir=<i>directory</i></tt> + <p>Specify where the LLVM GCC frontend is installed.</p></li> + <li><tt>--enable-spec2000=<i>directory</i></tt> + <p>Enable the SPEC2000 benchmarks for testing. The SPEC2000 + benchmarks should be available in + <tt><i>directory</i></tt>.</p></li> + </ul> + </ol></li> + + <li>Build the LLVM Suite: + <ol> + <li>Set your LLVM_LIB_SEARCH_PATH environment variable. + <li><tt>gmake -k |& tee gnumake.out + # this is csh or tcsh syntax</tt> + </ol> + +</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 GCC 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> + +<!-- *********************************************************************** --> +<div class="doc_section"> + <a name="requirements"><b>Requirements</b></a> +</div> +<!-- *********************************************************************** --> + +<div class="doc_text"> + +<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> + +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"> + <a name="hardware"><b>Hardware</b></a> +</div> + +<div class="doc_text"> + +<p>LLVM is known to work on the following platforms:</p> + +<ul> + + <li>Linux on x86 (Pentium and above) + <ul> + <li>Approximately 760 MB of Free Disk Space <ul> - <li> Linux on x86 (Pentium and above) - <ul> - <li> Approximately 760 MB of Free Disk Space - <ul> - <li>Source code: 30 MB - <li>Object code: 670 MB - <li>GCC front end: 60 MB - </ul> - </ul> - - <p> - - <li> Solaris on SparcV9 (Ultrasparc) - <ul> - <li> Approximately 1.24 GB of Free Disk Space - <ul> - <li>Source code: 30 MB - <li>Object code: 1000 MB - <li>GCC front end: 210 MB - </ul> - </ul> - </ul> - - 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 - bytecode. Code generation should work as well, although the generated - native code may not work on your platform. - <p> - The GCC front end is not very portable at the moment. If you want to get - it to work on another platform, you can download a copy of the source - and try to compile it on your platform. - </p> - - <!--=====================================================================--> - <h3><a name="software"><b>Software</b></a></h3> - <!--=====================================================================--> - <p> + <li>Source code: 30 MB</li> + <li>Object code: 670 MB</li> + <li>GCC front end: 60 MB</li> + </ul></li> + </ul></li> - Compiling LLVM requires that you have several software packages installed: + <li>Solaris on SparcV9 (Ultrasparc) + <ul> + <li>Approximately 1.24 GB of Free Disk Space + <ul> + <li>Source code: 30 MB</li> + <li>Object code: 1000 MB</li> + <li>GCC front end: 210 MB</li> + </ul></li> + </ul></li> - <ul compact> - <li> - <a href="http://gcc.gnu.org">GCC 3.x with C and C++ language support</a> +</ul> - <li> - <a href="http://savannah.gnu.org/projects/make">GNU Make</a> +<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 bytecode. Code +generation should work as well, although the generated native code may not work +on your platform.</p> - <li> - <a href="http://www.gnu.org/software/flex">Flex</a> +<p>The GCC front end is not very portable at the moment. If you want to get it +to work on another platform, you can download a copy of the source and try to +compile it on your platform.</p> - <li> - <a href="http://www.gnu.org/software/bison/bison.html">Bison</a> - </ul> +</div> - <p> - There are some additional tools that you may want to have when working with - LLVM: - </p> +<!-- ======================================================================= --> +<div class="doc_subsection"> + <a name="software"><b>Software</b></a> +</div> - <ul> - <li><A href="http://www.gnu.org/software/autoconf">GNU Autoconf</A> - <li><A href="http://savannah.gnu.org/projects/m4">GNU M4</A> - <p> - If you want to make changes to the configure scripts, you will need - GNU autoconf (2.57 or higher), and consequently, GNU M4 (version 1.4 - or higher). - </p> - - <li><A href="http://www.codesourcery.com/qm/qmtest">QMTest</A> - <li><A href="http://www.python.org">Python</A> - <p> - These are needed to use the LLVM test suite. - </ul> - - - <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. - A <a href="#starting">complete guide to installation</a> is provided in the - next section. - - <p>The later sections of this guide describe the <a - href="#layout">general layout</a> of the 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. - - <!--=====================================================================--> - <center> - <h2><a name="starting"><b>Getting Started with LLVM</b></a></h2> - </center> - <hr> - <!--=====================================================================--> - - <!-------------------------------------------------------------------------> - <h3><a name="terminology">Terminology and Notation</a></h3> - <!-------------------------------------------------------------------------> - - <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 compact> - <dt>SRC_ROOT - <dd> - This is the top level directory of the LLVM source tree. - <p> - - <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). - <p> - - <dt>LLVMGCCDIR - <dd> - This is the where the LLVM GCC Front End is installed. - <p> - For the pre-built GCC front end binaries, the LLVMGCCDIR is - <tt>cfrontend/<i>platform</i>/llvm-gcc</tt>. - </dl> - - <!-------------------------------------------------------------------------> - <h3><a name="environment">Setting Up Your Environment</a></h3> - <!-------------------------------------------------------------------------> +<div class="doc_text"> - <p> - In order to compile and use LLVM, you will need to set some environment - variables. There are also some shell aliases which you may find useful. - You can set these on the command line, or better yet, set them in your - <tt>.cshrc</tt> or <tt>.profile</tt>. - - <dl compact> - <dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt><i>LLVMGCCDIR</i>/bytecode-libs</tt> - <dd> - This environment variable helps the LLVM GCC front end find bytecode - libraries that it will need for compilation. - <p> - - <dt>alias llvmgcc <i>LLVMGCCDIR</i><tt>/bin/gcc</tt> - <dt>alias llvmg++ <i>LLVMGCCDIR</i><tt>/bin/g++</tt> - <dd> - This alias allows you to use the LLVM C and C++ front ends without putting - them in your <tt>PATH</tt> or typing in their complete pathnames. - </dl> - - <!-------------------------------------------------------------------------> - <h3><a name="unpack">Unpacking the LLVM Archives</a></h3> - <!-------------------------------------------------------------------------> +<p>Compiling LLVM requires that you have several software packages +installed:</p> - <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 three files. Each - file is a TAR archive that is compressed with the gzip program. - </p> - - <p> The three files are as follows: - <dl compact> - <dt>llvm.tar.gz - <dd>This is the source code to the LLVM suite. - <p> - - <dt>cfrontend.sparc.tar.gz - <dd>This is the binary release of the GCC front end for Solaris/Sparc. - <p> - - <dt>cfrontend.x86.tar.gz - <dd>This is the binary release of the GCC front end for Linux/x86. - </dl> - - <!-------------------------------------------------------------------------> - <h3><a name="checkout">Checkout LLVM from CVS</a></h3> - <!-------------------------------------------------------------------------> - - <p>If you have access to our CVS repository, you can get a fresh copy of - the entire source code. All you need to do is check it out from CVS as - follows: - <ul> - <li><tt>cd <i>where-you-want-llvm-to-live</i></tt> - <li><tt>cvs -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt> - <li>Hit the return key when prompted for the password. - <li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co llvm</tt> - </ul> +<ul> + <li><a href="http://gcc.gnu.org">GCC 3.x with C and C++ language + support</a></li> - <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> + <li><a href="http://savannah.gnu.org/projects/make">GNU Make</a></li> - <p> - Note that the GCC front end is not included in the CVS repository. You - should have downloaded the binary distribution for your platform. - </p> + <li><a href="http://www.gnu.org/software/flex">Flex</a></li> - <!-------------------------------------------------------------------------> - <h3><a name="installcf">Install the GCC Front End</a></h3> - <!-------------------------------------------------------------------------> + <li><a href="http://www.gnu.org/software/bison/bison.html">Bison</a></li> +</ul> - <p> - Before configuring and compiling the LLVM suite, you need to extract the - LLVM GCC front end from the binary distribution. It is used for building - the - bytecode libraries later used by the GCC front end for linking programs, and - its location must be specified when the LLVM suite is configured. - </p> +<p>There are some additional tools that you may want to have when working with +LLVM:</p> - <p> - To install the GCC 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> +<ul> + <li><A href="http://www.gnu.org/software/autoconf">GNU Autoconf</A> + <li><A href="http://savannah.gnu.org/projects/m4">GNU M4</A> - If you are on a Sparc/Solaris machine, you will need to fix the header - files: + <p>If you want to make changes to the configure scripts, you will need GNU + autoconf (2.57 or higher), and consequently, GNU M4 (version 1.4 or + higher).</p></li> - <p> + <li><A href="http://www.codesourcery.com/qm/qmtest">QMTest</A></li> + <li><A href="http://www.python.org">Python</A> - <tt> - cd cfrontend/sparc - <br> - ./fixheaders - </tt> + <p>These are needed to use the LLVM test suite.</p></li> - <p> - The binary versions of the GCC front end may not suit all of your needs. - For example, the binary distribution may include an old version of a system - header file, not "fix" a header file that needs to be fixed for GCC, or it - may be linked with libraries not available on your system. - </p> +</ul> - <p> - In cases like these, you may want to try - <a href="CFEBuildInstrs.html">building the GCC front end from source.</a> - This is not for the faint of heart, so be forewarned. - </p> - <!-------------------------------------------------------------------------> - <h3><a name="config">Local LLVM Configuration</a></h3> - <!-------------------------------------------------------------------------> - - <p>Once checked out from the CVS repository, the LLVM suite source code - must be configured via the <tt>configure</tt> script. This script sets - variables in <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 build LLVM. - <p> - The following environment variables are used by the <tt>configure</tt> - script to configure the build system: - </p> - - <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 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 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. +A <a href="#starting">complete guide to installation</a> is provided in the +next section.</p> + +<p>The later sections of this guide describe the <a +href="#layout">general layout</a> of the 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> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"> + <a name="starting"><b>Getting Started with LLVM</b></a> +</div> +<!-- *********************************************************************** --> + +<!-- ======================================================================= --> +<div class="doc_subsection"> + <a name="terminology">Terminology and Notation</a> +</div> +<div class="doc_text"> + +<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 compact> + <dt>SRC_ROOT + <dd> + This is the top level directory of the LLVM source tree. <p> - The following options can be used to set or enable LLVM specific options: - </p> - <dl compact> - <dt><i>--with-llvmgccdir=LLVMGCCDIR</i> + <dt>OBJ_ROOT <dd> - Path to the location where the LLVM C front end binaries and - associated libraries will be installed. - <p> - <dt><i>--enable-optimized</i> + 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). + <p> + + <dt>LLVMGCCDIR <dd> - Enables optimized compilation by default (debugging symbols are removed - and GCC optimization flags are enabled). The default is to use an - unoptimized build (also known as a debug build). - <p> - <dt><i>--enable-jit</i> + This is the where the LLVM GCC Front End is installed. + <p> + For the pre-built GCC front end binaries, the LLVMGCCDIR is + <tt>cfrontend/<i>platform</i>/llvm-gcc</tt>. +</dl> + +</div> + +<!-- ======================================================================= --> +<div class="doc_subsection"> + <a name="environment">Setting Up Your Environment</a> +</div> + +<div class="doc_text"> + +<p> +In order to compile and use LLVM, you will need to set some environment +variables. There are also some shell aliases which you may find useful. +You can set these on the command line, or better yet, set them in your +<tt>.cshrc</tt> or <tt>.profile</tt>. + +<dl compact> + <dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt><i>LLVMGCCDIR</i>/bytecode-libs</tt> <dd> - Compile the Just In Time (JIT) 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. - <p> - <dt><i>--enable-spec2000</i> - <dt><i>--enable-spec2000=<<tt>directory</tt>></i> + This environment variable helps the LLVM GCC front end find bytecode + libraries that it will need for compilation. + <p> + + <dt>alias llvmgcc <i>LLVMGCCDIR</i><tt>/bin/gcc</tt> + <dt>alias llvmg++ <i>LLVMGCCDIR</i><tt>/bin/g++</tt> <dd> - Enable the use of SPEC2000 when testing LLVM. This is disabled by default - (unless <tt>configure</tt> finds SPEC2000 installed). By specifying - <tt>directory</tt>, you can tell configure where to find the SPEC2000 - benchmarks. If <tt>directory</tt> is left unspecified, <tt>configure</tt> - uses the default value - <tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>. - </dl> + This alias allows you to use the LLVM C and C++ front ends without putting + them in your <tt>PATH</tt> or typing in their complete pathnames. +</dl> - <p> - To configure LLVM, follow these steps: - <ol> - <li>Change directory into the object root directory: - <br> - <tt>cd <i>OBJ_ROOT</i></tt> - <p> - - <li>Run the <tt>configure</tt> script located in the LLVM source tree: - <br> - <tt><i>SRC_ROOT</i>/configure</tt> - <p> - </ol> - </p> - - In addition to running <tt>configure</tt>, you must set the - <tt>LLVM_LIB_SEARCH_PATH</tt> environment variable in your startup scripts. - This environment variable is used to locate "system" libraries like - "<tt>-lc</tt>" and "<tt>-lm</tt>" when linking. This variable should be set - to the absolute path for the bytecode-libs subdirectory of the GCC front end - install, or <i>LLVMGCCDIR</i>/bytecode-libs. For example, one might - set <tt>LLVM_LIB_SEARCH_PATH</tt> to - <tt>/home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs</tt> for the X86 - version of the GCC front end on our research machines.<p> - - <!-------------------------------------------------------------------------> - <h3><a name="compile">Compiling the LLVM Suite Source Code</a></h3> - <!-------------------------------------------------------------------------> - - Once you have configured LLVM, you can build it. There are three types of - builds: - - <dl compact> - <dt>Debug Builds - <dd> - These builds are the default when one 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. - <p> - - <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. - <p> - - <d |