comparison docs/GettingStarted.rst @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
6 :local: 6 :local:
7 7
8 Overview 8 Overview
9 ======== 9 ========
10 10
11 Welcome to LLVM! In order to get started, you first need to know some basic 11 Welcome to the LLVM project! In order to get started, you first need to know
12 information. 12 some basic information.
13 13
14 First, LLVM comes in three pieces. The first piece is the LLVM suite. This 14 First, the LLVM project has multiple components. The core of the project is
15 contains all of the tools, libraries, and header files needed to use LLVM. It 15 itself called "LLVM". This contains all of the tools, libraries, and header
16 contains an assembler, disassembler, bitcode analyzer and bitcode optimizer. It 16 files needed to process an intermediate representation and convert it into
17 also contains basic regression tests that can be used to test the LLVM tools and 17 object files. It contains an assembler, disassembler, bitcode analyzer and
18 the Clang front end. 18 bitcode optimizer. It also contains basic regression tests.
19 19
20 The second piece is the `Clang <http://clang.llvm.org/>`_ front end. This 20 Another piece is the `Clang <http://clang.llvm.org/>`_ front end. This
21 component compiles C, C++, Objective C, and Objective C++ code into LLVM 21 component compiles C, C++, Objective C, and Objective C++ code into LLVM bitcode
22 bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the 22 -- and from there into object files, using LLVM.
23 LLVM tools from the LLVM suite. 23
24 24 There are other components as well:
25 There is a third, optional piece called Test Suite. It is a suite of programs 25 the `libc++ C++ standard library <https://libcxx.llvm.org>`_,
26 with a testing harness that can be used to further test LLVM's functionality 26 the `LLD linker <https://lld.llvm.org>`_, and more.
27 and performance.
28 27
29 Getting Started Quickly (A Summary) 28 Getting Started Quickly (A Summary)
30 =================================== 29 ===================================
31 30
32 The LLVM Getting Started documentation may be out of date. So, the `Clang 31 The LLVM Getting Started documentation may be out of date. So, the `Clang
37 36
38 #. Read the documentation. 37 #. Read the documentation.
39 #. Read the documentation. 38 #. Read the documentation.
40 #. Remember that you were warned twice about reading the documentation. 39 #. Remember that you were warned twice about reading the documentation.
41 40
42 * In particular, the *relative paths specified are important*. 41 #. Checkout LLVM (including related subprojects like Clang):
43 42
44 #. Checkout LLVM: 43 * ``git clone https://github.com/llvm/llvm-project.git``
45 44 * Or, on windows, ``git clone --config core.autocrlf=false
46 * ``cd where-you-want-llvm-to-live`` 45 https://github.com/llvm/llvm-project.git``
47 * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` 46
48 47 #. Configure and build LLVM and Clang:.
49 #. Checkout Clang: 48
50 49 * ``cd llvm-project``
51 * ``cd where-you-want-llvm-to-live``
52 * ``cd llvm/tools``
53 * ``svn co http://llvm.org/svn/llvm-project/cfe/trunk clang``
54
55 #. Checkout Extra Clang Tools **[Optional]**:
56
57 * ``cd where-you-want-llvm-to-live``
58 * ``cd llvm/tools/clang/tools``
59 * ``svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra``
60
61 #. Checkout LLD linker **[Optional]**:
62
63 * ``cd where-you-want-llvm-to-live``
64 * ``cd llvm/tools``
65 * ``svn co http://llvm.org/svn/llvm-project/lld/trunk lld``
66
67 #. Checkout Polly Loop Optimizer **[Optional]**:
68
69 * ``cd where-you-want-llvm-to-live``
70 * ``cd llvm/tools``
71 * ``svn co http://llvm.org/svn/llvm-project/polly/trunk polly``
72
73 #. Checkout Compiler-RT (required to build the sanitizers) **[Optional]**:
74
75 * ``cd where-you-want-llvm-to-live``
76 * ``cd llvm/projects``
77 * ``svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt``
78
79 #. Checkout Libomp (required for OpenMP support) **[Optional]**:
80
81 * ``cd where-you-want-llvm-to-live``
82 * ``cd llvm/projects``
83 * ``svn co http://llvm.org/svn/llvm-project/openmp/trunk openmp``
84
85 #. Checkout libcxx and libcxxabi **[Optional]**:
86
87 * ``cd where-you-want-llvm-to-live``
88 * ``cd llvm/projects``
89 * ``svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx``
90 * ``svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi``
91
92 #. Get the Test Suite Source Code **[Optional]**
93
94 * ``cd where-you-want-llvm-to-live``
95 * ``cd llvm/projects``
96 * ``svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite``
97
98 #. Configure and build LLVM and Clang:
99
100 *Warning:* Make sure you've checked out *all of* the source code
101 before trying to configure with cmake. cmake does not pickup newly
102 added source directories in incremental builds.
103
104 The build uses `CMake <CMake.html>`_. LLVM requires CMake 3.4.3 to build. It
105 is generally recommended to use a recent CMake, especially if you're
106 generating Ninja build files. This is because the CMake project is constantly
107 improving the quality of the generators, and the Ninja generator gets a lot
108 of attention.
109
110 * ``cd where you want to build llvm``
111 * ``mkdir build`` 50 * ``mkdir build``
112 * ``cd build`` 51 * ``cd build``
113 * ``cmake -G <generator> [options] <path to llvm sources>`` 52 * ``cmake -G <generator> [options] ../llvm``
114 53
115 Some common generators are: 54 Some common generators are:
116 55
117 * ``Unix Makefiles`` --- for generating make-compatible parallel makefiles.
118 * ``Ninja`` --- for generating `Ninja <https://ninja-build.org>`_ 56 * ``Ninja`` --- for generating `Ninja <https://ninja-build.org>`_
119 build files. Most llvm developers use Ninja. 57 build files. Most llvm developers use Ninja.
58 * ``Unix Makefiles`` --- for generating make-compatible parallel makefiles.
120 * ``Visual Studio`` --- for generating Visual Studio projects and 59 * ``Visual Studio`` --- for generating Visual Studio projects and
121 solutions. 60 solutions.
122 * ``Xcode`` --- for generating Xcode projects. 61 * ``Xcode`` --- for generating Xcode projects.
123 62
124 Some Common options: 63 Some Common options:
125 64
65 * ``-DLLVM_ENABLE_PROJECTS='...'`` --- semicolon-separated list of the LLVM
66 subprojects you'd like to additionally build. Can include any of: clang,
67 clang-tools-extra, libcxx, libcxxabi, libunwind, lldb, compiler-rt, lld,
68 polly, or debuginfo-tests.
69
70 For example, to build LLVM, Clang, libcxx, and libcxxabi, use
71 ``-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"``.
72
126 * ``-DCMAKE_INSTALL_PREFIX=directory`` --- Specify for *directory* the full 73 * ``-DCMAKE_INSTALL_PREFIX=directory`` --- Specify for *directory* the full
127 pathname of where you want the LLVM tools and libraries to be installed 74 pathname of where you want the LLVM tools and libraries to be installed
128 (default ``/usr/local``). 75 (default ``/usr/local``).
129 76
130 * ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for *type* are Debug, 77 * ``-DCMAKE_BUILD_TYPE=type`` --- Valid options for *type* are Debug,
133 * ``-DLLVM_ENABLE_ASSERTIONS=On`` --- Compile with assertion checks enabled 80 * ``-DLLVM_ENABLE_ASSERTIONS=On`` --- Compile with assertion checks enabled
134 (default is Yes for Debug builds, No for all other build types). 81 (default is Yes for Debug builds, No for all other build types).
135 82
136 * Run your build tool of choice! 83 * Run your build tool of choice!
137 84
138 * The default target (i.e. ``make``) will build all of LLVM 85 * The default target (i.e. ``ninja`` or ``make``) will build all of LLVM.
139 86
140 * The ``check-all`` target (i.e. ``make check-all``) will run the 87 * The ``check-all`` target (i.e. ``ninja check-all``) will run the
141 regression tests to ensure everything is in working order. 88 regression tests to ensure everything is in working order.
142 89
143 * CMake will generate build targets for each tool and library, and most 90 * CMake will generate build targets for each tool and library, and most
144 LLVM sub-projects generate their own ``check-<project>`` target. 91 LLVM sub-projects generate their own ``check-<project>`` target.
145 92
146 * Running a serial build will be *slow*. Make sure you run a 93 * Running a serial build will be *slow*. Make sure you run a parallel
147 parallel build; for ``make``, use ``make -j``. 94 build. That's already done by default in Ninja; for ``make``, use
95 ``make -j NNN`` (with an appropriate value of NNN, e.g. number of CPUs
96 you have.)
148 97
149 * For more information see `CMake <CMake.html>`_ 98 * For more information see `CMake <CMake.html>`_
150 99
151 * If you get an "internal compiler error (ICE)" or test failures, see 100 * If you get an "internal compiler error (ICE)" or test failures, see
152 `below`_. 101 `below`_.
170 ================== ===================== ============= 119 ================== ===================== =============
171 OS Arch Compilers 120 OS Arch Compilers
172 ================== ===================== ============= 121 ================== ===================== =============
173 Linux x86\ :sup:`1` GCC, Clang 122 Linux x86\ :sup:`1` GCC, Clang
174 Linux amd64 GCC, Clang 123 Linux amd64 GCC, Clang
175 Linux ARM\ :sup:`4` GCC, Clang 124 Linux ARM GCC, Clang
176 Linux PowerPC GCC, Clang 125 Linux PowerPC GCC, Clang
177 Solaris V9 (Ultrasparc) GCC 126 Solaris V9 (Ultrasparc) GCC
178 FreeBSD x86\ :sup:`1` GCC, Clang 127 FreeBSD x86\ :sup:`1` GCC, Clang
179 FreeBSD amd64 GCC, Clang 128 FreeBSD amd64 GCC, Clang
180 NetBSD x86\ :sup:`1` GCC, Clang 129 NetBSD x86\ :sup:`1` GCC, Clang
181 NetBSD amd64 GCC, Clang 130 NetBSD amd64 GCC, Clang
182 MacOS X\ :sup:`2` PowerPC GCC 131 macOS\ :sup:`2` PowerPC GCC
183 MacOS X x86 GCC, Clang 132 macOS x86 GCC, Clang
184 Cygwin/Win32 x86\ :sup:`1, 3` GCC 133 Cygwin/Win32 x86\ :sup:`1, 3` GCC
185 Windows x86\ :sup:`1` Visual Studio 134 Windows x86\ :sup:`1` Visual Studio
186 Windows x64 x86-64 Visual Studio 135 Windows x64 x86-64 Visual Studio
187 ================== ===================== ============= 136 ================== ===================== =============
188 137
190 139
191 #. Code generation supported for Pentium processors and up 140 #. Code generation supported for Pentium processors and up
192 #. Code generation supported for 32-bit ABI only 141 #. Code generation supported for 32-bit ABI only
193 #. To use LLVM modules on Win32-based system, you may configure LLVM 142 #. To use LLVM modules on Win32-based system, you may configure LLVM
194 with ``-DBUILD_SHARED_LIBS=On``. 143 with ``-DBUILD_SHARED_LIBS=On``.
195 #. MCJIT not working well pre-v7, old JIT engine not supported any more.
196 144
197 Note that Debug builds require a lot of time and disk space. An LLVM-only build 145 Note that Debug builds require a lot of time and disk space. An LLVM-only build
198 will need about 1-3 GB of space. A full build of LLVM and Clang will need around 146 will need about 1-3 GB of space. A full build of LLVM and Clang will need around
199 15-20 GB of disk space. The exact space requirements will vary by system. (It 147 15-20 GB of disk space. The exact space requirements will vary by system. (It
200 is so large because of all the debugging information and the fact that the 148 is so large because of all the debugging information and the fact that the
201 libraries are statically linked into multiple tools). 149 libraries are statically linked into multiple tools).
202 150
203 If you you are space-constrained, you can build only selected tools or only 151 If you are space-constrained, you can build only selected tools or only
204 selected targets. The Release build requires considerably less space. 152 selected targets. The Release build requires considerably less space.
205 153
206 The LLVM suite *may* compile on other platforms, but it is not guaranteed to do 154 The LLVM suite *may* compile on other platforms, but it is not guaranteed to do
207 so. If compilation is successful, the LLVM utilities should be able to 155 so. If compilation is successful, the LLVM utilities should be able to
208 assemble, disassemble, analyze, and optimize LLVM bitcode. Code generation 156 assemble, disassemble, analyze, and optimize LLVM bitcode. Code generation
219 uses the package and provides other details. 167 uses the package and provides other details.
220 168
221 =========================================================== ============ ========================================== 169 =========================================================== ============ ==========================================
222 Package Version Notes 170 Package Version Notes
223 =========================================================== ============ ========================================== 171 =========================================================== ============ ==========================================
224 `GNU Make <http://savannah.gnu.org/projects/make>`_ 3.79, 3.79.1 Makefile/build processor 172 `CMake <http://cmake.org/>`_ >=3.4.3 Makefile/workspace generator
225 `GCC <http://gcc.gnu.org/>`_ >=4.8.0 C/C++ compiler\ :sup:`1` 173 `GCC <http://gcc.gnu.org/>`_ >=5.1.0 C/C++ compiler\ :sup:`1`
226 `python <http://www.python.org/>`_ >=2.7 Automated test suite\ :sup:`2` 174 `python <http://www.python.org/>`_ >=2.7 Automated test suite\ :sup:`2`
227 `zlib <http://zlib.net>`_ >=1.2.3.4 Compression library\ :sup:`3` 175 `zlib <http://zlib.net>`_ >=1.2.3.4 Compression library\ :sup:`3`
176 `GNU Make <http://savannah.gnu.org/projects/make>`_ 3.79, 3.79.1 Makefile/build processor\ :sup:`4`
228 =========================================================== ============ ========================================== 177 =========================================================== ============ ==========================================
229 178
230 .. note:: 179 .. note::
231 180
232 #. Only the C and C++ languages are needed so there's no need to build the 181 #. Only the C and C++ languages are needed so there's no need to build the
234 info. 183 info.
235 #. Only needed if you want to run the automated test suite in the 184 #. Only needed if you want to run the automated test suite in the
236 ``llvm/test`` directory. 185 ``llvm/test`` directory.
237 #. Optional, adds compression / uncompression capabilities to selected LLVM 186 #. Optional, adds compression / uncompression capabilities to selected LLVM
238 tools. 187 tools.
188 #. Optional, you can use any other build tool supported by CMake.
239 189
240 Additionally, your compilation host is expected to have the usual plethora of 190 Additionally, your compilation host is expected to have the usual plethora of
241 Unix utilities. Specifically: 191 Unix utilities. Specifically:
242 192
243 * **ar** --- archive library builder 193 * **ar** --- archive library builder
270 220
271 Host C++ Toolchain, both Compiler and Standard Library 221 Host C++ Toolchain, both Compiler and Standard Library
272 ------------------------------------------------------ 222 ------------------------------------------------------
273 223
274 LLVM is very demanding of the host C++ compiler, and as such tends to expose 224 LLVM is very demanding of the host C++ compiler, and as such tends to expose
275 bugs in the compiler. We are also planning to follow improvements and 225 bugs in the compiler. We also attempt to follow improvements and developments in
276 developments in the C++ language and library reasonably closely. As such, we 226 the C++ language and library reasonably closely. As such, we require a modern
277 require a modern host C++ toolchain, both compiler and standard library, in 227 host C++ toolchain, both compiler and standard library, in order to build LLVM.
278 order to build LLVM. 228
279 229 LLVM is written using the subset of C++ documented in :doc:`coding
280 For the most popular host toolchains we check for specific minimum versions in 230 standards<CodingStandards>`. To enforce this language version, we check the most
281 our build systems: 231 popular host toolchains for specific minimum versions in our build systems:
232
233 * Clang 3.5
234 * Apple Clang 6.0
235 * GCC 5.1
236 * Visual Studio 2017
237
238 The below versions currently soft-error as we transition to the new compiler
239 versions listed above. The LLVM codebase is currently known to compile correctly
240 with the following compilers, though this will change in the near future:
282 241
283 * Clang 3.1 242 * Clang 3.1
243 * Apple Clang 3.1
284 * GCC 4.8 244 * GCC 4.8
285 * Visual Studio 2015 (Update 3) 245 * Visual Studio 2017
286 246
287 Anything older than these toolchains *may* work, but will require forcing the 247 Anything older than these toolchains *may* work, but will require forcing the
288 build system with a special option and is not really a supported host platform. 248 build system with a special option and is not really a supported host platform.
289 Also note that older versions of these compilers have often crashed or 249 Also note that older versions of these compilers have often crashed or
290 miscompiled LLVM. 250 miscompiled LLVM.
312 newer version of Gold. 272 newer version of Gold.
313 273
314 Getting a Modern Host C++ Toolchain 274 Getting a Modern Host C++ Toolchain
315 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 275 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
316 276
317 This section mostly applies to Linux and older BSDs. On Mac OS X, you should 277 This section mostly applies to Linux and older BSDs. On macOS, you should
318 have a sufficiently modern Xcode, or you will likely need to upgrade until you 278 have a sufficiently modern Xcode, or you will likely need to upgrade until you
319 do. Windows does not have a "system compiler", so you must install either Visual 279 do. Windows does not have a "system compiler", so you must install either Visual
320 Studio 2015 or a recent version of mingw64. FreeBSD 10.0 and newer have a modern 280 Studio 2017 or a recent version of mingw64. FreeBSD 10.0 and newer have a modern
321 Clang as the system compiler. 281 Clang as the system compiler.
322 282
323 However, some Linux distributions and some other or older BSDs sometimes have 283 However, some Linux distributions and some other or older BSDs sometimes have
324 extremely old versions of GCC. These steps attempt to help you upgrade you 284 extremely old versions of GCC. These steps attempt to help you upgrade you
325 compiler even on such a system. However, if at all possible, we encourage you 285 compiler even on such a system. However, if at all possible, we encourage you
332 292
333 The first step is to get a recent GCC toolchain installed. The most common 293 The first step is to get a recent GCC toolchain installed. The most common
334 distribution on which users have struggled with the version requirements is 294 distribution on which users have struggled with the version requirements is
335 Ubuntu Precise, 12.04 LTS. For this distribution, one easy option is to install 295 Ubuntu Precise, 12.04 LTS. For this distribution, one easy option is to install
336 the `toolchain testing PPA`_ and use it to install a modern GCC. There is 296 the `toolchain testing PPA`_ and use it to install a modern GCC. There is
337 a really nice discussions of this on the `ask ubuntu stack exchange`_. However, 297 a really nice discussions of this on the `ask ubuntu stack exchange`_ and a
338 not all users can use PPAs and there are many other distributions, so it may be 298 `github gist`_ with updated commands. However, not all users can use PPAs and
339 necessary (or just useful, if you're here you *are* doing compiler development 299 there are many other distributions, so it may be necessary (or just useful, if
340 after all) to build and install GCC from source. It is also quite easy to do 300 you're here you *are* doing compiler development after all) to build and install
341 these days. 301 GCC from source. It is also quite easy to do these days.
342 302
343 .. _toolchain testing PPA: 303 .. _toolchain testing PPA:
344 https://launchpad.net/~ubuntu-toolchain-r/+archive/test 304 https://launchpad.net/~ubuntu-toolchain-r/+archive/test
345 .. _ask ubuntu stack exchange: 305 .. _ask ubuntu stack exchange:
346 http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminal 306 https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu/581497#58149
347 307 .. _github gist:
348 Easy steps for installing GCC 4.8.2: 308 https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91
349 309
350 .. code-block:: console 310 Easy steps for installing GCC 5.1.0:
351 311
352 % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 312 .. code-block:: console
353 % wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2.sig 313
314 % gcc_version=5.1.0
315 % wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2
316 % wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2.sig
354 % wget https://ftp.gnu.org/gnu/gnu-keyring.gpg 317 % wget https://ftp.gnu.org/gnu/gnu-keyring.gpg
355 % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-4.8.2.tar.bz2.sig` 318 % signature_invalid=`gpg --verify --no-default-keyring --keyring ./gnu-keyring.gpg gcc-${gcc_version}.tar.bz2.sig`
356 % if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi 319 % if [ $signature_invalid ]; then echo "Invalid signature" ; exit 1 ; fi
357 % tar -xvjf gcc-4.8.2.tar.bz2 320 % tar -xvjf gcc-${gcc_version}.tar.bz2
358 % cd gcc-4.8.2 321 % cd gcc-${gcc_version}
359 % ./contrib/download_prerequisites 322 % ./contrib/download_prerequisites
360 % cd .. 323 % cd ..
361 % mkdir gcc-4.8.2-build 324 % mkdir gcc-${gcc_version}-build
362 % cd gcc-4.8.2-build 325 % cd gcc-${gcc_version}-build
363 % $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++ 326 % $PWD/../gcc-${gcc_version}/configure --prefix=$HOME/toolchains --enable-languages=c,c++
364 % make -j$(nproc) 327 % make -j$(nproc)
365 % make install 328 % make install
366 329
367 For more details, check out the excellent `GCC wiki entry`_, where I got most 330 For more details, check out the excellent `GCC wiki entry`_, where I got most
368 of this information from. 331 of this information from.
369 332
370 .. _GCC wiki entry: 333 .. _GCC wiki entry:
371 http://gcc.gnu.org/wiki/InstallingGCC 334 https://gcc.gnu.org/wiki/InstallingGCC
372 335
373 Once you have a GCC toolchain, configure your build of LLVM to use the new 336 Once you have a GCC toolchain, configure your build of LLVM to use the new
374 toolchain for your host compiler and C++ standard library. Because the new 337 toolchain for your host compiler and C++ standard library. Because the new
375 version of libstdc++ is not on the system library search path, you need to pass 338 version of libstdc++ is not on the system library search path, you need to pass
376 extra linker flags so that it can be found at link time (``-L``) and at runtime 339 extra linker flags so that it can be found at link time (``-L``) and at runtime
386 349
387 If you fail to set rpath, most LLVM binaries will fail on startup with a message 350 If you fail to set rpath, most LLVM binaries will fail on startup with a message
388 from the loader similar to ``libstdc++.so.6: version `GLIBCXX_3.4.20' not 351 from the loader similar to ``libstdc++.so.6: version `GLIBCXX_3.4.20' not
389 found``. This means you need to tweak the -rpath linker flag. 352 found``. This means you need to tweak the -rpath linker flag.
390 353
391 When you build Clang, you will need to give *it* access to modern C++11 354 When you build Clang, you will need to give *it* access to modern C++
392 standard library in order to use it as your new host in part of a bootstrap. 355 standard library in order to use it as your new host in part of a bootstrap.
393 There are two easy ways to do this, either build (and install) libc++ along 356 There are two easy ways to do this, either build (and install) libc++ along
394 with Clang and then use it with the ``-stdlib=libc++`` compile and link flag, 357 with Clang and then use it with the ``-stdlib=libc++`` compile and link flag,
395 or install Clang into the same prefix (``$HOME/toolchains`` above) as GCC. 358 or install Clang into the same prefix (``$HOME/toolchains`` above) as GCC.
396 Clang will look within its own prefix for libstdc++ and use it if found. You 359 Clang will look within its own prefix for libstdc++ and use it if found. You
431 394
432 Unpacking the LLVM Archives 395 Unpacking the LLVM Archives
433 --------------------------- 396 ---------------------------
434 397
435 If you have the LLVM distribution, you will need to unpack it before you can 398 If you have the LLVM distribution, you will need to unpack it before you can
436 begin to compile it. LLVM is distributed as a set of two files: the LLVM suite 399 begin to compile it. LLVM is distributed as a number of different
437 and the LLVM GCC front end compiled for your platform. There is an additional 400 subprojects. Each one has its own download which is a TAR archive that is
438 test suite that is optional. Each file is a TAR archive that is compressed with 401 compressed with the gzip program.
439 the gzip program.
440 402
441 The files are as follows, with *x.y* marking the version number: 403 The files are as follows, with *x.y* marking the version number:
442 404
443 ``llvm-x.y.tar.gz`` 405 ``llvm-x.y.tar.gz``
444 406
445 Source release for the LLVM libraries and tools. 407 Source release for the LLVM libraries and tools.
446 408
447 ``llvm-test-x.y.tar.gz`` 409 ``cfe-x.y.tar.gz``
448 410
449 Source release for the LLVM test-suite. 411 Source release for the Clang frontend.
450 412
451 .. _checkout: 413 .. _checkout:
452 414
453 Checkout LLVM from Subversion 415 Checkout LLVM from Git
454 ----------------------------- 416 ----------------------
455 417
456 If you have access to our Subversion repository, you can get a fresh copy of the 418 You can also checkout the source code for LLVM from Git. While the LLVM
457 entire source code. All you need to do is check it out from Subversion as 419 project's official source-code repository is Subversion, we are in the process
458 follows: 420 of migrating to git. We currently recommend that all developers use Git for
421 day-to-day development.
422
423 .. note::
424
425 Passing ``--config core.autocrlf=false`` should not be required in
426 the future after we adjust the .gitattribute settings correctly, but
427 is required for Windows users at the time of this writing.
428
429 Simply run:
430
431 .. code-block:: console
432
433 % git clone https://github.com/llvm/llvm-project.git
434
435 or on Windows,
436
437 .. code-block:: console
438
439 % git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git
440
441 This will create an '``llvm-project``' directory in the current directory and
442 fully populate it with all of the source code, test directories, and local
443 copies of documentation files for LLVM and all the related subprojects. Note
444 that unlike the tarballs, which contain each subproject in a separate file, the
445 git repository contains all of the projects together.
446
447 If you want to get a specific release (as opposed to the most recent revision),
448 you can check out a tag after cloning the repository. E.g., `git checkout
449 llvmorg-6.0.1` inside the ``llvm-project`` directory created by the above
450 command. Use `git tag -l` to list all of them.
451
452 Sending patches
453 ^^^^^^^^^^^^^^^
454
455 Please read `Developer Policy <DeveloperPolicy.html#one-off-patches>`_, too.
456
457 We don't currently accept github pull requests, so you'll need to send patches
458 either via emailing to llvm-commits, or, preferably, via :ref:`Phabricator
459 <phabricator-reviews>`.
460
461 You'll generally want to make sure your branch has a single commit,
462 corresponding to the review you wish to send, up-to-date with the upstream
463 ``origin/master`` branch, and doesn't contain merges. Once you have that, you
464 can use ``git show`` or ``git format-patch`` to output the diff, and attach it
465 to a Phabricator review (or to an email message).
466
467 However, using the "Arcanist" tool is often easier. After `installing
468 arcanist`_, you can upload the latest commit using:
469
470 .. code-block:: console
471
472 % arc diff HEAD~1
473
474 Additionally, before sending a patch for review, please also try to ensure it's
475 formatted properly. We use ``clang-format`` for this, which has git integration
476 through the ``git-clang-format`` script. On some systems, it may already be
477 installed (or be installable via your package manager). If so, you can simply
478 run it -- the following command will format only the code changed in the most
479 recent commit:
480
481 .. code-block:: console
482
483 % git clang-format HEAD~1
484
485 Note that this modifies the files, but doesn't commit them -- you'll likely want
486 to run
487
488 .. code-block:: console
489
490 % git commit --amend -a
491
492 in order to update the last commit with all pending changes.
493
494 .. note::
495 If you don't already have ``clang-format`` or ``git clang-format`` installed
496 on your system, the ``clang-format`` binary will be built alongside clang, and
497 the git integration can be run from
498 ``clang/tools/clang-format/git-clang-format``.
499
500
501 .. _commit_from_git:
502
503 For developers to commit changes from Git
504 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
505
506 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add it
507 to your path, you can push committed changes upstream with ``git llvm
508 push``. While this creates a Subversion checkout and patches it under the hood,
509 it does not require you to have interaction with it.
510
511 .. code-block:: console
512
513 % export PATH=$PATH:$TOP_LEVEL_DIR/llvm-project/llvm/utils/git-svn/
514 % git llvm push
515
516 Within a couple minutes after pushing to subversion, the svn commit will have
517 been converted back to a Git commit, and made its way into the official Git
518 repository. At that point, ``git pull`` should get back the changes as they were
519 committed.
520
521 You'll likely want to ``git pull --rebase`` to get the official git commit
522 downloaded back to your repository. The SVN revision numbers of each commit can
523 be found at the end of the commit message, e.g. ``llvm-svn: 350914``.
524
525 You may also find the ``-n`` flag useful, like ``git llvm push -n``. This runs
526 through all the steps of committing _without_ actually doing the commit, and
527 tell you what it would have done. That can be useful if you're unsure whether
528 the right thing will happen.
529
530 Reverting a change when using Git
531 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
532
533 If you're using Git and need to revert a patch, Git needs to be supplied a
534 commit hash, not an svn revision. To make things easier, you can use
535 ``git llvm revert`` to revert with either an SVN revision or a Git hash instead.
536
537 Additionally, you can first run with ``git llvm revert -n`` to print which Git
538 commands will run, without doing anything.
539
540 Running ``git llvm revert`` will only revert things in your local repository. To
541 push the revert upstream, you still need to run ``git llvm push`` as described
542 earlier.
543
544 .. code-block:: console
545
546 % git llvm revert rNNNNNN # Revert by SVN id
547 % git llvm revert abcdef123456 # Revert by Git commit hash
548 % git llvm revert -n rNNNNNN # Print the commands without doing anything
549
550 Checkout via SVN (deprecated)
551 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
552
553 Until we have fully migrated to Git, you may also get a fresh copy of
554 the code from the official Subversion repository.
459 555
460 * ``cd where-you-want-llvm-to-live`` 556 * ``cd where-you-want-llvm-to-live``
461 * Read-Only: ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm`` 557 * Read-Only: ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
462 * Read-Write: ``svn co https://user@llvm.org/svn/llvm-project/llvm/trunk llvm`` 558 * Read-Write: ``svn co https://user@llvm.org/svn/llvm-project/llvm/trunk llvm``
463 559
473 * Release 3.5.0 and later: **RELEASE_350/final** and so on 569 * Release 3.5.0 and later: **RELEASE_350/final** and so on
474 * Release 2.9 through 3.4: **RELEASE_29/final** and so on 570 * Release 2.9 through 3.4: **RELEASE_29/final** and so on
475 * Release 1.1 through 2.8: **RELEASE_11** and so on 571 * Release 1.1 through 2.8: **RELEASE_11** and so on
476 * Release 1.0: **RELEASE_1** 572 * Release 1.0: **RELEASE_1**
477 573
478 If you would like to get the LLVM test suite (a separate package as of 1.4), you
479 get it from the Subversion repository:
480
481 .. code-block:: console
482
483 % cd llvm/projects
484 % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
485
486 By placing it in the ``llvm/projects``, it will be automatically configured by
487 the LLVM cmake configuration.
488
489 Git Mirror
490 ----------
491
492 Git mirrors are available for a number of LLVM subprojects. These mirrors sync
493 automatically with each Subversion commit and contain all necessary git-svn
494 marks (so, you can recreate git-svn metadata locally). Note that right now
495 mirrors reflect only ``trunk`` for each project. You can do the read-only Git
496 clone of LLVM via:
497
498 .. code-block:: console
499
500 % git clone https://git.llvm.org/git/llvm.git/
501
502 If you want to check out clang too, run:
503
504 .. code-block:: console
505
506 % cd llvm/tools
507 % git clone https://git.llvm.org/git/clang.git/
508
509 If you want to check out compiler-rt (required to build the sanitizers), run:
510
511 .. code-block:: console
512
513 % cd llvm/projects
514 % git clone https://git.llvm.org/git/compiler-rt.git/
515
516 If you want to check out libomp (required for OpenMP support), run:
517
518 .. code-block:: console
519
520 % cd llvm/projects
521 % git clone https://git.llvm.org/git/openmp.git/
522
523 If you want to check out libcxx and libcxxabi (optional), run:
524
525 .. code-block:: console
526
527 % cd llvm/projects
528 % git clone https://git.llvm.org/git/libcxx.git/
529 % git clone https://git.llvm.org/git/libcxxabi.git/
530
531 If you want to check out the Test Suite Source Code (optional), run:
532
533 .. code-block:: console
534
535 % cd llvm/projects
536 % git clone https://git.llvm.org/git/test-suite.git/
537
538 Since the upstream repository is in Subversion, you should use ``git
539 pull --rebase`` instead of ``git pull`` to avoid generating a non-linear history
540 in your clone. To configure ``git pull`` to pass ``--rebase`` by default on the
541 master branch, run the following command:
542
543 .. code-block:: console
544
545 % git config branch.master.rebase true
546
547 Sending patches with Git
548 ^^^^^^^^^^^^^^^^^^^^^^^^
549
550 Please read `Developer Policy <DeveloperPolicy.html#one-off-patches>`_, too.
551
552 Assume ``master`` points the upstream and ``mybranch`` points your working
553 branch, and ``mybranch`` is rebased onto ``master``. At first you may check
554 sanity of whitespaces:
555
556 .. code-block:: console
557
558 % git diff --check master..mybranch
559
560 The easiest way to generate a patch is as below:
561
562 .. code-block:: console
563
564 % git diff master..mybranch > /path/to/mybranch.diff
565
566 It is a little different from svn-generated diff. git-diff-generated diff has
567 prefixes like ``a/`` and ``b/``. Don't worry, most developers might know it
568 could be accepted with ``patch -p1 -N``.
569
570 But you may generate patchset with git-format-patch. It generates by-each-commit
571 patchset. To generate patch files to attach to your article:
572
573 .. code-block:: console
574
575 % git format-patch --no-attach master..mybranch -o /path/to/your/patchset
576
577 If you would like to send patches directly, you may use git-send-email or
578 git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
579
580 .. code-block:: console
581
582 % git format-patch --attach master..mybranch --stdout | git imap-send
583
584 Then, your .git/config should have [imap] sections.
585
586 .. code-block:: ini
587
588 [imap]
589 host = imaps://imap.gmail.com
590 user = your.gmail.account@gmail.com
591 pass = himitsu!
592 port = 993
593 sslverify = false
594 ; in English
595 folder = "[Gmail]/Drafts"
596 ; example for Japanese, "Modified UTF-7" encoded.
597 folder = "[Gmail]/&Tgtm+DBN-"
598 ; example for Traditional Chinese
599 folder = "[Gmail]/&g0l6Pw-"
600
601 .. _developers-work-with-git-svn:
602
603 For developers to work with git-svn
604 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
605
606 To set up clone from which you can submit code using ``git-svn``, run:
607
608 .. code-block:: console
609
610 % git clone https://git.llvm.org/git/llvm.git/
611 % cd llvm
612 % git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
613 % git config svn-remote.svn.fetch :refs/remotes/origin/master
614 % git svn rebase -l # -l avoids fetching ahead of the git mirror.
615
616 # If you have clang too:
617 % cd tools
618 % git clone https://git.llvm.org/git/clang.git/
619 % cd clang
620 % git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username=<username>
621 % git config svn-remote.svn.fetch :refs/remotes/origin/master
622 % git svn rebase -l
623
624 Likewise for compiler-rt, libomp and test-suite.
625
626 To update this clone without generating git-svn tags that conflict with the
627 upstream Git repo, run:
628
629 .. code-block:: console
630
631 % git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
632 % git checkout master
633 % git svn rebase -l
634 % (cd tools/clang &&
635 git checkout master &&
636 git svn rebase -l)
637
638 Likewise for compiler-rt, libomp and test-suite.
639
640 This leaves your working directories on their master branches, so you'll need to
641 ``checkout`` each working branch individually and ``rebase`` it on top of its
642 parent branch.
643
644 For those who wish to be able to update an llvm repo/revert patches easily using
645 git-svn, please look in the directory for the scripts ``git-svnup`` and
646 ``git-svnrevert``.
647
648 To perform the aforementioned update steps go into your source directory and
649 just type ``git-svnup`` or ``git svnup`` and everything will just work.
650
651 If one wishes to revert a commit with git-svn, but do not want the git hash to
652 escape into the commit message, one can use the script ``git-svnrevert`` or
653 ``git svnrevert`` which will take in the git hash for the commit you want to
654 revert, look up the appropriate svn revision, and output a message where all
655 references to the git hash have been replaced with the svn revision.
656
657 To commit back changes via git-svn, use ``git svn dcommit``:
658
659 .. code-block:: console
660
661 % git svn dcommit
662
663 Note that git-svn will create one SVN commit for each Git commit you have pending,
664 so squash and edit each commit before executing ``dcommit`` to make sure they all
665 conform to the coding standards and the developers' policy.
666
667 On success, ``dcommit`` will rebase against the HEAD of SVN, so to avoid conflict,
668 please make sure your current branch is up-to-date (via fetch/rebase) before
669 proceeding.
670
671 The git-svn metadata can get out of sync after you mess around with branches and
672 ``dcommit``. When that happens, ``git svn dcommit`` stops working, complaining
673 about files with uncommitted changes. The fix is to rebuild the metadata:
674
675 .. code-block:: console
676
677 % rm -rf .git/svn
678 % git svn rebase -l
679
680 Please, refer to the Git-SVN manual (``man git-svn``) for more information.
681
682 For developers to work with a git monorepo
683 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
684
685 .. note::
686
687 This set-up is using an unofficial mirror hosted on GitHub, use with caution.
688
689 To set up a clone of all the llvm projects using a unified repository:
690
691 .. code-block:: console
692
693 % export TOP_LEVEL_DIR=`pwd`
694 % git clone https://github.com/llvm-project/llvm-project-20170507/ llvm-project
695 % cd llvm-project
696 % git config branch.master.rebase true
697
698 You can configure various build directory from this clone, starting with a build
699 of LLVM alone:
700
701 .. code-block:: console
702
703 % cd $TOP_LEVEL_DIR
704 % mkdir llvm-build && cd llvm-build
705 % cmake -GNinja ../llvm-project/llvm
706
707 Or lldb:
708
709 .. code-block:: console
710
711 % cd $TOP_LEVEL_DIR
712 % mkdir lldb-build && cd lldb-build
713 % cmake -GNinja ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS=lldb
714
715 Or a combination of multiple projects:
716
717 .. code-block:: console
718
719 % cd $TOP_LEVEL_DIR
720 % mkdir clang-build && cd clang-build
721 % cmake -GNinja ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"
722
723 A helper script is provided in ``llvm/utils/git-svn/git-llvm``. After you add it
724 to your path, you can push committed changes upstream with ``git llvm push``.
725
726 .. code-block:: console
727
728 % export PATH=$PATH:$TOP_LEVEL_DIR/llvm-project/llvm/utils/git-svn/
729 % git llvm push
730
731 While this is using SVN under the hood, it does not require any interaction from
732 you with git-svn.
733 After a few minutes, ``git pull`` should get back the changes as they were
734 committed. Note that a current limitation is that ``git`` does not directly
735 record file rename, and thus it is propagated to SVN as a combination of
736 delete-add instead of a file rename.
737
738 The SVN revision of each monorepo commit can be found in the commit notes. git
739 does not fetch notes by default. The following commands will fetch the notes and
740 configure git to fetch future notes. Use ``git notes show $commit`` to look up
741 the SVN revision of a git commit. The notes show up ``git log``, and searching
742 the log is currently the recommended way to look up the git commit for a given
743 SVN revision.
744
745 .. code-block:: console
746
747 % git config --add remote.origin.fetch +refs/notes/commits:refs/notes/commits
748 % git fetch
749
750 If you are using `arc` to interact with Phabricator, you need to manually put it
751 at the root of the checkout:
752
753 .. code-block:: console
754
755 % cd $TOP_LEVEL_DIR
756 % cp llvm/.arcconfig ./
757 % mkdir -p .git/info/
758 % echo .arcconfig >> .git/info/exclude
759
760
761 Local LLVM Configuration 574 Local LLVM Configuration
762 ------------------------ 575 ------------------------
763 576
764 Once checked out from the Subversion repository, the LLVM suite source code must 577 Once checked out repository, the LLVM suite source code must be configured
765 be configured before being built. This process uses CMake. 578 before being built. This process uses CMake. Unlinke the normal ``configure``
766 Unlinke the normal ``configure`` script, CMake 579 script, CMake generates the build files in whatever format you request as well
767 generates the build files in whatever format you request as well as various 580 as various ``*.inc`` files, and ``llvm/include/Config/config.h``.
768 ``*.inc`` files, and ``llvm/include/Config/config.h``.
769 581
770 Variables are passed to ``cmake`` on the command line using the format 582 Variables are passed to ``cmake`` on the command line using the format
771 ``-D<variable name>=<value>``. The following variables are some common options 583 ``-D<variable name>=<value>``. The following variables are some common options
772 used by people developing LLVM. 584 used by people developing LLVM.
773 585
786 | | is Debug. | 598 | | is Debug. |
787 +-------------------------+----------------------------------------------------+ 599 +-------------------------+----------------------------------------------------+
788 | CMAKE_INSTALL_PREFIX | Specifies the install directory to target when | 600 | CMAKE_INSTALL_PREFIX | Specifies the install directory to target when |
789 | | running the install action of the build files. | 601 | | running the install action of the build files. |
790 +-------------------------+----------------------------------------------------+ 602 +-------------------------+----------------------------------------------------+
603 | PYTHON_EXECUTABLE | Forces CMake to use a specific Python version by |
604 | | passing a path to a Python interpreter. By default |
605 | | the Python version of the interpreter in your PATH |
606 | | is used. |
607 +-------------------------+----------------------------------------------------+
791 | LLVM_TARGETS_TO_BUILD | A semicolon delimited list controlling which | 608 | LLVM_TARGETS_TO_BUILD | A semicolon delimited list controlling which |
792 | | targets will be built and linked into llc. This is | 609 | | targets will be built and linked into llvm. |
793 | | equivalent to the ``--enable-targets`` option in | 610 | | The default list is defined as |
794 | | the configure script. The default list is defined | 611 | | ``LLVM_ALL_TARGETS``, and can be set to include |
795 | | as ``LLVM_ALL_TARGETS``, and can be set to include |
796 | | out-of-tree targets. The default value includes: | 612 | | out-of-tree targets. The default value includes: |
797 | | ``AArch64, AMDGPU, ARM, BPF, Hexagon, Mips, | 613 | | ``AArch64, AMDGPU, ARM, BPF, Hexagon, Mips, |
798 | | MSP430, NVPTX, PowerPC, Sparc, SystemZ, X86, | 614 | | MSP430, NVPTX, PowerPC, Sparc, SystemZ, X86, |
799 | | XCore``. | 615 | | XCore``. |
616 | | |
800 +-------------------------+----------------------------------------------------+ 617 +-------------------------+----------------------------------------------------+
801 | LLVM_ENABLE_DOXYGEN | Build doxygen-based documentation from the source | 618 | LLVM_ENABLE_DOXYGEN | Build doxygen-based documentation from the source |
802 | | code This is disabled by default because it is | 619 | | code This is disabled by default because it is |
803 | | slow and generates a lot of output. | 620 | | slow and generates a lot of output. |
621 +-------------------------+----------------------------------------------------+
622 | LLVM_ENABLE_PROJECTS | A semicolon-delimited list selecting which of the |
623 | | other LLVM subprojects to additionally build. (Only|
624 | | effective when using a side-by-side project layout |
625 | | e.g. via git). The default list is empty. Can |
626 | | include: clang, libcxx, libcxxabi, libunwind, lldb,|
627 | | compiler-rt, lld, polly, or debuginfo-tests. |
804 +-------------------------+----------------------------------------------------+ 628 +-------------------------+----------------------------------------------------+
805 | LLVM_ENABLE_SPHINX | Build sphinx-based documentation from the source | 629 | LLVM_ENABLE_SPHINX | Build sphinx-based documentation from the source |
806 | | code. This is disabled by default because it is | 630 | | code. This is disabled by default because it is |
807 | | slow and generates a lot of output. Sphinx version | 631 | | slow and generates a lot of output. Sphinx version |
808 | | 1.5 or later recommended. | 632 | | 1.5 or later recommended. |
828 652
829 #. Run the ``cmake``: 653 #. Run the ``cmake``:
830 654
831 .. code-block:: console 655 .. code-block:: console
832 656
833 % cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=prefix=/install/path 657 % cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/install/path
834 [other options] SRC_ROOT 658 [other options] SRC_ROOT
835 659
836 Compiling the LLVM Suite Source Code 660 Compiling the LLVM Suite Source Code
837 ------------------------------------ 661 ------------------------------------
838 662
912 cross-compiling CMake provides a variable ``CMAKE_TOOLCHAIN_FILE`` which can 736 cross-compiling CMake provides a variable ``CMAKE_TOOLCHAIN_FILE`` which can
913 define compiler flags and variables used during the CMake test operations. 737 define compiler flags and variables used during the CMake test operations.
914 738
915 The result of such a build is executables that are not runnable on the build 739 The result of such a build is executables that are not runnable on the build
916 host but can be executed on the target. As an example the following CMake 740 host but can be executed on the target. As an example the following CMake
917 invocation can generate build files targeting iOS. This will work on Mac OS X 741 invocation can generate build files targeting iOS. This will work on macOS
918 with the latest Xcode: 742 with the latest Xcode:
919 743
920 .. code-block:: console 744 .. code-block:: console
921 745
922 % cmake -G "Ninja" -DCMAKE_OSX_ARCHITECTURES="armv7;armv7s;arm64" 746 % cmake -G "Ninja" -DCMAKE_OSX_ARCHITECTURES="armv7;armv7s;arm64"
1020 LLVM. For example, some C++ STL utilities and a Command Line option processing 844 LLVM. For example, some C++ STL utilities and a Command Line option processing
1021 library store header files here. 845 library store header files here.
1022 846
1023 ``llvm/include/llvm/Config`` 847 ``llvm/include/llvm/Config``
1024 848
1025 Header files configured by the ``configure`` script. 849 Header files configured by ``cmake``. They wrap "standard" UNIX and
1026 They wrap "standard" UNIX and C header files. Source code can include these 850 C header files. Source code can include these header files which
1027 header files which automatically take care of the conditional #includes that 851 automatically take care of the conditional #includes that ``cmake``
1028 the ``configure`` script generates. 852 generates.
1029 853
1030 ``llvm/lib`` 854 ``llvm/lib``
1031 ------------ 855 ------------
1032 856
1033 Most source files are here. By putting code in libraries, LLVM makes it easy to 857 Most source files are here. By putting code in libraries, LLVM makes it easy to
1095 are intended to run quickly and cover a lot of territory without being exhaustive. 919 are intended to run quickly and cover a lot of territory without being exhaustive.
1096 920
1097 ``test-suite`` 921 ``test-suite``
1098 -------------- 922 --------------
1099 923
1100 A comprehensive correctness, performance, and benchmarking test suite for LLVM. 924 A comprehensive correctness, performance, and benchmarking test suite
1101 Comes in a separate Subversion module because not every LLVM user is interested 925 for LLVM. This comes in a ``separate git repository
1102 in such a comprehensive suite. For details see the :doc:`Testing Guide 926 <https://github.com/llvm/llvm-test-suite>``, because it contains a
1103 <TestingGuide>` document. 927 large amount of third-party code under a variety of licenses. For
928 details see the :doc:`Testing Guide <TestingGuide>` document.
1104 929
1105 .. _tools: 930 .. _tools:
1106 931
1107 ``llvm/tools`` 932 ``llvm/tools``
1108 -------------- 933 --------------
1195 Performs an ``egrep -H -n`` on each source file in LLVM and 1020 Performs an ``egrep -H -n`` on each source file in LLVM and
1196 passes to it a regular expression provided on ``llvmgrep``'s command 1021 passes to it a regular expression provided on ``llvmgrep``'s command
1197 line. This is an efficient way of searching the source base for a 1022 line. This is an efficient way of searching the source base for a
1198 particular regular expression. 1023 particular regular expression.
1199 1024
1200 ``makellvm``
1201
1202 Compiles all files in the current directory, then
1203 compiles and links the tool that is the first argument. For example, assuming
1204 you are in ``llvm/lib/Target/Sparc``, if ``makellvm`` is in your
1205 path, running ``makellvm llc`` will make a build of the current
1206 directory, switch to directory ``llvm/tools/llc`` and build it, causing a
1207 re-linking of LLC.
1208
1209 ``TableGen/`` 1025 ``TableGen/``
1210 1026
1211 Contains the tool used to generate register 1027 Contains the tool used to generate register
1212 descriptions, instruction set descriptions, and even assemblers from common 1028 descriptions, instruction set descriptions, and even assemblers from common
1213 TableGen description files. 1029 TableGen description files.
1321 write something up!). For more information about LLVM, check out: 1137 write something up!). For more information about LLVM, check out:
1322 1138
1323 * `LLVM Homepage <http://llvm.org/>`_ 1139 * `LLVM Homepage <http://llvm.org/>`_
1324 * `LLVM Doxygen Tree <http://llvm.org/doxygen/>`_ 1140 * `LLVM Doxygen Tree <http://llvm.org/doxygen/>`_
1325 * `Starting a Project that Uses LLVM <http://llvm.org/docs/Projects.html>`_ 1141 * `Starting a Project that Uses LLVM <http://llvm.org/docs/Projects.html>`_
1142
1143 .. _installing arcanist: https://secure.phabricator.com/book/phabricator/article/arcanist_quick_start/