X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FGettingStarted.html;h=0a6a4811880ebc2145514e8abb955d3e9807cd7f;hb=4b1fd0b288ae38d288affdbd9159d838b1a68447;hp=8bb1ac41e4fd443959a017d6f4532ce00b7676f2;hpb=e2c3a49c8029ebd9ef530101cc24c66562e3dff5;p=oota-llvm.git diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 8bb1ac41e4f..0a6a4811880 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -8,9 +8,9 @@ -
+

Getting Started with the LLVM System -

+ @@ -162,7 +164,7 @@ and performance.

Optionally, specify for directory the full pathname of the C/C++ front end installation to use with this LLVM configuration. If not specified, the PATH will be searched. This is only needed if you - want to run the testsuite or do some special kinds of LLVM builds.

+ want to run test-suite or do some special kinds of LLVM builds.

  • --enable-spec2000=directory

    Enable the SPEC2000 benchmarks for testing. The SPEC2000 benchmarks should be available in @@ -189,25 +191,23 @@ Layout to learn about the layout of the source code tree.

    -
    - Requirements -
    +

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

    @@ -242,6 +242,11 @@ software you will need.

    x861 GCC + + FreeBSD + amd64 + GCC + MacOS X2 PowerPC @@ -261,7 +266,8 @@ software you will need.

    MinGW/Win32 x861,6, - 8, 10 + 8, 10, + 11 GCC 3.4.X, binutils 2.20 @@ -304,6 +310,11 @@ software you will need.

    Itanium (IA-64) HP aCC + + Windows x64 + x86-64 + mingw-w64's GCC-4.5.x12 +

    Notes:

    @@ -330,9 +341,10 @@ up
  • before any Windows-based versions such as Strawberry Perl and ActivePerl, as these have Windows-specifics that will cause the build to fail. -
  • In general, LLVM modules requiring dynamic linking can - not be built on Windows. However, you can build LLVM tools using - "make tools-only".
  • +
  • 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.
  • @@ -356,8 +368,10 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

    -
    Software
    -
    +

    + 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 @@ -373,13 +387,13 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

    - GCC + GCC 3.4.2 C/C++ compiler1 - TeXinfo + TeXinfo 4.5 For building the CFE @@ -390,6 +404,11 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

    Subversion access to LLVM2 + + DejaGnu 1.4.2 @@ -421,13 +440,13 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

    - GNU Autoconf + GNU Autoconf 2.60 Configuration script builder4 - GNU Automake + GNU Automake 1.9.6 aclocal macro generator4 @@ -452,8 +471,8 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

  • 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.59), and consequently, GNU M4 (version 1.4 - or higher). You will also need automake (1.9.2). We only use aclocal + 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.
  • @@ -489,17 +508,16 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.

    -
    +

    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 3.3.3, 3.4.0, and Apple 4.0.1 -successfully with them (however, see important notes below). Other versions -of GCC will probably work as well. GCC versions listed +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 @@ -564,6 +582,9 @@ as the previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).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.

    +

    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 @@ -583,15 +604,15 @@ 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.

    @@ -601,14 +622,13 @@ href="#layout">general layout of the 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 @@ -641,11 +661,11 @@ All these paths are absolute:

    - + -
    +

    In order to compile and use LLVM, you may need to set some environment @@ -664,11 +684,11 @@ variables.

    - + -
    +

    If you have the LLVM distribution, you will need to unpack it before you @@ -684,7 +704,7 @@ compressed with the gzip program.

    Source release for the LLVM libraries and tools.
    llvm-test-x.y.tar.gz
    -
    Source release for the LLVM test suite.
    +
    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 @@ -698,11 +718,11 @@ compressed with the gzip program.
    - + -
    +

    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 @@ -726,6 +746,9 @@ revision), you can checkout it from the 'tags' directory (instead of subdirectories of the 'tags' directory:

      +
    • 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
    • @@ -751,7 +774,7 @@ you get it from the Subversion repository:

       % cd llvm/projects
      -% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
      +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
       
      @@ -766,20 +789,181 @@ instructions to successfully get and build the LLVM GCC front-end.

    -
    - Install the GCC Front End +

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

    + +
    +git clone http://llvm.org/git/llvm.git
    +
    + +

    If you want to check out clang too, run:

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

    + +
    +git config branch.master.rebase true
    +
    + +

    Sending patches with Git

    +
    +

    +Please read Developer Policy, 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: +

    + +
    +git diff --check master..mybranch
    +
    + +

    +The easiest way to generate a patch is as below: +

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

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

    + +
    +git format-patch --attach master..mybranch --stdout | git imap-send
    +
    + +

    +Then, your .git/config should have [imap] sections. +

    + +
    +[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]/&Tgtm+DBN-"
    +; example for Traditional Chinese
    +        folder = "[Gmail]/&g0l6Pw-"
    +
    +
    -
    +

    For developers to work with git-svn

    +
    + +

    To set up clone from which you can submit code using + git-svn, run:

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

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

    + +
    +rm -rf .git/svn
    +git svn rebase -l
    +
    + +
    + +
    + + +

    + Install the GCC Front End +

    + +

    Before configuring and compiling the LLVM suite (or if you want to use just the LLVM GCC front end) you can optionally extract the front end from the binary distribution. -It is used for running the llvm-test testsuite and for compiling C/C++ programs. Note that +It is used for running the LLVM test-suite and for compiling C/C++ programs. Note that you can optionally build llvm-gcc yourself after building the main LLVM repository.

    To install the GCC front end, do the following (on Windows, use an archival tool -like 7-zip that understands gzipped tars):

    +like 7-zip that understands gzipped tars):

    1. cd where-you-want-the-front-end-to-live
    2. @@ -795,9 +979,9 @@ to your PATH environment variable. For example, if you uncompressed th

      If you now want to build LLVM from source, when you configure LLVM, it will automatically detect llvm-gcc's presence (if it is in your path) enabling its -use in llvm-test. Note that you can always build or install llvm-gcc at any +use in test-suite. Note that you can always build or install llvm-gcc at any point after building the main LLVM repository: just reconfigure llvm and -llvm-test will pick it up. +test-suite will pick it up.

      As a convenience for Windows users, the front end binaries for MinGW/x86 include @@ -836,11 +1020,11 @@ please let us know how you would like to see things improved by dropping us a no

    - + -
    +

    Once checked out from the Subversion repository, the LLVM suite source code must be @@ -958,11 +1142,11 @@ script to configure the build system:

    - + -
    +

    Once you have configured LLVM, you can build it. There are three types of builds:

    @@ -1092,11 +1276,11 @@ that directory that is out of date.

    - + -
    +

    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 @@ -1110,11 +1294,11 @@ that directory that is out of date.

    - + -
    +

    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 @@ -1137,13 +1321,13 @@ platforms or configurations using the same source tree.

    named after the build type:

    -
    Debug Builds +
    Debug Builds with assertions enabled (the default)
    Tools -
    OBJ_ROOT/Debug/bin +
    OBJ_ROOT/Debug+Asserts/bin
    Libraries -
    OBJ_ROOT/Debug/lib +
    OBJ_ROOT/Debug+Asserts/lib


    @@ -1170,11 +1354,11 @@ named after the build type:

    - + -
    +

    If you're running on a Linux system that supports the " This allows you to execute LLVM bitcode files directly. On Debian, you -can also use this command instead of the 'echo' command above:

    +can also use this command instead of the 'echo' command above:

    @@ -1205,31 +1389,37 @@ $ sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
    - -
    + + +

    + Program Layout +

    -
    +

    One useful source of information about the LLVM source base is the LLVM doxygen documentation available at doxygen 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:

    @@ -1256,8 +1446,11 @@ library. The three main subdirectories of this directory are:

    - -
    +

    + 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 @@ -1296,6 +1489,10 @@ different tools.

    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 @@ -1306,19 +1503,19 @@ different tools.

    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/Support/.
    - -
    llvm/lib/System/
    -
    This directory contains the operating system abstraction layer that - shields LLVM from platform-specific coding.
    +
    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 @@ -1326,8 +1523,11 @@ different tools.

    - -
    +

    + llvm/runtime +

    + +

    This directory contains libraries which are compiled into LLVM bitcode and used when linking programs with the GCC front end. Most of these libraries are @@ -1340,16 +1540,22 @@ 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). @@ -1364,8 +1570,11 @@ end to compile.

    - -
    +

    + 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 @@ -1383,16 +1592,6 @@ information is in the Command Guide.

    href="HowToSubmitABug.html">HowToSubmitABug.html for more information on using bugpoint. -
    llvmc
    -
    The LLVM Compiler Driver. This program can - be configured to utilize both LLVM and non-LLVM compilation tools to enable - pre-processing, translation, optimization, assembly, and linking of programs - all from one command line. llvmc also takes care of processing the - dependent libraries found in bitcode. This reduces the need to get the - traditional -l<name> options right on the command line. Please - note that this tool, while functional, is still experimental and not feature - complete.
    -
    llvm-ar
    The archiver produces an archive containing the given LLVM bitcode files, optionally with an index for faster @@ -1408,9 +1607,9 @@ information is in the Command Guide.

    llvm-ld
    llvm-ld is a general purpose and extensible linker for LLVM. - This is the linker invoked by llvmc. It performsn standard link time - optimizations and allows optimization modules to be loaded and run so that - language specific optimizations can be applied at link time.
    + It performs standard link time optimizations and allows optimization + modules to be loaded and run so that language specific optimizations can + be applied at link time.
    llvm-link
    llvm-link, not surprisingly, links multiple LLVM modules into @@ -1449,8 +1648,11 @@ information is in the Command Guide.

    - -
    +

    + 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 @@ -1511,22 +1713,15 @@ are code generators for parts of LLVM infrastructure.

    - - -
    -

    This directory contains build scripts and project files for use with - Visual C++. This allows developers on Windows to build LLVM without the need - for Cygwin. The contents of this directory should be considered experimental - at this time. -

    + - + -
    +

    This section gives an example of using LLVM. llvm-gcc3 is now obsolete, so we only include instructions for llvm-gcc4.

    @@ -1537,12 +1732,13 @@ create bitcode by default: gcc4 produces native code. As the example belo the '--emit-llvm' flag is needed to produce LLVM bitcode output. For makefiles and configure scripts, the CFLAGS variable needs '--emit-llvm' to produce bitcode output.

    -
    - +

    + Example with llvm-gcc4 +

    -
    +
    1. First, create a simple C file, name it 'hello.c':

      @@ -1623,14 +1819,15 @@ int main() {
    +
    - + -
    +

    If you are having problems building or using LLVM, or if you have any other general questions about LLVM, please consult the Frequently @@ -1639,12 +1836,12 @@ Asked Questions page.

    -
    +

    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 @@ -1672,7 +1869,7 @@ out:

    Chris Lattner
    Reid Spencer
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$