[InstCombine] Signed saturation patterns
[llvm-complete.git] / include / llvm / DebugInfo / PDB / Native / DbiStream.h
blob7d75c159b7aebe1d241282b93da629002526c0d9
1 //===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- 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 LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
12 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
13 #include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
16 #include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
17 #include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
19 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
20 #include "llvm/DebugInfo/PDB/PDBTypes.h"
21 #include "llvm/Support/BinaryStreamArray.h"
22 #include "llvm/Support/BinaryStreamRef.h"
23 #include "llvm/Support/Endian.h"
24 #include "llvm/Support/Error.h"
26 namespace llvm {
27 namespace object {
28 struct FpoData;
29 struct coff_section;
32 namespace pdb {
33 class DbiStreamBuilder;
34 class PDBFile;
35 class ISectionContribVisitor;
37 class DbiStream {
38 friend class DbiStreamBuilder;
40 public:
41 explicit DbiStream(std::unique_ptr<BinaryStream> Stream);
42 ~DbiStream();
43 Error reload(PDBFile *Pdb);
45 PdbRaw_DbiVer getDbiVersion() const;
46 uint32_t getAge() const;
47 uint16_t getPublicSymbolStreamIndex() const;
48 uint16_t getGlobalSymbolStreamIndex() const;
50 uint16_t getFlags() const;
51 bool isIncrementallyLinked() const;
52 bool hasCTypes() const;
53 bool isStripped() const;
55 uint16_t getBuildNumber() const;
56 uint16_t getBuildMajorVersion() const;
57 uint16_t getBuildMinorVersion() const;
59 uint16_t getPdbDllRbld() const;
60 uint32_t getPdbDllVersion() const;
62 uint32_t getSymRecordStreamIndex() const;
64 PDB_Machine getMachineType() const;
66 const DbiStreamHeader *getHeader() const { return Header; }
68 BinarySubstreamRef getSectionContributionData() const;
69 BinarySubstreamRef getSecMapSubstreamData() const;
70 BinarySubstreamRef getModiSubstreamData() const;
71 BinarySubstreamRef getFileInfoSubstreamData() const;
72 BinarySubstreamRef getTypeServerMapSubstreamData() const;
73 BinarySubstreamRef getECSubstreamData() const;
75 /// If the given stream type is present, returns its stream index. If it is
76 /// not present, returns InvalidStreamIndex.
77 uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
79 const DbiModuleList &modules() const;
81 FixedStreamArray<object::coff_section> getSectionHeaders() const;
83 bool hasOldFpoRecords() const;
84 FixedStreamArray<object::FpoData> getOldFpoRecords() const;
85 bool hasNewFpoRecords() const;
86 const codeview::DebugFrameDataSubsectionRef &getNewFpoRecords() const;
88 FixedStreamArray<SecMapEntry> getSectionMap() const;
89 void visitSectionContributions(ISectionContribVisitor &Visitor) const;
91 Expected<StringRef> getECName(uint32_t NI) const;
93 private:
94 Error initializeSectionContributionData();
95 Error initializeSectionHeadersData(PDBFile *Pdb);
96 Error initializeSectionMapData();
97 Error initializeOldFpoRecords(PDBFile *Pdb);
98 Error initializeNewFpoRecords(PDBFile *Pdb);
100 Expected<std::unique_ptr<msf::MappedBlockStream>>
101 createIndexedStreamForHeaderType(PDBFile *Pdb, DbgHeaderType Type) const;
103 std::unique_ptr<BinaryStream> Stream;
105 PDBStringTable ECNames;
107 BinarySubstreamRef SecContrSubstream;
108 BinarySubstreamRef SecMapSubstream;
109 BinarySubstreamRef ModiSubstream;
110 BinarySubstreamRef FileInfoSubstream;
111 BinarySubstreamRef TypeServerMapSubstream;
112 BinarySubstreamRef ECSubstream;
114 DbiModuleList Modules;
116 FixedStreamArray<support::ulittle16_t> DbgStreams;
118 PdbRaw_DbiSecContribVer SectionContribVersion =
119 PdbRaw_DbiSecContribVer::DbiSecContribVer60;
120 FixedStreamArray<SectionContrib> SectionContribs;
121 FixedStreamArray<SectionContrib2> SectionContribs2;
122 FixedStreamArray<SecMapEntry> SectionMap;
124 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
125 FixedStreamArray<object::coff_section> SectionHeaders;
127 std::unique_ptr<msf::MappedBlockStream> OldFpoStream;
128 FixedStreamArray<object::FpoData> OldFpoRecords;
130 std::unique_ptr<msf::MappedBlockStream> NewFpoStream;
131 codeview::DebugFrameDataSubsectionRef NewFpoRecords;
133 const DbiStreamHeader *Header;
138 #endif