Skip to content

Commit 95a2aec

Browse files
committed
[docs] Add/update docs regarding LLVM_NATIVE_TOOL_DIR vs LLVM_TABLEGEN
Differential Revision: https://reviews.llvm.org/D142349
1 parent ebfd09d commit 95a2aec

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

llvm/docs/CMake.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,13 @@ enabled sub-projects. Nearly all of these variable names begin with
698698
%PATH%, then you can set this variable to the GnuWin32 directory so that
699699
lit can find tools needed for tests in that directory.
700700

701+
**LLVM_NATIVE_TOOL_DIR**:STRING
702+
Full path to a directory containing executables for the build host
703+
(containing binaries such as ``llvm-tblgen`` and ``clang-tblgen``). This is
704+
intended for cross-compiling: if the user sets this variable and the
705+
directory contains executables with the expected names, no separate
706+
native versions of those executables will be built.
707+
701708
**LLVM_OPTIMIZED_TABLEGEN**:BOOL
702709
If enabled and building a debug or asserts build the CMake build system will
703710
generate a Release build tree to build a fully optimized tablegen for use

llvm/docs/HowToBuildWithPGO.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ If this worked well for you and you plan on doing it often, there's a slight
165165
optimization that can be made: LLVM and Clang have a tool called tblgen that's
166166
built and run during the build process. While it's potentially nice to build
167167
this for coverage as part of step 3, none of your other builds should benefit
168-
from building it. You can pass the CMake options
169-
``-DCLANG_TABLEGEN=/path/to/stage1/bin/clang-tblgen
170-
-DLLVM_TABLEGEN=/path/to/stage1/bin/llvm-tblgen`` to steps 2 and onward to avoid
171-
these useless rebuilds.
168+
from building it. You can pass the CMake option
169+
``-DLLVM_NATIVE_TOOL_DIR=/path/to/stage1/bin``
170+
to steps 2 and onward to avoid these useless rebuilds.

llvm/docs/HowToCrossCompileLLVM.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ The CMake options you need to add are:
4242

4343
* ``-DCMAKE_SYSTEM_NAME=<target-system>``
4444
* ``-DCMAKE_INSTALL_PREFIX=<install-dir>``
45-
* ``-DLLVM_TABLEGEN=<path-to-host-bin>/llvm-tblgen``
46-
* ``-DCLANG_TABLEGEN=<path-to-host-bin>/clang-tblgen``
45+
* ``-DLLVM_NATIVE_TOOL_DIR=<path-to-host-bin>``
4746
* ``-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf``
4847
* ``-DLLVM_TARGET_ARCH=ARM``
4948
* ``-DLLVM_TARGETS_TO_BUILD=ARM``
@@ -66,9 +65,12 @@ In addition to the ones above, you'll also need:
6665
* Appropriate use of ``-I`` and ``-L``, depending on how the cross GCC is installed,
6766
and where are the libraries and headers.
6867

69-
The TableGen options are required to compile it with the host compiler,
70-
so you'll need to compile LLVM (or at least ``llvm-tblgen``) to your host
71-
platform before you start. The CXX flags define the target, cpu (which in this case
68+
The ``LLVM_NATIVE_TOOL_DIR`` option allows you to reuse prebuilt binaries
69+
(``llvm-tblgen``, ``clang-tblgen`` etc) for the build host, if such are
70+
available. If that's not available, the LLVM cross build will automatically
71+
launch a nested build to build the tools that are required.
72+
73+
The CXX flags define the target, cpu (which in this case
7274
defaults to ``fpu=VFP3`` with NEON), and forcing the hard-float ABI. If you're
7375
using Clang as a cross-compiler, you will *also* have to set ``--sysroot``
7476
to make sure it picks the correct linker.

0 commit comments

Comments
 (0)