summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-04 23:53:29 +0000
committerZachary Turner <zturner@google.com>2017-05-04 23:53:29 +0000
commit1eb9a0297cb639323e97ca7f02123b035bf0b24b (patch)
treeddb035ff414d6531ae8e47e0b070b1996c302422 /llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
parent20d773c4af45411a77c1715857c2559ffe3a9f09 (diff)
downloadbcm5719-llvm-1eb9a0297cb639323e97ca7f02123b035bf0b24b.tar.gz
bcm5719-llvm-1eb9a0297cb639323e97ca7f02123b035bf0b24b.zip
[PDB] Don't build the entire source file list up front.
I tried to run llvm-pdbdump on a very large (~1.5GB) PDB to try and identify show-stopping performance problems. This patch addresses the first such problem. When loading the DBI stream, before anyone has even tried to access a single record, we build an in memory map of every source file for every module. In the particular PDB I was using, this was over 85 million files. Specifically, the complexity is O(m*n) where m is the number of modules and n is the average number of source files (including headers) per module. The whole reason for doing this was so that we could have constant time access to any module and any of its source file lists. However, we can still get O(1) access to the source file list for a given module with a simple O(m) precomputation, and access to the list of modules is already O(1) anyway. So this patches reduces the O(m*n) up-front precomputation to an O(m) one, where n is ~6,500 and n*m is about 85 million in my pathological test case. Differential Revision: https://reviews.llvm.org/D32870 llvm-svn: 302205
Diffstat (limited to 'llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp')
-rw-r--r--llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
index 06d8ced128a..1af62b4e8df 100644
--- a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
@@ -775,37 +775,37 @@ Error LLVMOutputStyle::dumpDbiStream() {
if (DumpModules) {
ListScope L(P, "Modules");
- for (auto &Modi : DS->modules()) {
+ const DbiModuleList &Modules = DS->modules();
+ for (uint32_t I = 0; I < Modules.getModuleCount(); ++I) {
+ const DbiModuleDescriptor &Modi = Modules.getModuleDescriptor(I);
DictScope DD(P);
- P.printString("Name", Modi.Info.getModuleName().str());
- P.printNumber("Debug Stream Index", Modi.Info.getModuleStreamIndex());
- P.printString("Object File Name", Modi.Info.getObjFileName().str());
- P.printNumber("Num Files", Modi.Info.getNumberOfFiles());
- P.printNumber("Source File Name Idx", Modi.Info.getSourceFileNameIndex());
- P.printNumber("Pdb File Name Idx", Modi.Info.getPdbFilePathNameIndex());
- P.printNumber("Line Info Byte Size", Modi.Info.getC11LineInfoByteSize());
- P.printNumber("C13 Line Info Byte Size",
- Modi.Info.getC13LineInfoByteSize());
- P.printNumber("Symbol Byte Size", Modi.Info.getSymbolDebugInfoByteSize());
- P.printNumber("Type Server Index", Modi.Info.getTypeServerIndex());
- P.printBoolean("Has EC Info", Modi.Info.hasECInfo());
+ P.printString("Name", Modi.getModuleName().str());
+ P.printNumber("Debug Stream Index", Modi.getModuleStreamIndex());
+ P.printString("Object File Name", Modi.getObjFileName().str());
+ P.printNumber("Num Files", Modi.getNumberOfFiles());
+ P.printNumber("Source File Name Idx", Modi.getSourceFileNameIndex());
+ P.printNumber("Pdb File Name Idx", Modi.getPdbFilePathNameIndex());
+ P.printNumber("Line Info Byte Size", Modi.getC11LineInfoByteSize());
+ P.printNumber("C13 Line Info Byte Size", Modi.getC13LineInfoByteSize());
+ P.printNumber("Symbol Byte Size", Modi.getSymbolDebugInfoByteSize());
+ P.printNumber("Type Server Index", Modi.getTypeServerIndex());
+ P.printBoolean("Has EC Info", Modi.hasECInfo());
if (opts::raw::DumpModuleFiles) {
- std::string FileListName =
- to_string(Modi.SourceFiles.size()) + " Contributing Source Files";
+ std::string FileListName = to_string(Modules.getSourceFileCount(I)) +
+ " Contributing Source Files";
ListScope LL(P, FileListName);
- for (auto File : Modi.SourceFiles)
- P.printString(File.str());
+ for (auto File : Modules.source_files(I))
+ P.printString(File);
}
- bool HasModuleDI =
- (Modi.Info.getModuleStreamIndex() < File.getNumStreams());
+ bool HasModuleDI = (Modi.getModuleStreamIndex() < File.getNumStreams());
bool ShouldDumpSymbols =
(opts::raw::DumpModuleSyms || opts::raw::DumpSymRecordBytes);
if (HasModuleDI && (ShouldDumpSymbols || opts::raw::DumpLineInfo)) {
auto ModStreamData = MappedBlockStream::createIndexedStream(
File.getMsfLayout(), File.getMsfBuffer(),
- Modi.Info.getModuleStreamIndex());
+ Modi.getModuleStreamIndex());
- ModuleDebugStreamRef ModS(Modi.Info, std::move(ModStreamData));
+ ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
if (auto EC = ModS.reload())
return EC;
@@ -876,9 +876,10 @@ Error LLVMOutputStyle::dumpSectionContribs() {
{
DictScope DD(P, "Module");
P.printNumber("Index", SC.Imod);
- auto M = DS.modules();
- if (M.size() > SC.Imod) {
- P.printString("Name", M[SC.Imod].Info.getModuleName());
+ const DbiModuleList &Modules = DS.modules();
+ if (Modules.getModuleCount() > SC.Imod) {
+ P.printString("Name",
+ Modules.getModuleDescriptor(SC.Imod).getModuleName());
}
}
P.printNumber("Data CRC", SC.DataCrc);
OpenPOWER on IntegriCloud