36 GlobalsStream::GlobalsStream(std::unique_ptr<MappedBlockStream> Stream)
37 : Stream(
std::move(Stream)) {}
43 if (
auto E = GlobalsTable.
read(Reader))
48 std::vector<std::pair<uint32_t, codeview::CVSymbol>>
51 std::vector<std::pair<uint32_t, codeview::CVSymbol>> Result;
55 int32_t CompressedBucketIndex = GlobalsTable.
BucketMap[ExpandedBucketIndex];
56 if (CompressedBucketIndex == -1)
61 GlobalsTable.
HashBuckets[CompressedBucketIndex] / 12;
64 EndRecordIndex = GlobalsTable.
HashBuckets[CompressedBucketIndex + 1];
74 while (StartRecordIndex < EndRecordIndex) {
79 Result.push_back(std::make_pair(Off, std::move(Record)));
87 return make_error<RawError>(
89 "Encountered unsupported globals stream version.");
98 "Stream does not contain a GSIHashHeader.");
101 return make_error<RawError>(
103 "GSIHashHeader signature (0xffffffff) not found.");
118 "Invalid HR array size.");
120 if (
auto EC = Reader.
readArray(HashRecords, NumHashRecords))
123 "Error reading hash records."));
140 uint32_t NumBitmapEntries = BitmapSizeInBits / 32;
141 if (
auto EC = Reader.
readArray(HashBitmap, NumBitmapEntries))
144 "Could not read a bitmap."));
148 uint8_t WordIdx =
I / 32;
149 uint8_t BitIdx =
I % 32;
150 bool IsSet = HashBitmap[WordIdx] & (1U << BitIdx);
153 BucketMap[
I] = CompressedBucketIdx++;
164 if (
auto EC = Reader.
readArray(HashBuckets, NumBuckets))
167 "Hash buckets corrupted."));
177 if (HashHdr->HrSize > 0)
static Error readGSIHashBuckets(FixedStreamArray< support::ulittle32_t > &HashBuckets, FixedStreamArray< support::ulittle32_t > &HashBitmap, const GSIHashHeader *HashHdr, MutableArrayRef< int32_t > BucketMap, BinaryStreamReader &Reader)
This class represents lattice values for constants.
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...
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
static Error checkHashHdrVersion(const GSIHashHeader *HashHdr)
std::vector< std::pair< uint32_t, codeview::CVSymbol > > findRecordsByName(StringRef Name, const SymbolStream &Symbols) const
Error read(BinaryStreamReader &Reader)
std::array< int32_t, IPHR_HASH+1 > BucketMap
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
uint32_t hashStringV1(StringRef Str)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static Error readGSIHashRecords(FixedStreamArray< PSHashRecord > &HashRecords, const GSIHashHeader *HashHdr, BinaryStreamReader &Reader)
static ErrorSuccess success()
Create a success value.
unsigned countPopulation(T Value)
Count the number of set bits in a value.
FixedStreamArray< support::ulittle32_t > HashBuckets
codeview::CVSymbol readRecord(uint32_t Offset) const
static Error readGSIHashHeader(const GSIHashHeader *&HashHdr, BinaryStreamReader &Reader)
Error joinErrors(Error E1, Error E2)
Concatenate errors.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
FixedStreamArray< PSHashRecord > HashRecords
Lightweight error class with error context and mandatory checking.
#define LLVM_LIKELY(EXPR)
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
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 ...
StringRef getSymbolName(CVSymbol Sym)