xref: /llvm-project/lld/COFF/COFFLinkerContext.cpp (revision 85a2f29fd485d29e6a93de6f0c2bfdc009d06a56)
1 //===- COFFContext.cpp ----------------------------------------------------===//
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Description
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #include "COFFLinkerContext.h"
13 #include "Symbols.h"
14 #include "lld/Common/Memory.h"
15 #include "llvm/BinaryFormat/COFF.h"
16 #include "llvm/DebugInfo/CodeView/TypeHashing.h"
17 #include "llvm/Demangle/Demangle.h"
18 
19 namespace lld::coff {
COFFLinkerContext()20 COFFLinkerContext::COFFLinkerContext()
21     : driver(*this), symtab(*this),
22       ltoTextSection(llvm::COFF::IMAGE_SCN_MEM_EXECUTE),
23       ltoDataSection(llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA),
24       ltoTextSectionChunk(&ltoTextSection.section),
25       ltoDataSectionChunk(&ltoDataSection.section),
26       rootTimer("Total Linking Time"),
27       inputFileTimer("Input File Reading", rootTimer),
28       ltoTimer("LTO", rootTimer), gcTimer("GC", rootTimer),
29       icfTimer("ICF", rootTimer), codeLayoutTimer("Code Layout", rootTimer),
30       outputCommitTimer("Commit Output File", rootTimer),
31       totalMapTimer("MAP Emission (Cumulative)", rootTimer),
32       symbolGatherTimer("Gather Symbols", totalMapTimer),
33       symbolStringsTimer("Build Symbol Strings", totalMapTimer),
34       writeTimer("Write to File", totalMapTimer),
35       totalPdbLinkTimer("PDB Emission (Cumulative)", rootTimer),
36       addObjectsTimer("Add Objects", totalPdbLinkTimer),
37       typeMergingTimer("Type Merging", addObjectsTimer),
38       loadGHashTimer("Global Type Hashing", addObjectsTimer),
39       mergeGHashTimer("GHash Type Merging", addObjectsTimer),
40       symbolMergingTimer("Symbol Merging", addObjectsTimer),
41       publicsLayoutTimer("Publics Stream Layout", totalPdbLinkTimer),
42       tpiStreamLayoutTimer("TPI Stream Layout", totalPdbLinkTimer),
43       diskCommitTimer("Commit to Disk", totalPdbLinkTimer) {}
44 } // namespace lld::coff
45