1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/lib/Support/CMakeLists.txt

304 lines
8.7 KiB
CMake
Raw Normal View History

include(GetLibraryName)
# Ensure that libSupport does not carry any static global initializer.
# libSupport can be embedded in use cases where we don't want to load all
# cl::opt unless we want to parse the command line.
# ManagedStatic can be used to enable lazy-initialization of globals.
# We don't use `add_flag_if_supported` as instead of compiling an empty file we
# check if the current platform is able to compile global std::mutex with this
# flag (Linux can, Darwin can't for example).
check_cxx_compiler_flag("-Werror=global-constructors" HAS_WERROR_GLOBAL_CTORS)
if (HAS_WERROR_GLOBAL_CTORS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=global-constructors")
CHECK_CXX_SOURCE_COMPILES("
#include <mutex>
static std::mutex TestGlobalCtorDtor;
static std::recursive_mutex TestGlobalCtorDtor2;
int main() { (void)TestGlobalCtorDtor; (void)TestGlobalCtorDtor2; return 0;}
" LLVM_HAS_NOGLOBAL_CTOR_MUTEX)
if (NOT LLVM_HAS_NOGLOBAL_CTOR_MUTEX)
string(REPLACE "-Werror=global-constructors" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endif()
if(LLVM_ENABLE_ZLIB)
set(imported_libs ZLIB::ZLIB)
endif()
if( MSVC OR MINGW )
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
# advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
set(system_libs ${system_libs} psapi shell32 ole32 uuid advapi32)
elseif( CMAKE_HOST_UNIX )
if( HAVE_LIBRT )
set(system_libs ${system_libs} rt)
endif()
if( HAVE_LIBDL )
set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
endif()
if( HAVE_BACKTRACE AND NOT "${Backtrace_LIBRARIES}" STREQUAL "" )
# On BSDs, CMake returns a fully qualified path to the backtrace library.
# We need to remove the path and the 'lib' prefix, to make it look like a
# regular short library name, suitable for appending to a -l link flag.
get_filename_component(Backtrace_LIBFILE ${Backtrace_LIBRARIES} NAME_WE)
STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE})
set(system_libs ${system_libs} ${Backtrace_LIBFILE})
endif()
if( LLVM_ENABLE_TERMINFO )
set(imported_libs ${imported_libs} "${TERMINFO_LIB}")
endif()
if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) )
set(system_libs ${system_libs} atomic)
endif()
set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
if( UNIX AND NOT (BEOS OR HAIKU) )
set(system_libs ${system_libs} m)
endif()
if( FUCHSIA )
set(system_libs ${system_libs} zircon)
endif()
if ( HAIKU )
add_definitions(-D_BSD_SOURCE)
set(system_libs ${system_libs} bsd)
endif()
endif( MSVC OR MINGW )
# Delay load shell32.dll if possible to speed up process startup.
set (delayload_flags)
if (MSVC)
set (delayload_flags delayimp -delayload:shell32.dll -delayload:ole32.dll)
endif()
# Link Z3 if the user wants to build it.
if(LLVM_WITH_Z3)
set(system_libs ${system_libs} ${Z3_LIBRARIES})
endif()
[Support] On Windows, add optional support for {rpmalloc|snmalloc|mimalloc} This patch optionally replaces the CRT allocator (i.e., malloc and free) with rpmalloc (mixed public domain licence/MIT licence) or snmalloc (MIT licence) or mimalloc (MIT licence). Please note that the source code for these allocators must be available outside of LLVM's tree. To enable, use `cmake ... -DLLVM_INTEGRATED_CRT_ALLOC=D:/git/rpmalloc -DLLVM_USE_CRT_RELEASE=MT` where `D:/git/rpmalloc` has already been git clone'd from `https://github.com/mjansson/rpmalloc`. The same applies to snmalloc and mimalloc. When enabled, the allocator will be embeded (statically linked) into the LLVM tools & libraries. This currently only works with the static CRT (/MT), although using the dynamic CRT (/MD) could potentially work as well in the future. When enabled, this changes the memory stack from: new/delete -> MS VC++ CRT malloc/free -> HeapAlloc -> VirtualAlloc to: new/delete -> {rpmalloc|snmalloc|mimalloc} -> VirtualAlloc The goal of this patch is to bypass the application's global heap - which is thread-safe thus inducing locking - and instead take advantage of a modern lock-free, thread cache, allocator. On a 6-core Xeon Skylake we observe a 2.5x decrease in execution time when linking a large scale application with LLD and ThinLTO (12 min 20 sec -> 5 min 34 sec), when all hardware threads are being used (using LLD's flag /opt:lldltojobs=all). On a dual 36-core Xeon Skylake with all hardware threads used, we observe a 24x decrease in execution time (1 h 2 min -> 2 min 38 sec) when linking a large application with LLD and ThinLTO. Clang build times also see a decrease in the range 5-10% depending on the configuration. Differential Revision: https://reviews.llvm.org/D71786
2020-08-27 17:09:20 +02:00
# Override the C runtime allocator on Windows and embed it into LLVM tools & libraries
if(LLVM_INTEGRATED_CRT_ALLOC)
if (CMAKE_BUILD_TYPE AND NOT ${LLVM_USE_CRT_${uppercase_CMAKE_BUILD_TYPE}} MATCHES "^(MT|MTd)$")
message(FATAL_ERROR "LLVM_INTEGRATED_CRT_ALLOC only works with /MT or /MTd. Use LLVM_USE_CRT_${uppercase_CMAKE_BUILD_TYPE} to set the appropriate option.")
endif()
string(REGEX REPLACE "(/|\\\\)$" "" LLVM_INTEGRATED_CRT_ALLOC "${LLVM_INTEGRATED_CRT_ALLOC}")
if(NOT EXISTS "${LLVM_INTEGRATED_CRT_ALLOC}")
message(FATAL_ERROR "Cannot find the path to `git clone` for the CRT allocator! (${LLVM_INTEGRATED_CRT_ALLOC}). Currently, rpmalloc, snmalloc and mimalloc are supported.")
endif()
if(LLVM_INTEGRATED_CRT_ALLOC MATCHES "rpmalloc$")
add_definitions(-DENABLE_OVERRIDE -DENABLE_PRELOAD)
set(ALLOCATOR_FILES "${LLVM_INTEGRATED_CRT_ALLOC}/rpmalloc/rpmalloc.c")
elseif(LLVM_INTEGRATED_CRT_ALLOC MATCHES "snmalloc$")
set(ALLOCATOR_FILES "${LLVM_INTEGRATED_CRT_ALLOC}/src/override/malloc.cc" "${LLVM_INTEGRATED_CRT_ALLOC}/src/override/new.cc")
set(system_libs ${system_libs} "mincore.lib" "-INCLUDE:malloc")
elseif(LLVM_INTEGRATED_CRT_ALLOC MATCHES "mimalloc$")
set(MIMALLOC_LIB "${LLVM_INTEGRATED_CRT_ALLOC}/out/msvc-x64/Release/mimalloc-static.lib")
if(NOT EXISTS "${MIMALLOC_LIB}")
message(FATAL_ERROR "Cannot find the mimalloc static library. To build it, first apply the patch from https://github.com/microsoft/mimalloc/issues/268 then build the Release x64 target through ${LLVM_INTEGRATED_CRT_ALLOC}\\ide\\vs2019\\mimalloc.sln")
endif()
set(system_libs ${system_libs} "${MIMALLOC_LIB}" "-INCLUDE:malloc")
endif()
endif()
[cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" Summary: Most libraries are defined in the lib/ directory but there are also a few libraries defined in tools/ e.g. libLLVM, libLTO. I'm defining "Component Libraries" as libraries defined in lib/ that may be included in libLLVM.so. Explicitly marking the libraries in lib/ as component libraries allows us to remove some fragile checks that attempt to differentiate between lib/ libraries and tools/ libraires: 1. In tools/llvm-shlib, because llvm_map_components_to_libnames(LIB_NAMES "all") returned a list of all libraries defined in the whole project, there was custom code needed to filter out libraries defined in tools/, none of which should be included in libLLVM.so. This code assumed that any library defined as static was from lib/ and everything else should be excluded. With this change, llvm_map_components_to_libnames(LIB_NAMES, "all") only returns libraries that have been added to the LLVM_COMPONENT_LIBS global cmake property, so this custom filtering logic can be removed. Doing this also fixes the build with BUILD_SHARED_LIBS=ON and LLVM_BUILD_LLVM_DYLIB=ON. 2. There was some code in llvm_add_library that assumed that libraries defined in lib/ would not have LLVM_LINK_COMPONENTS or ARG_LINK_COMPONENTS set. This is only true because libraries defined lib lib/ use LLVMBuild.txt and don't set these values. This code has been fixed now to check if the library has been explicitly marked as a component library, which should now make it easier to remove LLVMBuild at some point in the future. I have tested this patch on Windows, MacOS and Linux with release builds and the following combinations of CMake options: - "" (No options) - -DLLVM_BUILD_LLVM_DYLIB=ON - -DLLVM_LINK_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_LINK_LLVM_DYLIB=ON Reviewers: beanz, smeenai, compnerd, phosek Reviewed By: beanz Subscribers: wuzish, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, mgorny, mehdi_amini, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, dang, Jim, lenary, s.egerton, pzheng, sameer.abuasal, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70179
2019-11-14 06:39:58 +01:00
add_llvm_component_library(LLVMSupport
AArch64TargetParser.cpp
ABIBreak.cpp
ARMTargetParser.cpp
AMDGPUMetadata.cpp
APFixedPoint.cpp
APFloat.cpp
APInt.cpp
APSInt.cpp
ARMBuildAttrs.cpp
ARMAttributeParser.cpp
ARMWinEH.cpp
Allocator.cpp
AutoConvert.cpp
BinaryStreamError.cpp
BinaryStreamReader.cpp
[BinaryStream] Reduce the amount of boiler plate needed to use. Often you have an array and you just want to use it. With the current design, you have to first construct a `BinaryByteStream`, and then create a `BinaryStreamRef` from it. Worse, the `BinaryStreamRef` holds a pointer to the `BinaryByteStream`, so you can't just create a temporary one to appease the compiler, you have to actually hold onto both the `ArrayRef` as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of that. This makes for very cumbersome code, often requiring one to store a `BinaryByteStream` in a class just to circumvent this. At the cost of some added complexity (not exposed to users, but internal to the library), we can do better than this. This patch allows us to construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc). Not only does this reduce the amount of code you have to type and make it more obvious how to use it, but it solves real lifetime issues when it's inconvenient to hold onto a `BinaryByteStream` for a long time. The additional complexity is in the form of an added layer of indirection. Whereas before we simply stored a `BinaryStream*` in the ref, we now store both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`. When the user wants to construct a `BinaryStreamRef` directly from an `ArrayRef` etc, we allocate an internal object that holds ownership over a `BinaryByteStream` and forwards all calls, and store this in the `shared_ptr<>`. This also maintains the ref semantics, as you can copy it by value and references refer to the same underlying stream -- the one being held in the object stored in the `shared_ptr`. Differential Revision: https://reviews.llvm.org/D33293 llvm-svn: 303294
2017-05-17 22:23:31 +02:00
BinaryStreamRef.cpp
BinaryStreamWriter.cpp
BlockFrequency.cpp
BranchProbability.cpp
BuryPointer.cpp
CachePruning.cpp
2009-12-23 18:03:46 +01:00
circular_raw_ostream.cpp
Chrono.cpp
COM.cpp
2017-11-16 01:46:35 +01:00
CodeGenCoverage.cpp
CommandLine.cpp
Compression.cpp
CRC.cpp
ConvertUTF.cpp
ConvertUTFWrapper.cpp
CrashRecoveryContext.cpp
DataExtractor.cpp
Debug.cpp
DebugCounter.cpp
DeltaAlgorithm.cpp
DAGDeltaAlgorithm.cpp
DJB.cpp
ELFAttributeParser.cpp
ELFAttributes.cpp
Error.cpp
2009-07-07 20:52:14 +02:00
ErrorHandling.cpp
ExtensibleRTTI.cpp
FileCollector.cpp
FileUtilities.cpp
FileOutputBuffer.cpp
FoldingSet.cpp
2009-07-14 22:44:17 +02:00
FormattedStream.cpp
FormatVariadic.cpp
GlobPattern.cpp
GraphWriter.cpp
Rewrite LLVM's generalized support library for hashing to follow the API of the proposed standard hashing interfaces (N3333), and to use a modified and tuned version of the CityHash algorithm. Some of the highlights of this change: -- Significantly higher quality hashing algorithm with very well distributed results, and extremely few collisions. Should be close to a checksum for up to 64-bit keys. Very little clustering or clumping of hash codes, to better distribute load on probed hash tables. -- Built-in support for reserved values. -- Simplified API that composes cleanly with other C++ idioms and APIs. -- Better scaling performance as keys grow. This is the fastest algorithm I've found and measured for moderately sized keys (such as show up in some of the uniquing and folding use cases) -- Support for enabling per-execution seeds to prevent table ordering or other artifacts of hashing algorithms to impact the output of LLVM. The seeding would make each run different and highlight these problems during bootstrap. This implementation was tested extensively using the SMHasher test suite, and pased with flying colors, doing better than the original CityHash algorithm even. I've included a unittest, although it is somewhat minimal at the moment. I've also added (or refactored into the proper location) type traits necessary to implement this, and converted users of GeneralHash over. My only immediate concerns with this implementation is the performance of hashing small keys. I've already started working to improve this, and will continue to do so. Currently, the only algorithms faster produce lower quality results, but it is likely there is a better compromise than the current one. Many thanks to Jeffrey Yasskin who did most of the work on the N3333 paper, pair-programmed some of this code, and reviewed much of it. Many thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original authors of CityHash on which this is heavily based, and Austin Appleby who created MurmurHash and the SMHasher test suite. Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for all of the review comments! If there are further comments or concerns, please let me know and I'll jump on 'em. llvm-svn: 151822
2012-03-01 19:55:25 +01:00
Hashing.cpp
InitLLVM.cpp
InstructionCost.cpp
IntEqClasses.cpp
IntervalMap.cpp
ItaniumManglingCanonicalizer.cpp
JSON.cpp
KnownBits.cpp
LEB128.cpp
LineIterator.cpp
Locale.cpp
LockFileManager.cpp
LowLevelType.cpp
ManagedStatic.cpp
MathExtras.cpp
MemAlloc.cpp
MemoryBuffer.cpp
MemoryBufferRef.cpp
MD5.cpp
NativeFormatting.cpp
OptimizedStructLayout.cpp
Optional.cpp
Parallel.cpp
PluginLoader.cpp
2009-03-05 10:19:13 +01:00
PrettyStackTrace.cpp
RandomNumberGenerator.cpp
2009-09-01 19:01:02 +02:00
Regex.cpp
RISCVAttributes.cpp
RISCVAttributeParser.cpp
ScaledNumber.cpp
ScopedPrinter.cpp
SHA1.cpp
SHA256.cpp
Annotate timeline in Instruments with passes and other timed regions. Summary: Instruments is a useful tool for finding performance issues in LLVM but it can be difficult to identify regions of interest on the timeline that we can use to filter the profiler or allocations instrument. Xcode 10 and the latest macOS/iOS/etc. added support for the os_signpost() API which allows us to annotate the timeline with information that's meaningful to LLVM. This patch causes timer start and end events to emit signposts. When used with -time-passes, this causes the passes to be annotated on the Instruments timeline. In addition to visually showing the duration of passes on the timeline, it also allows us to filter the profile and allocations instrument down to an individual pass allowing us to find the issues within that pass without being drowned out by the noise from other parts of the compiler. Using this in conjunction with the Time Profiler (in high frequency mode) and the Allocations instrument is how I found the SparseBitVector that should have been a BitVector and the DenseMap that could be replaced by a sorted vector a couple months ago. I added NamedRegionTimers to TableGen and used the resulting annotations to identify the slow portions of the Register Info Emitter. Some of these were placed according to educated guesses while others were placed according to hot functions from a previous profile. From there I filtered the profile to a slow portion and the aforementioned issues stood out in the profile. To use this feature enable LLVM_SUPPORT_XCODE_SIGNPOSTS in CMake and run the compiler under Instruments with -time-passes like so: instruments -t 'Time Profiler' bin/llc -time-passes -o - input.ll' Then open the resulting trace in Instruments. There was a talk at WWDC 2018 that explained the feature which can be found at https://developer.apple.com/videos/play/wwdc2018/405/ if you'd like to know more about it. Reviewers: bogner Reviewed By: bogner Subscribers: jdoerfert, mgorny, kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D52954 llvm-svn: 354365
2019-02-19 19:18:31 +01:00
Signposts.cpp
SmallPtrSet.cpp
SmallVector.cpp
SourceMgr.cpp
SpecialCaseList.cpp
Statistic.cpp
StringExtras.cpp
StringMap.cpp
StringSaver.cpp
StringRef.cpp
SuffixTree.cpp
SymbolRemappingReader.cpp
SystemUtils.cpp
TarWriter.cpp
TargetParser: FPU/ARCH/EXT parsing refactory - NFC This new class in a global context contain arch-specific knowledge in order to provide LLVM libraries, tools and projects with the ability to understand the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are supported. Current behaviour it to parse from free-text to enum values and back, so that all users can share the same parser and codes. This simplifies a lot both the ASM/Obj streamers in the back-end (where this came from), and the front-end parsers for command line arguments (where this is going to be used next). The previous implementation, using .def/.h includes is deprecated due to its inflexibility to be built without the backend support and for being too cumbersome. As more architectures join this scheme, and as more features of such architectures are added (such as hardware features, type sizes, etc) into a full blown TargetDescription class, having a set of classes is the most sane implementation. The ultimate goal of this refactor both LLVM's and Clang's target description classes into one unique interface, so that we can de-duplicate and standardise the descriptions, as well as make it available for other front-ends, tools, etc. The FPU parsing for command line options in Clang has been converted to use this new library and a number of aliases were added for compatibility: * A bogus neon-vfpv3 alias (neon defaults to vfp3) * armv5/v6 * {fp4/fp5}-{sp/dp}-d16 Next steps: * Port Clang's ARCH/EXT parsing to use this library. * Create a TableGen back-end to generate this information. * Run this TableGen process regardless of which back-ends are built. * Expose more information and rename it to TargetDescription. * Continue re-factoring Clang to use as much of it as possible. llvm-svn: 236900
2015-05-08 23:04:27 +02:00
TargetParser.cpp
ThreadPool.cpp
TimeProfiler.cpp
Timer.cpp
2010-10-08 01:12:15 +02:00
ToolOutputFile.cpp
TrigramIndex.cpp
Triple.cpp
2009-07-24 09:04:49 +02:00
Twine.cpp
Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed. In order to bring up scalable vector support in LLVM incrementally, we introduced behaviour to emit a warning, instead of an error, when asking the wrong question of a scalable vector, like asking for the fixed number of elements. This patch puts that behaviour under a flag. The default behaviour is that the compiler will always error, which means that all LLVM unit tests and regression tests will now fail when a code-path is taken that still uses the wrong interface. The behaviour to demote an error to a warning can be individually enabled for tools that want to support experimental use of scalable vectors. This patch enables that behaviour when driving compilation from Clang. This means that for users who want to try out scalable-vector support, fixed-width codegen support, or build user-code with scalable vector intrinsics, Clang will not crash and burn when the compiler encounters such a case. This allows us to do away with the following pattern in many of the SVE tests: RUN: .... 2>%t RUN: cat %t | FileCheck --check-prefix=WARN WARN-NOT: warning: ... The behaviour to emit warnings is only temporary and we expect this flag to be removed in the future when scalable vector support is more stable. This patch also has fixes the following tests: unittests: ScalableVectorMVTsTest.SizeQueries SelectionDAGAddressAnalysisTest.unknownSizeFrameObjects AArch64SelectionDAGTest.computeKnownBitsSVE_ZERO_EXTEND_VECTOR_INREG regression tests: Transforms/InstCombine/vscale_gep.ll Reviewed By: paulwalker-arm, ctetreau Differential Revision: https://reviews.llvm.org/D98856
2021-03-17 22:35:09 +01:00
TypeSize.cpp
Unicode.cpp
Resubmit r325107 (case folding DJB hash) The issue was that the has function was generating different results depending on the signedness of char on the host platform. This commit fixes the issue by explicitly using an unsigned char type to prevent sign extension and adds some extra tests. The original commit message was: This patch implements a variant of the DJB hash function which folds the input according to the algorithm in the Dwarf 5 specification (Section 6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18, "Case Mappings"). To achieve this, I have added a llvm::sys::unicode::foldCharSimple function, which performs this mapping. The implementation of this function was generated from the CaseMatching.txt file from the Unicode spec using a python script (which is also included in this patch). The script tries to optimize the function by coalescing adjecant mappings with the same shift and stride (terms I made up). Theoretically, it could be made a bit smarter and merge adjecant blocks that were interrupted by only one or two characters with exceptional mapping, but this would save only a couple of branches, while it would greatly complicate the implementation, so I deemed it was not worth it. Since we assume that the vast majority of the input characters will be US-ASCII, the folding hash function has a fast-path for handling these, and only whips out the full decode+fold+encode logic if we encounter a character outside of this range. It might be possible to implement the folding directly on utf8 sequences, but this would also bring a lot of complexity for the few cases where we will actually need to process non-ascii characters. Reviewers: JDevlieghere, aprantl, probinson, dblaikie Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits Differential Revision: https://reviews.llvm.org/D42740 llvm-svn: 325732
2018-02-21 23:36:31 +01:00
UnicodeCaseFold.cpp
VersionTuple.cpp
VirtualFileSystem.cpp
WithColor.cpp
X86TargetParser.cpp
YAMLParser.cpp
YAMLTraits.cpp
raw_os_ostream.cpp
raw_ostream.cpp
regcomp.c
regerror.c
regexec.c
regfree.c
regstrlcpy.c
xxhash.cpp
Z3Solver.cpp
[Support] On Windows, add optional support for {rpmalloc|snmalloc|mimalloc} This patch optionally replaces the CRT allocator (i.e., malloc and free) with rpmalloc (mixed public domain licence/MIT licence) or snmalloc (MIT licence) or mimalloc (MIT licence). Please note that the source code for these allocators must be available outside of LLVM's tree. To enable, use `cmake ... -DLLVM_INTEGRATED_CRT_ALLOC=D:/git/rpmalloc -DLLVM_USE_CRT_RELEASE=MT` where `D:/git/rpmalloc` has already been git clone'd from `https://github.com/mjansson/rpmalloc`. The same applies to snmalloc and mimalloc. When enabled, the allocator will be embeded (statically linked) into the LLVM tools & libraries. This currently only works with the static CRT (/MT), although using the dynamic CRT (/MD) could potentially work as well in the future. When enabled, this changes the memory stack from: new/delete -> MS VC++ CRT malloc/free -> HeapAlloc -> VirtualAlloc to: new/delete -> {rpmalloc|snmalloc|mimalloc} -> VirtualAlloc The goal of this patch is to bypass the application's global heap - which is thread-safe thus inducing locking - and instead take advantage of a modern lock-free, thread cache, allocator. On a 6-core Xeon Skylake we observe a 2.5x decrease in execution time when linking a large scale application with LLD and ThinLTO (12 min 20 sec -> 5 min 34 sec), when all hardware threads are being used (using LLD's flag /opt:lldltojobs=all). On a dual 36-core Xeon Skylake with all hardware threads used, we observe a 24x decrease in execution time (1 h 2 min -> 2 min 38 sec) when linking a large application with LLD and ThinLTO. Clang build times also see a decrease in the range 5-10% depending on the configuration. Differential Revision: https://reviews.llvm.org/D71786
2020-08-27 17:09:20 +02:00
${ALLOCATOR_FILES}
# System
Atomic.cpp
DynamicLibrary.cpp
Errno.cpp
Host.cpp
Memory.cpp
Path.cpp
Process.cpp
Program.cpp
RWMutex.cpp
Signals.cpp
TargetRegistry.cpp
ThreadLocal.cpp
Threading.cpp
Valgrind.cpp
Watchdog.cpp
Teach llvm_add_library() to find include dirs. Since header files are not compilation units, CMake does not require you to specify them in the CMakeLists.txt file. As a result, unless a header file is explicitly added, CMake won't know about it, and when generating IDE-based projects, CMake won't put the header files into the IDE project. LLVM currently tries to deal with this in two ways: 1) It looks for all .h files that are in the project directory, and adds those. 2) llvm_add_library() understands the ADDITIONAL_HEADERS argument, which allows one to list an arbitrary list of headers. This patch takes things one step further. It adds the ability for llvm_add_library() to take an ADDITIONAL_HEADER_DIRS argument, which will specify a list of folders which CMake will glob for header files. Furthermore, it will glob not only for .h files, but also for .inc files. Included in this CL is an update to one of the existing users of ADDITIONAL_HEADERS to use this new argument instead, to serve as an illustration of how this cleans up the CMake. The big advantage of this new approach is that until now, there was no way for the IDE projects to locate the header files that are in the include tree. In other words, if you are in, for example, lib/DebugInfo/DWARF, the corresponding includes for this project will be located under include/llvm/DebugInfo/DWARF. Now, in the CMakeLists.txt for lib/DebugInfo/DWARF, you can simply write: ADDITIONAL_HEADER_DIRS ../../include/llvm/DebugInfo/DWARF as an argument to llvm_add_library(), and all header files will get added to the IDE project. Differential Revision: http://reviews.llvm.org/D7460 Reviewed By: Chris Bieneman llvm-svn: 228670
2015-02-10 06:04:37 +01:00
ADDITIONAL_HEADER_DIRS
Unix
Windows
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
${Backtrace_INCLUDE_DIRS}
LINK_LIBS
${system_libs} ${imported_libs} ${delayload_flags}
LINK_COMPONENTS
Demangle
)
set(llvm_system_libs ${system_libs})
# This block is only needed for llvm-config. When we deprecate llvm-config and
# move to using CMake export, this block can be removed.
if(LLVM_ENABLE_ZLIB)
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
endif()
if(NOT zlib_library)
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
endif()
get_library_name(${zlib_library} zlib_library)
set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
endif()
if(LLVM_ENABLE_TERMINFO)
get_library_name(${TERMINFO_LIB} terminfo_library)
set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}")
endif()
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}")
if(LLVM_INTEGRATED_CRT_ALLOC)
if(LLVM_INTEGRATED_CRT_ALLOC MATCHES "snmalloc$")
set_property(TARGET LLVMSupport PROPERTY CXX_STANDARD 17)
add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND
"${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64")
set_property(TARGET LLVMSupport PROPERTY COMPILE_FLAGS "-mcx16")
endif()
endif()
endif()
if(LLVM_WITH_Z3)
target_include_directories(LLVMSupport SYSTEM
PRIVATE
${Z3_INCLUDE_DIR}
)
endif()