1 //===- TypeMerger.h ---------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_COFF_TYPEMERGER_H
10 #define LLD_COFF_TYPEMERGER_H
13 #include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
14 #include "llvm/DebugInfo/CodeView/TypeHashing.h"
15 #include "llvm/Support/Allocator.h"
21 using llvm::codeview::GloballyHashedType
;
22 using llvm::codeview::TypeIndex
;
28 TypeMerger(llvm::BumpPtrAllocator
&alloc
);
32 /// Get the type table or the global type table if /DEBUG:GHASH is enabled.
33 inline llvm::codeview::TypeCollection
&getTypeTable() {
34 assert(!config
->debugGHashes
);
38 /// Get the ID table or the global ID table if /DEBUG:GHASH is enabled.
39 inline llvm::codeview::TypeCollection
&getIDTable() {
40 assert(!config
->debugGHashes
);
44 /// Use global hashes to eliminate duplicate types and identify unique type
45 /// indices in each TpiSource.
46 void mergeTypesWithGHash();
48 /// Map from PDB function id type indexes to PDB function type indexes.
49 /// Populated after mergeTypesWithGHash.
50 llvm::DenseMap
<TypeIndex
, TypeIndex
> funcIdToType
;
52 /// Type records that will go into the PDB TPI stream.
53 llvm::codeview::MergingTypeTableBuilder typeTable
;
55 /// Item records that will go into the PDB IPI stream.
56 llvm::codeview::MergingTypeTableBuilder idTable
;
58 // When showSummary is enabled, these are histograms of TPI and IPI records
59 // keyed by type index.
60 SmallVector
<uint32_t, 0> tpiCounts
;
61 SmallVector
<uint32_t, 0> ipiCounts
;