From 20d2d3e67ff5cc49c24f0892a41468aa8d1ee451 Mon Sep 17 00:00:00 2001 From: John Criswell Date: Fri, 10 Oct 2003 14:26:14 +0000 Subject: [PATCH] Re-did some of the text wrapping (sorry). Made the "Getting Started Quickly" material its own section. I think this makes the document easier to read. Added bars after every major section heading (to distinguish them more easily from sub-section headings). Renamed C front end to GCC front end, as we now support C and C++. Updated material to reflect the new autoconf-style object root. Added material about the llvm/runtime directory and the fact that you need to install the GCC front end before building LLVM (before, it was optional). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9003 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/GettingStarted.html | 310 +++++++++++++++++++++------------------ 1 file changed, 167 insertions(+), 143 deletions(-) diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 0f77b2275d1..903d73560d1 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -26,9 +26,9 @@
  • Software +
  • Getting Started Quickly (A Summary)
  • Getting started with LLVM
      -
    1. Getting Started Quickly (A Summary)
    2. Terminology and Notation
    3. Setting Up Your Environment
    4. Unpacking the LLVM Archives @@ -47,7 +47,7 @@
    5. llvm/tools
    6. llvm/utils
    -
  • Compiling the LLVM C Front End +
  • Compiling the LLVM GCC Front End
  • An Example Using the LLVM Tool Chain
  • Common Problems
  • Links @@ -58,6 +58,7 @@

    Overview

    +
    Welcome to LLVM! In order to get started, you first need to know some @@ -67,13 +68,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 C front end. + to test the LLVM tools and the GCC front end.

    - 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 from the LLVM suite. + 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.

    Requirements

    @@ -94,7 +95,7 @@ @@ -106,13 +107,13 @@

    - If you want to compile your own version of the C front end, you will need + If you want to compile your own version of the GCC front end, you will need additional disk space:

    @@ -210,11 +211,11 @@ -

    The next section 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 first subsection gives - a short summary for those who are already familiar with the system and - want to get started as quickly as possible. +

    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 next section gives a short summary for those + who are already familiar with the system and want to get started as quickly + as possible. A more complete description is provided after that.

    The later sections of this guide describe the general layout of the the LLVM source-tree, a

    -

    Getting Started with LLVM

    +

    Getting Started Quickly (A Summary)

    - - - -

    Getting Started Quickly (A Summary)

    +
    Here's the short story for getting up and running quickly with LLVM:
      -
    1. Install the C front end: +
    2. Install the GCC front end:
      1. cd where-you-want-the-C-front-end-to-live
      2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf @@ -249,8 +247,6 @@
        1. cd where-you-want-llvm-to-live
        2. gunzip --stdout llvm.tar.gz | tar -xvf - -
        3. gunzip --stdout cfrontend.platform.tar.gz | tar - -xvf -
        4. cd llvm
        @@ -271,18 +267,14 @@
      3. Configure the LLVM Build Environment
          -
        1. Run configure to configure the Makefiles and header - files for the default platform. +
        2. Change directory to where you want to store the LLVM object + files and run configure to configure the Makefiles and + header files for the default platform. Useful options include:
            -
          • --with-objroot=directory -
            - Specify where object files should be placed during the - build. -
          • --with-llvmgccdir=directory
            - Specify where the LLVM C frontend is going to be installed. + Specify where the LLVM GCC frontend is installed.
        @@ -301,12 +293,19 @@

        See Setting Up Your Environment 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, + next section for other useful details in working with LLVM, or go straight to Program Layout to learn about the - layout of the source code tree. For information on building the C front - end yourself, see Compiling the LLVM C Front End for + layout of the source code tree. For information on building the GCC front + end yourself, see Compiling the LLVM GCC Front End for information. + +

        +

        Getting Started with LLVM

        +
        +
        + +

        Terminology and Notation

        @@ -325,33 +324,36 @@ give you this path.

        +

        SRC_ROOT +
        + This is the top level directory of the LLVM source tree. +

        +

        OBJ_ROOT
        - This is the top level directory for where the LLVM suite object files - will be placed during the build. + 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).

        LLVMGCCDIR
        - This is the pathname to the location where the LLVM C Front End will - be installed. Note that the C front end does not need to be installed - during the LLVM suite build; you will just need to know where it will - go for configuring the build system and running the test suite later. + This is the where the LLVM GCC Front End is installed.

        - For the pre-built C front end binaries, the LLVMGCCDIR is + For the pre-built GCC front end binaries, the LLVMGCCDIR is the cfrontend/platform/llvm-gcc.

        GCCSRC
        - This is the pathname of the directory where the LLVM C front end source - code can be found. + This is the location of the LLVM GCC front end source code (used + only if the LLVM GCC front end is being compiled).

        GCCOBJ
        - This is the pathname of the directory where the LLVM C front end object - code will be placed during the build. It can be safely removed once - the build is complete. + This is the location of the LLVM GCC front end object code (used + only if the LLVM GCC front end is being compiled). It can be + safely removed once the LLVM GCC front end is built and installed. @@ -367,14 +369,15 @@
        LLVM_LIB_SEARCH_PATH=LLVMGCCDIR/llvm-gcc/bytecode-libs
        - This environment variable helps the LLVM C front end find bytecode + This environment variable helps the LLVM GCC front end find bytecode libraries that it will need for compilation.

        alias llvmgcc LLVMGCCDIR/bin/llvm-gcc +
        alias llvmg++ LLVMGCCDIR/bin/llvm-g++
        - This alias allows you to use the LLVM C front end without putting it in - your PATH or typing in its complete pathname. + This alias allows you to use the LLVM C and C++ front ends without putting + them in your PATH or typing in their complete pathnames.
        @@ -394,15 +397,15 @@

        cfrontend.sparc.tar.gz -
        This is the binary release of the C front end for Solaris/Sparc. +
        This is the binary release of the GCC front end for Solaris/Sparc.

        cfrontend.x86.tar.gz -
        This is the binary release of the C front end for Linux/x86. +
        This is the binary release of the GCC front end for Linux/x86.

        cfrontend-src.tar.gz -
        This is the source code release of the C front end. +
        This is the source code release of the GCC front end.

        @@ -423,24 +426,24 @@ test directories, and local copies of documentation files.

        - Note that the C front end is not included in the CVS repository. You + Note that the GCC front end is not included in the CVS repository. You should have either downloaded the source, or better yet, downloaded the binary distribution for your platform.

        -

        Install the C Front End

        +

        Install the GCC Front End

        - 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 - configure script before the LLVM suite can be built. + 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.

        - To install the C front end, do the following: + To install the GCC front end, do the following:

        1. cd where-you-want-the-front-end-to-live
        2. gunzip --stdout cfrontend.platform.tar.gz | tar -xvf @@ -454,7 +457,8 @@

          Once checked out from the CVS repository, the LLVM suite source code must be configured via the configure script. This script sets variables in llvm/Makefile.config and - llvm/include/Config/config.h. + llvm/include/Config/config.h. It also populates OBJ_ROOT with + the Makefiles needed to build LLVM.

          The following environment variables are used by the configure @@ -495,26 +499,6 @@

          -
          --with-objroot=OBJ_ROOT -
          - Path to the directory where - object files, libraries, and executables should be placed. - If this is set to ., then the object files will be placed - within the source code tree. If left unspecified, the default value is - the following: -
            -
          • - If the USER environment variable is specified and the directory - /localhome/$USER exists, then the default value is - /localhome/$USER. - -
          • - Otherwise, the default value is .. -
          - (See the Section on - The Location of LLVM Object Files - for more information.) -

          --with-llvmgccdir=LLVMGCCDIR
          Path to the location where the LLVM C front end binaries and @@ -522,22 +506,47 @@

          --enable-optimized
          - Enables optimized compilation (debugging symbols are removed and GCC - optimization flags are enabled). The default is to use an unoptimized - build (also known as a debug build). + Enables optimized compilation by defaulat (debugging symbols are removed + and GCC optimization flags are enabled). The default is to use an + unoptimized build (also known as a debug build).

          --enable-jit
          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. +

          +

          --enable-spec2000 +
          --enable-spec2000=<directory> +
          + Enable the use of SPEC2000 when testing LLVM. This is disabled by default + (unless configure find SPEC2000 installed). By specifying + directory, you can tell configure where to find the SPEC2000 + benchmarks. If directory is left unspecified, it + configure uses a default value for our internal + installation of SPEC2000.
          +

          + To configure LLVM, follow these steps: +

            +
          1. Change directory into the object root directory: +
            + cd OBJ_ROOT +

            + +

          2. Run the script located in the LLVM source tree: +
            + SRC_ROOT/configure +

            +

          +

          + In addition to running configure, you must set the LLVM_LIB_SEARCH_PATH environment variable in your startup scripts. This environment variable is used to locate "system" libraries like "-lc" and "-lm" when linking. This variable should be set - to the absolute path for the bytecode-libs subdirectory of the C front-end + to the absolute path for the bytecode-libs subdirectory of the GCC front end install, or LLVMGCCDIR/llvm-gcc/bytecode-libs. For example, one might set LLVM_LIB_SEARCH_PATH to /home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs for the X86 @@ -553,14 +562,16 @@
          Debug Builds
          - These builds are the default. They compile the tools and libraries - with debugging information. + These builds are the default when one types gmake (unless the + --enable-optimized option was used during configuration). They + compile the tools and libraries with debugging information.

          Release (Optimized) Builds
          These builds are enabled with the --enable-optimized option to - configure. They compile the tools and libraries with GCC + configure or by specifying ENABLE_OPTIMIZED=1 on the + gmake command line. They compile the tools and libraries with GCC optimizer flags on and strip debugging information from the libraries and executables it generates.

          @@ -569,12 +580,12 @@

          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 setting variables on the - gmake command line. + 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 top level - llvm directory and issuing the following command: + Once you have LLVM configured, you can build it by entering the OBJ_ROOT + directory and issuing the following command:

          gmake @@ -588,7 +599,7 @@ gmake -j2

          - There are several other targets which are useful when working with the LLVM + There are several special targets which are useful when working with the LLVM source code:

          @@ -604,6 +615,16 @@ files generated by configure. It attempts to return the source tree to the original state in which it was shipped.

          + +

          gmake install +
          + Installs LLVM files into the proper location. For the most part, + this does nothing, but it does install bytecode libraries into the + GCC front end's bytecode library directory. If you need to update + your bytecode libraries, this is the target to use once you've built + them. +

          +

          It is also possible to override default values from configure by @@ -626,47 +647,30 @@

          - Every directory in the LLVM source tree includes a Makefile to + 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 source tree and typing gmake should rebuild + inside the LLVM object tree and typing gmake should rebuild anything in or below that directory that is out of date.

          The Location of LLVM Object Files

          -

          The LLVM build system sends most output files generated during the build - into the directory defined by the variable OBJ_ROOT in - llvm/Makefile.config, which is set by the --with-objroot - option in configure. This can be either just your normal LLVM - source tree or some other directory writable by you. You may wish to put - object files on a different filesystem either to keep them from being backed - up or to speed up local builds. -

          - If OBJ_ROOT is specified, then the build system will create a - directory tree underneath it that resembles the source code's pathname - relative to your home directory (unless OBJ_ROOT is set to - ., in which case object files are placed within the LLVM source - tree). -

          - + 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.

          - Note that - --with-objroot=. - and - --with-objroot=`pwd` - are not the same thing. The former will simply place object files within - the source tree, while the latter will set the location of object files - using the source tree's relative path from the home directory. -

          + This is accomplished in the typical autoconf manner: +
            +
          • Change directory to where the LLVM object files should live: +

            + cd OBJ_ROOT -

            - For example, suppose that OBJ_ROOT is set to /tmp and the - LLVM suite source code is located in /usr/home/joe/src/llvm, where - /usr/home/joe is the home directory of a user named Joe. Then, - the object files will be placed in /tmp/src/llvm. -

            +
          • Run the configure script found in the LLVM source directory: +

            + SRC_ROOT/configure +

          The LLVM build will place files underneath OBJ_ROOT in directories @@ -678,9 +682,9 @@

          Tools -
          OBJ_ROOT/llvm/tools/Debug +
          OBJ_ROOT/tools/Debug
          Libraries -
          OBJ_ROOT/llvm/lib/Debug +
          OBJ_ROOT/lib/Debug

          @@ -688,9 +692,9 @@

          Tools -
          OBJ_ROOT/llvm/tools/Release +
          OBJ_ROOT/tools/Release
          Libraries -
          OBJ_ROOT/llvm/lib/Release +
          OBJ_ROOT/lib/Release

          @@ -698,9 +702,9 @@

          Tools -
          OBJ_ROOT/llvm/tools/Profile +
          OBJ_ROOT/tools/Profile
          Libraries -
          OBJ_ROOT/llvm/lib/Profile +
          OBJ_ROOT/lib/Profile
          @@ -708,13 +712,15 @@

          Program Layout

          +
          -

          One useful source of information about the LLVM source base is the LLVM + One useful source of information about the LLVM source base is the LLVM doxygen documentation, available at http://llvm.cs.uiuc.edu/doxygen/. The - following is a brief introduction to code layout:

          - + href="http://llvm.cs.uiuc.edu/doxygen/">http://llvm.cs.uiuc.edu/doxygen/
          . + The following is a brief introduction to code layout: +

          CVS directories

          @@ -735,7 +741,7 @@
        3. 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, - Reoptimizer, Target, Transforms, etc... + Target, Transforms, etc...
        4. llvm/include/Support - This directory contains generic support libraries that are independent of LLVM, but are used by LLVM. @@ -790,20 +796,34 @@ of the code generator: Instruction Selector, Instruction Scheduling, and Register Allocation. -
          llvm/lib/Reoptimizer/
          This directory holds code related - to the runtime reoptimizer framework that is currently under development. -
          llvm/lib/Support/
          This directory contains the source code that corresponds to the header files located in llvm/include/Support/. + +

          llvm/runtime

          + + +

          + This directory contains libraries which are compiled into LLVM bytecode and + used when linking programs with the GCC 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 regression tests and source code that is used to - test the LLVM infrastructure...

          + test the LLVM infrastructure. +

          llvm/tools

          @@ -960,20 +980,21 @@ -

          Compiling the LLVM C Front End

          +

          Compiling the LLVM GCC Front End

          +

          - This step is optional if you have the C front end binary distribution for + This step is optional if you have the GCC front end binary distribution for your platform.

          - Now that you have the LLVM suite built, you can build the C front end. For + Now that you have the LLVM suite built, you can build the GCC front end. For those of you that have built GCC before, the process is very similar.

          - Be forewarned, though: the build system for the C front end is not as + Be forewarned, though: the build system for the GCC 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: @@ -1018,6 +1039,7 @@

          An Example Using the LLVM Tool Chain

          +
            @@ -1074,6 +1096,7 @@

            Common Problems

            +
            Below are common problems and their remedies: @@ -1139,6 +1162,7 @@

            Links

            +

            This document is just an introduction to how to use LLVM to do