Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake (revision 127564)
+++ cmake/modules/HandleLLVMOptions.cmake (working copy)
@@ -102,6 +102,29 @@
endif( LLVM_BUILD_32_BITS )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
+option(LLVM_ALWAYS_OPTIMIZE_UTILS
+ "Always uses optimized utilities even in debug builds. This decreases build time but decreases debugability for the utilities. Default is 0."
+ OFF)
+
+if( LLVM_ALWAYS_OPTIMIZE_UTILS )
+ set(LLVM_UTILS_SUPPORT_LIB_NAME LLVMSupportRelease)
+ message(STATUS "Utilities always compiled with optimizations enabled")
+ macro(fix_utils_compile_options)
+ if( MSVC )
+ # Enable debug info for MSVC
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE} /Zi")
+ else()
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_RELEASE}")
+ endif()
+ endmacro(fix_utils_compile_options)
+else( LLVM_ALWAYS_OPTIMIZE_UTILS )
+ set(LLVM_UTILS_SUPPORT_LIB_NAME LLVMSupport)
+ macro(fix_utils_compile_options)
+ endmacro(fix_utils_compile_options)
+endif( LLVM_ALWAYS_OPTIMIZE_UTILS )
+
if( MSVC_IDE AND ( MSVC90 OR MSVC10 ) )
# Only Visual Studio 2008 and 2010 officially supports /MP.
# Visual Studio 2005 do support it but it's experimental there.
Index: docs/CMake.html
===================================================================
--- docs/CMake.html (revision 127564)
+++ docs/CMake.html (working copy)
@@ -350,6 +350,11 @@
Function Interface library. If the library or its headers are
installed on a custom location, you can set the variables
FFI_INCLUDE_DIR and FFI_LIBRARY_DIR. Defaults to OFF.
+
+
LLVM_ALWAYS_OPTIMIZE_UTILS:BOOL
+ Always uses optimized utilities even in debug builds. This
+ decreases build time but also decreases debugability for the
+ utilities. Defaults to OFF.
Index: lib/Support/CMakeLists.txt
===================================================================
--- lib/Support/CMakeLists.txt (revision 127564)
+++ lib/Support/CMakeLists.txt (working copy)
@@ -4,100 +4,110 @@
set(LLVM_REQUIRES_EH 1)
endif()
-add_llvm_library(LLVMSupport
- APFloat.cpp
- APInt.cpp
- APSInt.cpp
- Allocator.cpp
- circular_raw_ostream.cpp
- CommandLine.cpp
- ConstantRange.cpp
- CrashRecoveryContext.cpp
- Debug.cpp
- DeltaAlgorithm.cpp
- DAGDeltaAlgorithm.cpp
- Dwarf.cpp
- ErrorHandling.cpp
- FileUtilities.cpp
- FoldingSet.cpp
- FormattedStream.cpp
- GraphWriter.cpp
- IntEqClasses.cpp
- IntervalMap.cpp
- IsInf.cpp
- IsNAN.cpp
- ManagedStatic.cpp
- MemoryBuffer.cpp
- MemoryObject.cpp
- PluginLoader.cpp
- PrettyStackTrace.cpp
- Regex.cpp
- SmallPtrSet.cpp
- SmallVector.cpp
- SourceMgr.cpp
- Statistic.cpp
- StringExtras.cpp
- StringMap.cpp
- StringPool.cpp
- StringRef.cpp
- SystemUtils.cpp
- TargetRegistry.cpp
- Timer.cpp
- ToolOutputFile.cpp
- Triple.cpp
- Twine.cpp
- raw_os_ostream.cpp
- raw_ostream.cpp
- regcomp.c
- regerror.c
- regexec.c
- regfree.c
- regstrlcpy.c
+#This macro is used both from this file and SupportRelease\CMakeLists.txt with the intention that both targets should have the same files but different compile options
+macro(add_llvm_support_library prefix name)
+ add_llvm_library(${name}
+ ${prefix}APFloat.cpp
+ ${prefix}APInt.cpp
+ ${prefix}APSInt.cpp
+ ${prefix}Allocator.cpp
+ ${prefix}circular_raw_ostream.cpp
+ ${prefix}CommandLine.cpp
+ ${prefix}ConstantRange.cpp
+ ${prefix}CrashRecoveryContext.cpp
+ ${prefix}Debug.cpp
+ ${prefix}DeltaAlgorithm.cpp
+ ${prefix}DAGDeltaAlgorithm.cpp
+ ${prefix}Dwarf.cpp
+ ${prefix}ErrorHandling.cpp
+ ${prefix}FileUtilities.cpp
+ ${prefix}FoldingSet.cpp
+ ${prefix}FormattedStream.cpp
+ ${prefix}GraphWriter.cpp
+ ${prefix}IntEqClasses.cpp
+ ${prefix}IntervalMap.cpp
+ ${prefix}IsInf.cpp
+ ${prefix}IsNAN.cpp
+ ${prefix}ManagedStatic.cpp
+ ${prefix}MemoryBuffer.cpp
+ ${prefix}MemoryObject.cpp
+ ${prefix}PluginLoader.cpp
+ ${prefix}PrettyStackTrace.cpp
+ ${prefix}Regex.cpp
+ ${prefix}SmallPtrSet.cpp
+ ${prefix}SmallVector.cpp
+ ${prefix}SourceMgr.cpp
+ ${prefix}Statistic.cpp
+ ${prefix}StringExtras.cpp
+ ${prefix}StringMap.cpp
+ ${prefix}StringPool.cpp
+ ${prefix}StringRef.cpp
+ ${prefix}SystemUtils.cpp
+ ${prefix}TargetRegistry.cpp
+ ${prefix}Timer.cpp
+ ${prefix}ToolOutputFile.cpp
+ ${prefix}Triple.cpp
+ ${prefix}Twine.cpp
+ ${prefix}raw_os_ostream.cpp
+ ${prefix}raw_ostream.cpp
+ ${prefix}regcomp.c
+ ${prefix}regerror.c
+ ${prefix}regexec.c
+ ${prefix}regfree.c
+ ${prefix}regstrlcpy.c
-# System
- Atomic.cpp
- Disassembler.cpp
- DynamicLibrary.cpp
- Errno.cpp
- Host.cpp
- IncludeFile.cpp
- Memory.cpp
- Mutex.cpp
- Path.cpp
- PathV2.cpp
- Process.cpp
- Program.cpp
- RWMutex.cpp
- SearchForAddressOfSpecialSymbol.cpp
- Signals.cpp
- system_error.cpp
- ThreadLocal.cpp
- Threading.cpp
- TimeValue.cpp
- Valgrind.cpp
- Unix/Host.inc
- Unix/Memory.inc
- Unix/Mutex.inc
- Unix/Path.inc
- Unix/PathV2.inc
- Unix/Process.inc
- Unix/Program.inc
- Unix/RWMutex.inc
- Unix/Signals.inc
- Unix/system_error.inc
- Unix/ThreadLocal.inc
- Unix/TimeValue.inc
- Windows/DynamicLibrary.inc
- Windows/Host.inc
- Windows/Memory.inc
- Windows/Mutex.inc
- Windows/Path.inc
- Windows/PathV2.inc
- Windows/Process.inc
- Windows/Program.inc
- Windows/RWMutex.inc
- Windows/Signals.inc
- Windows/system_error.inc
- Windows/ThreadLocal.inc
- Windows/TimeValue.inc
- )
+ # System
+ ${prefix}Atomic.cpp
+ ${prefix}Disassembler.cpp
+ ${prefix}DynamicLibrary.cpp
+ ${prefix}Errno.cpp
+ ${prefix}Host.cpp
+ ${prefix}IncludeFile.cpp
+ ${prefix}Memory.cpp
+ ${prefix}Mutex.cpp
+ ${prefix}Path.cpp
+ ${prefix}PathV2.cpp
+ ${prefix}Process.cpp
+ ${prefix}Program.cpp
+ ${prefix}RWMutex.cpp
+ ${prefix}SearchForAddressOfSpecialSymbol.cpp
+ ${prefix}Signals.cpp
+ ${prefix}system_error.cpp
+ ${prefix}ThreadLocal.cpp
+ ${prefix}Threading.cpp
+ ${prefix}TimeValue.cpp
+ ${prefix}Valgrind.cpp
+ ${prefix}Unix/Host.inc
+ ${prefix}Unix/Memory.inc
+ ${prefix}Unix/Mutex.inc
+ ${prefix}Unix/Path.inc
+ ${prefix}Unix/PathV2.inc
+ ${prefix}Unix/Process.inc
+ ${prefix}Unix/Program.inc
+ ${prefix}Unix/RWMutex.inc
+ ${prefix}Unix/Signals.inc
+ ${prefix}Unix/system_error.inc
+ ${prefix}Unix/ThreadLocal.inc
+ ${prefix}Unix/TimeValue.inc
+ ${prefix}Windows/DynamicLibrary.inc
+ ${prefix}Windows/Host.inc
+ ${prefix}Windows/Memory.inc
+ ${prefix}Windows/Mutex.inc
+ ${prefix}Windows/Path.inc
+ ${prefix}Windows/PathV2.inc
+ ${prefix}Windows/Process.inc
+ ${prefix}Windows/Program.inc
+ ${prefix}Windows/RWMutex.inc
+ ${prefix}Windows/Signals.inc
+ ${prefix}Windows/system_error.inc
+ ${prefix}Windows/ThreadLocal.inc
+ ${prefix}Windows/TimeValue.inc
+ )
+endmacro(add_llvm_support_library name)
+
+add_llvm_support_library("" LLVMSupport)
+
+if( LLVM_ALWAYS_OPTIMIZE_UTILS )
+ add_subdirectory(SupportRelease)
+endif()
+
\ No newline at end of file
Index: lib/Support/SupportRelease/CMakeLists.txt
===================================================================
--- lib/Support/SupportRelease/CMakeLists.txt (revision 0)
+++ lib/Support/SupportRelease/CMakeLists.txt (revision 0)
@@ -0,0 +1,9 @@
+## FIXME: This only requires RTTI because tblgen uses it. Fix that.
+set(LLVM_REQUIRES_RTTI 1)
+if( MINGW )
+ set(LLVM_REQUIRES_EH 1)
+endif()
+
+fix_utils_compile_options()
+
+add_llvm_support_library("../" LLVMSupportRelease)
Index: utils/FileCheck/CMakeLists.txt
===================================================================
--- utils/FileCheck/CMakeLists.txt (revision 127564)
+++ utils/FileCheck/CMakeLists.txt (working copy)
@@ -1,3 +1,6 @@
+
+fix_utils_compile_options()
+
add_llvm_utility(FileCheck
FileCheck.cpp
)
@@ -2,3 +5,3 @@
-target_link_libraries(FileCheck LLVMSupport)
+target_link_libraries(FileCheck ${LLVM_UTILS_SUPPORT_LIB_NAME})
if( MINGW )
Index: utils/FileUpdate/CMakeLists.txt
===================================================================
--- utils/FileUpdate/CMakeLists.txt (revision 127564)
+++ utils/FileUpdate/CMakeLists.txt (working copy)
@@ -1,3 +1,6 @@
+
+fix_utils_compile_options()
+
add_llvm_utility(FileUpdate
FileUpdate.cpp
)
@@ -2,3 +5,3 @@
-target_link_libraries(FileUpdate LLVMSupport)
+target_link_libraries(FileUpdate ${LLVM_UTILS_SUPPORT_LIB_NAME})
if( MINGW )
Index: utils/GenLibDeps.pl
===================================================================
--- utils/GenLibDeps.pl (revision 127564)
+++ utils/GenLibDeps.pl (working copy)
@@ -276,7 +276,9 @@
for my $key (sort keys %DepLibs) {
if ($FLAT) {
- print " $key";
+ my $replaceddep = $key;
+ $replaceddep =~ s/LLVMSupportRelease/LLVMSupport/;
+ print " $replaceddep";
if ($WHY) {
print "\n";
my @syms = @{$DepLibs{$key}};
Index: utils/KillTheDoctor/CMakeLists.txt
===================================================================
--- utils/KillTheDoctor/CMakeLists.txt (revision 127564)
+++ utils/KillTheDoctor/CMakeLists.txt (working copy)
@@ -1,3 +1,6 @@
+
+fix_utils_compile_options()
+
add_llvm_utility(KillTheDoctor
KillTheDoctor.cpp
)
@@ -2,2 +5,2 @@
-target_link_libraries(KillTheDoctor LLVMSupport)
+target_link_libraries(KillTheDoctor ${LLVM_UTILS_SUPPORT_LIB_NAME})
Index: utils/not/CMakeLists.txt
===================================================================
--- utils/not/CMakeLists.txt (revision 127564)
+++ utils/not/CMakeLists.txt (working copy)
@@ -1,3 +1,6 @@
+
+fix_utils_compile_options()
+
add_llvm_utility(not
not.cpp
)
@@ -2,3 +5,3 @@
-target_link_libraries(not LLVMSupport)
+target_link_libraries(not ${LLVM_UTILS_SUPPORT_LIB_NAME})
if( MINGW )
Index: utils/TableGen/CMakeLists.txt
===================================================================
--- utils/TableGen/CMakeLists.txt (revision 127564)
+++ utils/TableGen/CMakeLists.txt (working copy)
@@ -3,6 +3,8 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
+fix_utils_compile_options()
+
add_llvm_utility(tblgen
ARMDecoderEmitter.cpp
AsmMatcherEmitter.cpp
@@ -45,7 +47,7 @@
X86RecognizableInstr.cpp
)
-target_link_libraries(tblgen LLVMSupport)
+target_link_libraries(tblgen ${LLVM_UTILS_SUPPORT_LIB_NAME})
if( MINGW )
target_link_libraries(tblgen imagehlp psapi)
endif( MINGW )