From 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 Mon Sep 17 00:00:00 2001
From: dim
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 the low level virtual machine. 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 -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.
+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 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 Test Suite. It is a suite of programs @@ -109,83 +107,98 @@ 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:
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 test-suite 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.
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.
- @@ -430,7 +439,7 @@ 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 @@ -538,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 @@ -651,12 +658,6 @@ 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. @@ -747,7 +748,6 @@ revision), you can checkout it from the 'tags' directory (instead of subdirectories of the 'tags' directory:
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.
- @@ -891,6 +887,8 @@ Then, your .git/config should have [imap] sections. folder = "[Gmail]/Drafts" ; example for Japanese, "Modified UTF-7" encoded. folder = "[Gmail]/&Tgtm+DBN-" +; example for Traditional Chinese + folder = "[Gmail]/&g0l6Pw-" @@ -951,76 +949,6 @@ git svn rebase -lBefore 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 (on Windows, use an archival tool -like 7-zip that understands gzipped tars):
- -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. -
- -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.
- -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.
- -The following options can be used to set or enable LLVM specific options:
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.
@@ -1692,12 +1597,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 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.
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:
@@ -1811,7 +1698,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.