X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FGettingStarted.html;h=c91cb03d18ca6b1606f4f49aadfa93e5baf3a187;hb=c8e41c591741b3da1077f7000274ad040bef8002;hp=6dd32a8d7d5fa53163c6bbc82e5471dcf6e686d7;hpb=16f1692dca19431768e6f113af4acac470f8adf8;p=oota-llvm.git diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 6dd32a8d7d5..c91cb03d18c 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -4,13 +4,13 @@
Written by: John Criswell, Chris Lattner, - Misha Brukman, + Misha Brukman, Vikram Adve, and Guochun Shi.
@@ -70,30 +69,30 @@ -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 Clang 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 -end uses the GCC parser to convert code to LLVM. Once -compiled into LLVM bitcode, a program can be manipulated with the LLVM tools -from the LLVM suite.
+The second piece is the Clang front end. +This component compiles C, C++, Objective C, and Objective C++ code into LLVM +bitcode. Once 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 +100,16 @@ and performance.The LLVM Getting Started documentation may be out of date. So, the Clang +Getting Started page might +also be a good place to start.
Here's the short story for getting up and running quickly with LLVM:
@@ -114,98 +117,110 @@ and performance.Specify for directory the full pathname of where you +
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.
Enable the SPEC2000 benchmarks for testing. The SPEC2000 - benchmarks should be available in - directory.
Consult the Getting Started with LLVM section for detailed information on configuring and compiling LLVM. See Setting Up Your Environment for tips that simplify -working with the GCC front end and LLVM tools. Go to Program +working with the Clang front end and LLVM tools. Go to Program 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:
@@ -240,6 +255,11 @@ software you will need.Notes:
@@ -316,13 +342,9 @@ upThe 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.
-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 @@ -375,13 +396,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 @@ -521,8 +546,7 @@ href="http://gcc.gnu.org/PR13392">serious bug which causes it to crash in the "convert_from_eh_region_ranges_1" GCC function.
Cygwin GCC 3.3.3: The version of GCC 3.3.3 commonly shipped with - Cygwin does not work. Please upgrade - to a newer version if possible.
+ Cygwin does not work.SuSE GCC 3.3.3: The version of GCC 3.3.3 shipped with SuSE 9.1 (and possibly others) does not compile LLVM correctly (it appears that exception handling is broken in some cases). Please download the FSF 3.3.3 or upgrade @@ -566,6 +590,10 @@ 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.
+SUSE 11 GCC 4.3.4: Miscompiles LLVM, causing crashes in ValueHandle logic.
+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 @@ -585,32 +613,31 @@ 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.
The later sections of this guide describe the general layout of the the LLVM source tree, a general layout of 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 @@ -632,22 +659,16 @@ All these paths are absolute:
can be the same as SRC_ROOT).- For the pre-built GCC front end binaries, the LLVMGCCDIR is - llvm-gcc/platform/llvm-gcc.
In order to compile and use LLVM, you may need to set some environment @@ -666,11 +687,11 @@ variables.
If you have the LLVM distribution, you will need to unpack it before you @@ -686,7 +707,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 Subversion as @@ -728,6 +749,11 @@ revision), you can checkout it from the 'tags' directory (instead of subdirectories of the 'tags' directory:
% 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
If you would like to get the GCC front end source code, you can also get it -and build it yourself. Please follow these -instructions to successfully get and build the LLVM GCC front-end.
-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 -main LLVM repository.
+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:
-To install the GCC front end, do the following:
++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 +-
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. +
+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.
-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.
++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 +-
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.
++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 ++ +
Once checked out from the Subversion repository, the LLVM suite source code must be @@ -845,29 +988,6 @@ script to configure the build system:
The following options can be used to set or enable LLVM specific options:
Once you have configured LLVM, you can build it. There are three types of builds:
@@ -1064,11 +1184,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 @@ -1082,11 +1202,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 @@ -1109,13 +1229,13 @@ platforms or configurations using the same source tree.
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. Thanks to Jack
-Cummings for pointing this out!
+This allows you to execute LLVM bitcode files directly. On Debian, you
+can also use this command instead of the 'echo' command above:
+$ sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
+
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:
@@ -1223,8 +1354,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,12 +1391,16 @@ 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 @@ -1293,11 +1431,14 @@ 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 +used when linking programs with the Clang front end. Most of these libraries are skeleton versions of real libraries; for example, libc is a stripped down version of glibc.
@@ -1307,16 +1448,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). @@ -1331,12 +1478,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.
@@ -1350,16 +1500,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 @@ -1457,12 +1594,6 @@ are code generators for parts of LLVM infrastructure.
directory, switch to directory llvm/tools/llc and build it, causing a re-linking of LLC.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. -
- -Note: The gcc4 frontend's invocation is considerably different -from the previous gcc3 frontend. In particular, the gcc4 frontend does not -create bitcode by default: gcc4 produces native code. As the example below illustrates, -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.
-This section gives an example of using LLVM with the Clang front end.
- +First, create a simple C file, name it 'hello.c':
@@ -1526,24 +1642,21 @@ int main() {Next, compile the C file into a native executable:
-% llvm-gcc hello.c -o hello
% clang hello.c -o hello
Note that llvm-gcc works just like GCC by default. The standard -S and +
Note that clang works just like GCC by default. The standard -S and -c arguments work as usual (producing a native .s or .o file, respectively).
Next, compile the C file into a LLVM bitcode file:
% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc
% clang -O3 -emit-llvm hello.c -c -o hello.bc
The -emit-llvm option can be used with the -S or -c options to emit an LLVM ".ll" or ".bc" file (respectively) for the code. This allows you to use the standard LLVM tools on - the bitcode file.
- -Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments. -
+ the bitcode file.Run the program in both forms. To run the program, use:
@@ -1582,7 +1695,7 @@ int main() {% ./hello.native
Note that using llvm-gcc to compile directly to native code (i.e. when +
Note that using clang to compile directly to native code (i.e. when the -emit-llvm option is not present) does steps 6/7/8 for you.
If you are having problems building or using LLVM, or if you have any other general questions about LLVM, please consult the Frequently @@ -1606,12 +1720,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 @@ -1639,7 +1753,7 @@ out:
Chris Lattner