LLVM: lib/DebugInfo/PDB/Native/GlobalsStream.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

22

30

31using namespace llvm;

34

37

39

42 if (auto E = GlobalsTable.read(Reader))

43 return E;

45}

46

47std::vector<std::pair<uint32_t, codeview::CVSymbol>>

50 std::vector<std::pair<uint32_t, codeview::CVSymbol>> Result;

51

52

54 int32_t CompressedBucketIndex = GlobalsTable.BucketMap[ExpandedBucketIndex];

55 if (CompressedBucketIndex == -1)

56 return Result;

57

58 uint32_t LastBucketIndex = GlobalsTable.HashBuckets.size() - 1;

60 GlobalsTable.HashBuckets[CompressedBucketIndex] / 12;

63 EndRecordIndex = GlobalsTable.HashBuckets[CompressedBucketIndex + 1];

64 } else {

65

66

67 EndRecordIndex = GlobalsTable.HashRecords.size() * 12;

68 }

69

70 EndRecordIndex /= 12;

71

72 assert(EndRecordIndex <= GlobalsTable.HashRecords.size());

73 while (StartRecordIndex < EndRecordIndex) {

74 PSHashRecord PSH = GlobalsTable.HashRecords[StartRecordIndex];

78 Result.push_back(std::make_pair(Off, std::move(Record)));

79 ++StartRecordIndex;

80 }

81 return Result;

82}

83

88 "Encountered unsupported globals stream version.");

89

91}

92

97 "Stream does not contain a GSIHashHeader.");

98

102 "GSIHashHeader signature (0xffffffff) not found.");

103

105}

106

111 return EC;

112

113

114

117 "Invalid HR array size.");

119 if (auto EC = Reader.readArray(HashRecords, NumHashRecords))

122 "Error reading hash records."));

123

125}

126

134 return EC;

135

136

137

139 uint32_t NumBitmapEntries = BitmapSizeInBits / 32;

140 if (auto EC = Reader.readArray(HashBitmap, NumBitmapEntries))

143 "Could not read a bitmap."));

144 uint32_t CompressedBucketIdx = 0;

148 bool IsSet = HashBitmap[WordIdx] & (1U << BitIdx);

149 if (IsSet) {

150 BucketMap[I] = CompressedBucketIdx++;

151 } else {

152 BucketMap[I] = -1;

153 }

154 }

155

159

160

161 if (auto EC = Reader.readArray(HashBuckets, NumBuckets))

164 "Hash buckets corrupted."));

165

167}

168

171 return EC;

173 return EC;

177 return EC;

179}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

#define LLVM_LIKELY(EXPR)

static Error readGSIHashHeader(const GSIHashHeader *&HashHdr, BinaryStreamReader &Reader)

Definition GlobalsStream.cpp:93

static Error readGSIHashBuckets(FixedStreamArray< support::ulittle32_t > &HashBuckets, FixedStreamArray< support::ulittle32_t > &HashBitmap, const GSIHashHeader *HashHdr, MutableArrayRef< int32_t > BucketMap, BinaryStreamReader &Reader)

Definition GlobalsStream.cpp:128

static Error readGSIHashRecords(FixedStreamArray< PSHashRecord > &HashRecords, const GSIHashHeader *HashHdr, BinaryStreamReader &Reader)

Definition GlobalsStream.cpp:107

static Error checkHashHdrVersion(const GSIHashHeader *HashHdr)

Definition GlobalsStream.cpp:84

Provides read only access to a subclass of BinaryStream.

Error readObject(const T *&Dest)

Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...

Error readArray(ArrayRef< T > &Array, uint32_t NumElements)

Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

StringRef - Represent a constant reference to a string, i.e.

const GSIHashHeader * HashHdr

LLVM_ABI Error read(BinaryStreamReader &Reader)

Definition GlobalsStream.cpp:169

std::array< int32_t, IPHR_HASH+1 > BucketMap

FixedStreamArray< support::ulittle32_t > HashBuckets

FixedStreamArray< support::ulittle32_t > HashBitmap

FixedStreamArray< PSHashRecord > HashRecords

LLVM_ABI Error reload()

Definition GlobalsStream.cpp:40

LLVM_ABI std::vector< std::pair< uint32_t, codeview::CVSymbol > > findRecordsByName(StringRef Name, const SymbolStream &Symbols) const

Definition GlobalsStream.cpp:48

LLVM_ABI ~GlobalsStream()

LLVM_ABI GlobalsStream(std::unique_ptr< msf::MappedBlockStream > Stream)

Definition GlobalsStream.cpp:35

CVRecord< SymbolKind > CVSymbol

LLVM_ABI StringRef getSymbolName(CVSymbol Sym)

LLVM_ABI uint32_t hashStringV1(StringRef Str)

This is an optimization pass for GlobalISel generic memory operations.

constexpr int popcount(T Value) noexcept

Count the number of set bits in a value.

Error joinErrors(Error E1, Error E2)

Concatenate errors.

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

uint64_t alignTo(uint64_t Size, Align A)

Returns a multiple of A needed to store Size bytes.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

Implement std::hash so that hash_code can be used in STL containers.