[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / lld / COFF / COFFLinkerContext.h
blob059d4aeddc6e56616bbd94f5b0507b0340048496
1 //===- COFFLinkerContext.h --------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_COFF_COFFLINKERCONTEXT_H
10 #define LLD_COFF_COFFLINKERCONTEXT_H
12 #include "Chunks.h"
13 #include "Config.h"
14 #include "DebugTypes.h"
15 #include "Driver.h"
16 #include "InputFiles.h"
17 #include "SymbolTable.h"
18 #include "Writer.h"
19 #include "lld/Common/CommonLinkerContext.h"
20 #include "lld/Common/Timer.h"
22 namespace lld::coff {
24 class COFFLinkerContext : public CommonLinkerContext {
25 public:
26 COFFLinkerContext();
27 COFFLinkerContext(const COFFLinkerContext &) = delete;
28 COFFLinkerContext &operator=(const COFFLinkerContext &) = delete;
29 ~COFFLinkerContext() = default;
31 LinkerDriver driver;
32 SymbolTable symtab;
33 COFFOptTable optTable;
35 std::vector<ObjFile *> objFileInstances;
36 std::map<std::string, PDBInputFile *> pdbInputFileInstances;
37 std::vector<ImportFile *> importFileInstances;
38 std::vector<BitcodeFile *> bitcodeFileInstances;
40 MergeChunk *mergeChunkInstances[Log2MaxSectionAlignment + 1] = {};
42 /// All sources of type information in the program.
43 std::vector<TpiSource *> tpiSourceList;
45 void addTpiSource(TpiSource *tpi) { tpiSourceList.push_back(tpi); }
47 std::map<llvm::codeview::GUID, TpiSource *> typeServerSourceMappings;
48 std::map<uint32_t, TpiSource *> precompSourceMappings;
50 /// List of all output sections. After output sections are finalized, this
51 /// can be indexed by getOutputSection.
52 std::vector<OutputSection *> outputSections;
54 OutputSection *getOutputSection(const Chunk *c) const {
55 return c->osidx == 0 ? nullptr : outputSections[c->osidx - 1];
58 // Fake sections for parsing bitcode files.
59 FakeSection ltoTextSection;
60 FakeSection ltoDataSection;
61 FakeSectionChunk ltoTextSectionChunk;
62 FakeSectionChunk ltoDataSectionChunk;
64 // All timers used in the COFF linker.
65 Timer rootTimer;
66 Timer inputFileTimer;
67 Timer ltoTimer;
68 Timer gcTimer;
69 Timer icfTimer;
71 // Writer timers.
72 Timer codeLayoutTimer;
73 Timer outputCommitTimer;
74 Timer totalMapTimer;
75 Timer symbolGatherTimer;
76 Timer symbolStringsTimer;
77 Timer writeTimer;
79 // PDB timers.
80 Timer totalPdbLinkTimer;
81 Timer addObjectsTimer;
82 Timer typeMergingTimer;
83 Timer loadGHashTimer;
84 Timer mergeGHashTimer;
85 Timer symbolMergingTimer;
86 Timer publicsLayoutTimer;
87 Timer tpiStreamLayoutTimer;
88 Timer diskCommitTimer;
90 Configuration config;
93 } // namespace lld::coff
95 #endif