[PATCH] Add new LLVM_OPTIMIZED_TABLEGEN build setting which configures, builds and uses a release tablegen build when LLVM is configured with assertions enabled.

Chris Bieneman beanz at apple.com
Tue Mar 10 13:35:25 PDT 2015


Updating to reflect Justin's feedback. The non-cross compiling specific code is now gated on LLVM_USE_HOST_TOOLS instead of CMAKE_CROSSCOMPILING. This has the pleasent side effect of having LLVM_OPTIMIZED_TABLEGEN not generate optimized llvm-config along with the optimized tablegen.


http://reviews.llvm.org/D7349

Files:
  CMakeLists.txt
  cmake/modules/TableGen.cmake

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -350,6 +350,11 @@
   set(DISABLE_LLVM_DYLIB_ATEXIT 1)
 endif()
 
+option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF)
+if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND LLVM_ENABLE_ASSERTIONS))
+  set(LLVM_USE_HOST_TOOLS ON)
+endif()
+
 # All options referred to from HandleLLVMOptions have to be specified
 # BEFORE this include, otherwise options will not be correctly set on
 # first cmake run
@@ -536,9 +541,9 @@
 include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
 
 # when crosscompiling import the executable targets from a file
-if(CMAKE_CROSSCOMPILING)
+if(LLVM_USE_HOST_TOOLS)
   include(CrossCompile)
-endif(CMAKE_CROSSCOMPILING)
+endif(LLVM_USE_HOST_TOOLS)
 
 if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD )
   # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM
Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -91,7 +91,7 @@
   # Effective tblgen executable to be used:
   set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)
 
-  if(CMAKE_CROSSCOMPILING)
+  if(LLVM_USE_HOST_TOOLS)
     if( ${${project}_TABLEGEN} STREQUAL "${target}" )
       set(${project}_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/bin/${target}")
       set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE)

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7349.21627.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150310/c7d6ceaf/attachment.bin>


More information about the llvm-commits mailing list