From ce760f6f544c23e372933ae96910536e48a7a350 Mon Sep 17 00:00:00 2001
From: John Criswell 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 later sections of this guide describe the 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.
+ 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 also contains a test suite 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 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.
+
-
+
+
Getting Started
- 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
@@ -89,7 +91,7 @@
- LLVM may compile on other platforms. While the LLVM utilities should work,
- they will only generate Sparc or x86 machine code.
+ LLVM may compile on other platforms. The LLVM utilities should work
+ on other platforms, so it should be possible to generate and produce LLVM
+ bytecode on unsupported platforms (although bytecode generated on one
+ platform may not work on another platform). However, the code generators
+ and Just In Time Compilers (JIT's) only generate SparcV9 or x86 machine
+ code.
@@ -99,8 +101,12 @@
Software
@@ -109,30 +115,33 @@
Compiling LLVM requires that you have several different software packages
installed:
-
-
+
Note that we currently do not support any other C++ compiler.
-+
+ +
+ +
There are some additional tools that you may want to have when working with @@ -140,39 +149,70 @@
- If you want to make changes to the autoconf scripts which configure LLVM - for compilation, you will need GNU autoconf, and consequently, GNU M4. - LLVM was built with autoconf 2.53, so that release and any later - release should work. + If you want to make changes to the configure scripts, you will need + GNU autoconf (2.53 or higher), and consequently, GNU M4 (version 1.4 + or higher).
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 later sections of this guide describe the 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. + + +
+
See Setting up your environment on tips to @@ -191,17 +231,93 @@ of this document below. In any of the examples below, simply replace each of these names with the appropriate pathname on your local system. All these paths are absolute:
-+ +
+ +
+ +
+ +
Before checking out the source code, you will need to know the path to - the CVS repository containing the LLVM source code (we'll call this - CVSROOTDIR below). Ask the person responsible for your local LLVM - installation to give you this path. +
+ In order to compile and use LLVM, you will need to set some environment + variables. There are also some shell aliases which you may find useful. + You can set these on the command line, or better yet, set them in your + .cshrc or .profile. + +
+ +
+ +
+ +
+ +
+ +
To get a fresh copy of the entire source code, all you need to do is check it out from CVS as follows: @@ -214,13 +330,19 @@ directory and fully populate it with the LLVM source code, Makefiles, test directories, and local copies of documentation files.
++ Note that the C 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. +
+ -Once checked out from the CVS repository, options and pathnames specific - to an installation of LLVM can be set via the configure script. - This script sets variables in llvm/Makefile.config and +
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.
@@ -229,102 +351,250 @@
+
+
+
-
The LLVM make system sends most output files generated during the build - into the directory defined by the variable OBJ_ROOT in - llvm/Makefile.config. 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. + Once you have configured LLVM, you can build it. There are three types of + builds: + +
-
If you wish to place output files into a separate directory, use the - --with-objroot=directory option of configure to - set the top level directory of where the object files will go. Otherwise, - leave this option unspecified, and configure will place files - within the LLVM source tree. +
+ +
+ make + +
+ If you have multiple processors in your machine, you may wish to use some + of the parallel build options provided by GNU Make. For example, you could + use the command: +
+ ++ make -j2 + +
+ There are several other targets which are useful when working with the LLVM + source code: + +
+ +
+
+ +
+ +
+
+ This step is optional if you have the C front end binary distrubtion for + your platform. +
+ + + Now that you have the LLVM Suite built, you can build the C 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 + polished as the rest of the LLVM code, so there will be many warnings and + errors that you will need to ignore for now: -
Add the following lines to your .cshrc (or the corresponding - lines to your .profile if you use a bourne shell derivative). +
- # Make the C front end easy to use... - alias llvmgcc LLVMGCCDIR/bin/llvm-gcc +
The other LLVM tools are part of the LLVM - source base and built when compiling LLVM. They will be built into the - OBJ_ROOT/tools/Debug directory.
+Every directory in the LLVM source tree includes a Makefile to - build it and any subdirectories that it contains. These makefiles require - that you use GNU Make (sometimes called gmake) instead of - make to - build them, but can - otherwise be used freely. To build the entire LLVM system, just enter the - top level llvm directory and type gmake. A few minutes - later you will hopefully have a freshly compiled toolchain waiting for you - in OBJ_ROOT/llvm/tools/Debug. If you want to look at the - libraries that - were compiled, look in OBJ_ROOT/llvm/lib/Debug.
+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 you get an error about a /localhome directory, follow the - instructions in the section about Setting Up Your - Environment. +
+ 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. +
++ 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. +
++ The LLVM build will place files underneath OBJ_ROOT in directories + named after the build type: +
+ ++ +
+ +
One useful source of infomation about the LLVM sourcebase 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:
@@ -346,25 +616,6 @@ for the most part these can just be ignored. - -- -
@@ -491,7 +742,7 @@ disassembled or manipulated just like any other bytecode file). The command line interface to gccas is designed to be as close as possible to the system 'as' utility so that the gcc - frontend itself did not have to be modified to interface to a "wierd" + frontend itself did not have to be modified to interface to a "weird" assembler.
+ +
+ Another possibility is that we hardcoded a path in our Makefiles. If + you see this, please email the LLVM bug mailing list with the name of + the offending Makefile and a description of what is wrong with it. + +
+ +
+ PATH=
+ This is still somewhat inconvenient, but it allows + configure to do its work without having to adjust your + PATH permanently. +