LLVM  17.0.0git
TypeStreamMerger.h
Go to the documentation of this file.
1 //===- TypeStreamMerger.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 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
10 #define LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
11 
12 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/Support/Error.h"
15 
16 namespace llvm {
17 template <typename T> class SmallVectorImpl;
18 namespace codeview {
19 
20 class TypeIndex;
21 struct GloballyHashedType;
22 class GlobalTypeTableBuilder;
23 class MergingTypeTableBuilder;
24 
25 /// Used to forward information about PCH.OBJ (precompiled) files, when
26 /// applicable.
27 struct PCHMergerInfo {
30 };
31 
32 /// Merge one set of type records into another. This method assumes
33 /// that all records are type records, and there are no Id records present.
34 ///
35 /// \param Dest The table to store the re-written type records into.
36 ///
37 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
38 /// type stream, that contains the index of the corresponding type record
39 /// in the destination stream.
40 ///
41 /// \param Types The collection of types to merge in.
42 ///
43 /// \returns Error::success() if the operation succeeded, otherwise an
44 /// appropriate error code.
46  SmallVectorImpl<TypeIndex> &SourceToDest,
47  const CVTypeArray &Types);
48 
49 /// Merge one set of id records into another. This method assumes
50 /// that all records are id records, and there are no Type records present.
51 /// However, since Id records can refer back to Type records, this method
52 /// assumes that the referenced type records have also been merged into
53 /// another type stream (for example using the above method), and accepts
54 /// the mapping from source to dest for that stream so that it can re-write
55 /// the type record mappings accordingly.
56 ///
57 /// \param Dest The table to store the re-written id records into.
58 ///
59 /// \param Types The mapping to use for the type records that these id
60 /// records refer to.
61 ///
62 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
63 /// id stream, that contains the index of the corresponding id record
64 /// in the destination stream.
65 ///
66 /// \param Ids The collection of id records to merge in.
67 ///
68 /// \returns Error::success() if the operation succeeded, otherwise an
69 /// appropriate error code.
71  SmallVectorImpl<TypeIndex> &SourceToDest,
72  const CVTypeArray &Ids);
73 
74 /// Merge a unified set of type and id records, splitting them into
75 /// separate output streams.
76 ///
77 /// \param DestIds The table to store the re-written id records into.
78 ///
79 /// \param DestTypes the table to store the re-written type records into.
80 ///
81 /// \param SourceToDest A vector, indexed by the TypeIndex in the source
82 /// id stream, that contains the index of the corresponding id record
83 /// in the destination stream.
84 ///
85 /// \param IdsAndTypes The collection of id records to merge in.
86 ///
87 /// \returns Error::success() if the operation succeeded, otherwise an
88 /// appropriate error code.
90  MergingTypeTableBuilder &DestTypes,
91  SmallVectorImpl<TypeIndex> &SourceToDest,
92  const CVTypeArray &IdsAndTypes,
93  std::optional<PCHMergerInfo> &PCHInfo);
94 
96  GlobalTypeTableBuilder &DestTypes,
97  SmallVectorImpl<TypeIndex> &SourceToDest,
98  const CVTypeArray &IdsAndTypes,
100  std::optional<PCHMergerInfo> &PCHInfo);
101 
103  SmallVectorImpl<TypeIndex> &SourceToDest,
104  const CVTypeArray &Types,
106  std::optional<PCHMergerInfo> &PCHInfo);
107 
109  SmallVectorImpl<TypeIndex> &SourceToDest,
110  const CVTypeArray &Ids,
112 
113 } // end namespace codeview
114 } // end namespace llvm
115 
116 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPESTREAMMERGER_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::codeview::MergingTypeTableBuilder
Definition: MergingTypeTableBuilder.h:28
Error.h
llvm::codeview::PCHMergerInfo::PCHSignature
uint32_t PCHSignature
Definition: TypeStreamMerger.h:28
llvm::codeview::mergeTypeRecords
Error mergeTypeRecords(MergingTypeTableBuilder &Dest, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &Types)
Merge one set of type records into another.
Definition: TypeStreamMerger.cpp:430
llvm::VarStreamArray< CVType >
llvm::codeview::PCHMergerInfo::EndPrecompIndex
uint32_t EndPrecompIndex
Definition: TypeStreamMerger.h:29
llvm::codeview::GlobalTypeTableBuilder
Definition: GlobalTypeTableBuilder.h:29
ArrayRef.h
llvm::codeview::mergeIdRecords
Error mergeIdRecords(MergingTypeTableBuilder &Dest, ArrayRef< TypeIndex > Types, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &Ids)
Merge one set of id records into another.
Definition: TypeStreamMerger.cpp:437
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:33
uint32_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
CVRecord.h
llvm::codeview::PCHMergerInfo
Used to forward information about PCH.OBJ (precompiled) files, when applicable.
Definition: TypeStreamMerger.h:27
llvm::codeview::mergeTypeAndIdRecords
Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes, SmallVectorImpl< TypeIndex > &SourceToDest, const CVTypeArray &IdsAndTypes, std::optional< PCHMergerInfo > &PCHInfo)
Merge a unified set of type and id records, splitting them into separate output streams.
Definition: TypeStreamMerger.cpp:445
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42