X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FGettingStarted.html;h=06a9a60f355b6f690cdce540defe791cdd88ef3e;hb=35b887096159b96e732ed61dce7478407cce3d93;hp=5dd39c223053a4588a9684008a93a0ac219db93e;hpb=b357f0484b109895a0e51055dcda4dc28f77f00e;p=oota-llvm.git diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 5dd39c22305..06a9a60f355 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -8,9 +8,9 @@
-Written by: John Criswell, Chris Lattner, - Misha Brukman, + Misha Brukman, Vikram Adve, and Guochun Shi.
@@ -70,21 +70,21 @@ -Welcome to LLVM! In order to get started, you first need to know some basic information.
-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, bitcode -analyzer and bitcode optimizer. It also contains a test suite that can be -used to test the LLVM tools and the GCC front end.
+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 GCC front end.
The second piece is the GCC front end. This component provides a version of GCC that compiles C and C++ code into LLVM bitcode. Currently, the GCC front @@ -93,7 +93,7 @@ compiled into LLVM bitcode, a program can be manipulated with the LLVM tools from the LLVM suite.
-There is a third, optional piece called llvm-test. It is a suite of programs +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.
@@ -101,12 +101,12 @@ and performance.Here's the short story for getting up and running quickly with LLVM:
@@ -114,13 +114,15 @@ 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.
Enable the SPEC2000 benchmarks for testing. The SPEC2000 benchmarks should be available in @@ -186,25 +190,23 @@ Layout to learn about the layout of the source code tree.
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.
-LLVM is known to work on the following platforms:
@@ -214,11 +216,21 @@ software you will need.Notes:
@@ -309,26 +328,31 @@ upNote 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 disable them individually in llvm/tools/Makefile. The Release -build requires considerably less space.
+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 @@ -343,8 +367,10 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.
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 @@ -360,13 +386,13 @@ href="GCCFEBuildInstrs.html">try to compile it on your platform.
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 @@ -544,7 +574,16 @@ 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 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.
+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 @@ -564,15 +603,15 @@ upgrading to a newer version of Gold.
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.
@@ -582,14 +621,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. -Throughout this manual, the following names are used to denote paths specific to the local system and working environment. These are not @@ -622,11 +660,11 @@ All these paths are absolute:
In order to compile and use LLVM, you may need to set some environment @@ -645,11 +683,11 @@ variables.
If you have the LLVM distribution, you will need to unpack it before you @@ -665,7 +703,7 @@ 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 Subvresion as +the entire source code. All you need to do is check it out from Subversion as follows:
% 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
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 ++ +
+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-" ++ +
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 ++
Before configuring and compiling the LLVM suite, you can optionally extract the -LLVM GCC front end from the binary distribution. It is used for running the -llvm-test testsuite and for compiling C/C++ programs. Note that you can optionally -build llvm-gcc yourself after building the +
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-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:
+To install the GCC front end, do the following (on Windows, use an archival tool +like 7-zip that understands gzipped tars):
Once the binary is uncompressed, you should add a symlink for llvm-gcc and -llvm-g++ to some directory in your path. 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 -pointer after building the main LLVM repository: just reconfigure llvm and -llvm-test will pick it up. +
Once the binary is uncompressed, if you're using a *nix-based system, add a symlink for +llvm-gcc and llvm-g++ to some directory in your path. If you're using a +Windows-based system, add the bin subdirectory of your front end installation directory +to your PATH environment variable. For example, if you uncompressed the binary to +c:\llvm-gcc, add c:\llvm-gcc\bin to your PATH.
+ +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 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 +test-suite will pick it up.
-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.
+As a convenience for Windows users, the front end binaries for MinGW/x86 include +versions of the required w32api and mingw-runtime binaries. The last remaining step for +Windows users is to simply uncompress the binary binutils package from +MinGW into your front end installation directory. While the +front end installation steps are not quite the same as a typical manual MinGW installation, +they should be similar enough to those who have previously installed MinGW on Windows systems.
-In cases like these, you may want to try building the GCC front end from source. This is -much easier now than it was in the past.
+To install binutils on Windows:
+ +The binary versions of the LLVM 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. In cases like these, you may want to try +building the GCC front end from source. Thankfully, +this is much easier now than it was in the past.
+ +We also do not currently support updating of the GCC front end by manually overlaying +newer versions of the w32api and mingw-runtime binary packages that may become available +from MinGW. At this time, it's best to think of the MinGW LLVM GCC front end binary as +a self-contained convenience package that requires Windows users to simply download and +uncompress the GNU Binutils binary package from the MinGW project.
+ +Regardless of your platform, if you discover that installing the LLVM GCC front end +binaries is not as easy as previously described, or you would like to suggest improvements, +please let us know how you would like to see things improved by dropping us a note on our +mailing list.
Once checked out from the Subversion repository, the LLVM suite source code must be @@ -847,9 +1081,11 @@ script to configure the build system:
Once you have configured LLVM, you can build it. There are three types of builds:
@@ -917,10 +1153,12 @@ builds:It is possible to cross-compile LLVM. That is, you can create LLVM - executables and libraries for a platform different than the one one which you - are compiling. To do this, a few additional steps are - required. 1 To cross-compile LLVM, use - these instructions:
-The result of such a build will produce executables that are not executable - on your build host (--build option) but can be executed on your compile host + + +
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).
-Notes:
-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 @@ -1103,13 +1320,13 @@ platforms or configurations using the same source tree.
named after the build type: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:
-This directory contains some simple examples of how to use the LLVM IR and JIT.
This directory contains public header files exported from the LLVM library. The three main subdirectories of this directory are:
@@ -1217,8 +1445,11 @@ library. The three main subdirectories of this directory are: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 @@ -1257,6 +1488,10 @@ different tools.
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 @@ -1287,8 +1522,11 @@ different tools.
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 @@ -1301,16 +1539,22 @@ end to compile.
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.
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). @@ -1325,12 +1569,15 @@ end to compile.
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 +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.
@@ -1344,16 +1591,6 @@ information is in the Command Guide. href="HowToSubmitABug.html">HowToSubmitABug.html for more information on using bugpoint. -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 @@ -1472,22 +1712,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.
@@ -1498,12 +1731,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. -First, create a simple C file, name it 'hello.c':
@@ -1584,14 +1818,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 @@ -1600,12 +1835,12 @@ Asked Questions page.
This document is just an introduction on how to use LLVM to do some simple things... there are many more interesting and complicated things @@ -1633,7 +1868,7 @@ out:
Chris Lattner