llvm-project/llvm/lib/Support
Reid Kleckner 270d3faf6e [COFF] Add and use a zero-copy tokenizer for .drectve
This generalizes the main Windows command line tokenizer to be able to
produce StringRef substrings as well as freshly copied C strings. The
implementation is still shared with the normal tokenizer, which is
important, because we have unit tests for that.

.drective sections can be very long. They can potentially list up to
every symbol in the object file by name. It is worth avoiding these
string copies.

This saves a lot of memory when linking chrome.dll with PGO
instrumentation:

             BEFORE      AFTER      % IMP
peak memory: 6657.76MB   4983.54MB  -25%
real:        4m30.875s   2m26.250s  -46%

The time improvement may not be real, my machine was noisy while running
this, but that the peak memory usage improvement should be real.

This change may also help apps that heavily use dllexport annotations,
because those also use linker directives in object files. Apps that do
not use many directives are unlikely to be affected.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D79262
2020-05-02 10:47:02 -07:00
..
Unix Reland "Add a facility to get system cache directory and use it in clangd" 2020-04-29 00:56:36 +02:00
Windows Reland "Add a facility to get system cache directory and use it in clangd" 2020-04-29 00:56:36 +02:00
AArch64TargetParser.cpp [PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support 2020-03-26 09:17:20 +00:00
ABIBreak.cpp Move LLVM_ENABLE_ABI_BREAKING_CHECKS variables to their own file 2019-09-10 22:05:01 +00:00
AMDGPUMetadata.cpp [AMDGPU] add support for hostcall buffer pointer as hidden kernel argument 2019-11-20 15:53:55 +05:30
APFloat.cpp [FPEnv] Use single enum to represent rounding mode 2020-04-09 13:26:47 +07:00
APInt.cpp [ADT] Mix the bit width into APInt's hash_value 2020-04-14 18:16:15 +02:00
APSInt.cpp Explicitly include <cassert> when using assert 2020-03-02 22:45:28 +01:00
ARMAttributeParser.cpp [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
ARMBuildAttrs.cpp [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
ARMTargetParser.cpp [PATCH] [ARM] ARMv8.6-a command-line + BFloat16 Asm Support 2020-03-26 09:17:20 +00:00
ARMWinEH.cpp
Allocator.cpp Revert "[Support] Explicitly instantiate BumpPtrAllocatorImpl" 2020-01-18 09:33:00 -08:00
Atomic.cpp
BinaryStreamError.cpp
BinaryStreamReader.cpp BinaryStream - fix static analyzer warnings. NFCI. 2019-11-08 13:20:24 +00:00
BinaryStreamRef.cpp
BinaryStreamWriter.cpp
BlockFrequency.cpp
BranchProbability.cpp Make some static class members constexpr 2020-04-22 12:25:01 +02:00
BuryPointer.cpp
CMakeLists.txt [ADT] Move allocate_buffer to MemAlloc.h and out of line 2020-04-24 13:32:50 +02:00
COM.cpp
COPYRIGHT.regex
CRC.cpp Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
CachePruning.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
Chrono.cpp
CodeGenCoverage.cpp Introduce llvm::sys::Process::getProcessId() and adopt it 2020-04-16 15:05:37 +03:00
CommandLine.cpp [COFF] Add and use a zero-copy tokenizer for .drectve 2020-05-02 10:47:02 -07:00
Compression.cpp Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
ConvertUTF.cpp
ConvertUTFWrapper.cpp [Support] Remove byte swapping from MathExtras.h 2020-02-27 17:23:48 -08:00
CrashRecoveryContext.cpp llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
DAGDeltaAlgorithm.cpp
DJB.cpp Revert "Forward declare Optional<T> in STLExtras.h" 2019-11-13 16:36:21 -08:00
DataExtractor.cpp [llvm/Support] Make more DataExtractor methods error-aware 2020-04-06 14:14:11 +02:00
Debug.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
DebugCounter.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
DeltaAlgorithm.cpp
DynamicLibrary.cpp
ELFAttributeParser.cpp [RISCV] Support RISC-V ELF attributes sections in llvm-readobj. 2020-04-01 21:50:11 +08:00
ELFAttributes.cpp [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
Errno.cpp
Error.cpp [Error] Remove a broken code fragment accidentally included in 76bcbaafab. 2019-11-20 17:50:22 -08:00
ErrorHandling.cpp Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""" 2020-02-13 10:16:06 -08:00
ExtensibleRTTI.cpp [Support] Add missing files from e823068306. 2020-04-13 13:30:45 -07:00
FileCheck.cpp [FileCheck] - Refactor the code related to string arrays. NFCI. 2020-04-20 14:54:49 +03:00
FileCheckImpl.h FileCheckImpl.h - remove unnecessary FileCheckDiag forward declaration. NFC. 2020-04-24 13:27:57 +01:00
FileCollector.cpp [FileCollector] move Root creation 2020-04-29 11:47:23 -07:00
FileOutputBuffer.cpp [LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap 2019-10-29 15:49:08 -07:00
FileUtilities.cpp std::isspace -> llvm::isSpace (where locale should be ignored) 2020-05-02 15:36:04 +02:00
FoldingSet.cpp Remove vptr dispatch from FoldingSet. 2020-04-15 17:39:35 -07:00
FormatVariadic.cpp [FormatVariadic] Reduce allocations 2020-04-11 14:54:32 +02:00
FormattedStream.cpp Revert "[llvm-objdump] Display locations of variables alongside disassembly" 2020-03-16 14:04:25 -04:00
GlobPattern.cpp Reapply r375051: [support] GlobPattern: add support for `\` and `[!...]`, and allow `]` in more places 2019-10-17 18:09:05 +00:00
GraphWriter.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Hashing.cpp
Host.cpp [Support][X86] Include sched.h after D78324 2020-04-17 08:46:27 -07:00
InitLLVM.cpp llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
IntEqClasses.cpp Explicitly include <cassert> when using assert 2020-03-02 22:45:28 +01:00
IntervalMap.cpp Explicitly include <cassert> when using assert 2020-03-02 22:45:28 +01:00
ItaniumManglingCanonicalizer.cpp Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
JSON.cpp Revert "Remove redundant "std::move"s in return statements" 2020-02-10 07:07:40 -08:00
KnownBits.cpp [KnownBits] Move AND, OR and XOR logic into KnownBits 2020-04-09 10:10:37 +01:00
LEB128.cpp
LLVMBuild.txt
LineIterator.cpp
Locale.cpp
LockFileManager.cpp Introduce llvm::sys::Process::getProcessId() and adopt it 2020-04-16 15:05:37 +03:00
LowLevelType.cpp
MD5.cpp Avoid SmallString.h include in MD5.h, NFC 2020-02-26 09:10:24 -08:00
ManagedStatic.cpp [Support] Replace sys::Mutex with their standard equivalents. 2019-08-19 19:49:57 +00:00
MathExtras.cpp
MemAlloc.cpp Replicate attributes on definition to make MSVC less noisy 2020-04-25 02:02:00 +02:00
Memory.cpp
MemoryBuffer.cpp [Clang] Expose RequiresNullTerminator in FileManager. 2020-04-15 14:17:51 -07:00
NativeFormatting.cpp Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
OptimizedStructLayout.cpp Rename OptimalLayout to OptimizedStructLayout at Chris's request. 2020-04-10 00:14:20 -04:00
Optional.cpp
Parallel.cpp [lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads={1,2,...} /threads:{1,2,...} 2020-03-31 08:46:12 -07:00
Path.cpp [Support/Path] sys::path::replace_path_prefix fix and simplifications 2020-04-03 13:50:23 -04:00
PluginLoader.cpp
PrettyStackTrace.cpp Move setBugReportMsg() out from under a conditional 2020-03-26 16:39:03 -07:00
Process.cpp [Clang][Driver] After default -fintegrated-cc1, make llvm::report_fatal_error() generate preprocessed source + reproducer.sh again. 2020-02-11 10:17:30 -05:00
Program.cpp
RISCVAttributeParser.cpp [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
RISCVAttributes.cpp [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
RWMutex.cpp [RWMutex] Simplify availability check 2019-08-16 21:25:40 +00:00
RandomNumberGenerator.cpp llvm-ar: Fix MinGW compilation 2020-02-28 09:59:24 +01:00
Regex.cpp Explicitly include <cassert> when using assert 2020-03-02 22:45:28 +01:00
SHA1.cpp SHA1.h - remove unnecessary ArrayRef.h/StringRef.h includes. NFC. 2020-04-21 15:12:17 +01:00
ScaledNumber.cpp
ScopedPrinter.cpp
Signals.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Signposts.cpp [Support] Fix Wundef warning 2019-08-15 10:05:22 +00:00
SmallPtrSet.cpp
SmallVector.cpp [NFC] Add include cstdint for SIZE_MAX. 2020-04-30 17:24:05 -07:00
SourceMgr.cpp [SourceMgr] Tidy up the SourceMgr header file to include less stuff. 2020-04-25 21:18:59 -07:00
SpecialCaseList.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Statistic.cpp Statistic - Fix MSVC shadow warning against global PrintOnExit static variable. NFC. 2019-11-21 12:08:01 +00:00
StringExtras.cpp [llvm][StringExtras] Add missing include of cctype 2020-04-14 19:29:54 -07:00
StringMap.cpp Refactor StringMap.h, splitting StringMapEntry out to its own header. 2020-04-12 08:25:17 -07:00
StringRef.cpp Make some static class members constexpr 2020-04-22 12:25:01 +02:00
StringSaver.cpp
SymbolRemappingReader.cpp
SystemUtils.cpp
TarWriter.cpp Reland D78945 TarWriter: Only use 137 of the 155 prefix bytes. 2020-04-27 10:37:23 -07:00
TargetParser.cpp AMDGPU: Teach toolchain to link rocm device libs 2020-04-10 13:37:32 -04:00
TargetRegistry.cpp
ThreadLocal.cpp
ThreadPool.cpp [Support] Simplify and optimize ThreadPool 2020-04-28 12:20:42 -07:00
Threading.cpp [llvm-cov] Prevent llvm-cov from using too many threads 2020-04-24 15:28:25 -04:00
TimeProfiler.cpp [TimeProfiler] Emit clock synchronization point 2020-04-23 01:09:31 +03:00
Timer.cpp [Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler crash 2020-03-13 08:15:35 -04:00
ToolOutputFile.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
TrigramIndex.cpp TrigramIndex.h - remove unnecessary StringMap.h include. NFC 2020-04-12 14:30:52 +01:00
Triple.cpp Simplify string joins. NFCI. 2020-04-11 17:20:11 +02:00
Twine.cpp
Unicode.cpp
UnicodeCaseFold.cpp
Valgrind.cpp
VersionTuple.cpp Explicitly include <cassert> when using assert 2020-03-02 22:45:28 +01:00
VirtualFileSystem.cpp [VirtualFileSystem] Support directory entries in the YAMLVFSWriter 2020-03-27 15:16:52 -07:00
Watchdog.cpp
WithColor.cpp [Debuginfo][NFC] Create common error handlers for DWARFContext. 2020-02-15 12:46:17 +03:00
YAMLParser.cpp [YAMLParser] Scanner::setError - ensure we use the StringRef::iterator argument (PR45043) 2020-04-03 18:55:38 +01:00
YAMLTraits.cpp [NFC] Corrected a minor typo in a comment 2020-02-21 13:56:44 +01:00
Z3Solver.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
circular_raw_ostream.cpp
raw_os_ostream.cpp
raw_ostream.cpp raw_ostream: Simplify code a bit. NFCI. 2020-04-26 14:07:05 +02:00
regcomp.c Allow Compiler.h to be included in C files and fix fallthrough warnings 2019-08-23 17:25:21 +00:00
regengine.inc
regerror.c
regex2.h
regex_impl.h
regexec.c
regfree.c
regstrlcpy.c
regutils.h
xxhash.cpp