40 : NameStorage(
Allocator), Types(Types), PartialOffsets(PartialOffsets) {
41 Records.resize(RecordCountHint);
67 Records.resize(RecordCountHint);
72 reset(Reader, RecordCountHint);
78 reset(Reader, RecordCountHint);
85 return Records[
Index.toArrayIndex()].Offset;
91 auto EC = ensureTypeExists(
Index);
95 return Records[
Index.toArrayIndex()].Type;
102 if (
auto EC = ensureTypeExists(
Index)) {
108 return Records[
Index.toArrayIndex()].Type;
119 if (
auto EC = ensureTypeExists(
Index)) {
121 return "<unknown UDT>";
125 ensureCapacityFor(
Index);
126 if (Records[
I].
Name.data() ==
nullptr) {
128 Records[
I].Name = Result;
130 return Records[
I].Name;
137 if (Records.size() <=
Index.toArrayIndex())
139 if (!Records[
Index.toArrayIndex()].Type.valid())
152 return visitRangeForType(TI);
155void LazyRandomTypeCollection::ensureCapacityFor(
TypeIndex Index) {
162 uint32_t NewCapacity = MinSize * 3 / 2;
165 Records.resize(NewCapacity);
170 if (PartialOffsets.
empty())
171 return fullScanForType(TI);
179 auto Prev = std::prev(Next);
188 return make_error<CodeViewError>(
"Invalid type index");
192 if (Next == PartialOffsets.
end()) {
198 visitRange(TIB, Prev->Offset, TIE);
204 if (
auto EC = ensureTypeExists(TI)) {
215 if (
auto EC = ensureTypeExists(Prev + 1)) {
228 auto Begin = Types.
begin();
240 CurrentTI = LargestTypeIndex + 1;
246 while (Begin !=
End) {
247 ensureCapacityFor(CurrentTI);
248 LargestTypeIndex = std::max(LargestTypeIndex, CurrentTI);
250 Records[
Idx].Type = *Begin;
251 Records[
Idx].Offset = Begin.offset();
256 if (CurrentTI <= TI) {
257 return make_error<CodeViewError>(
"Type Index does not exist!");
264 auto RI = Types.
at(BeginOffset);
267 ensureCapacityFor(
End);
268 while (Begin !=
End) {
269 LargestTypeIndex = std::max(LargestTypeIndex, Begin);
271 Records[
Idx].Type = *RI;
272 Records[
Idx].Offset = RI.offset();
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Provides read only access to a subclass of BinaryStream.
uint64_t bytesRemaining() const
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.
FixedStreamArrayIterator< T > begin() const
FixedStreamArrayIterator< T > end() const
StringRef - Represent a constant reference to a string, i.e.
StringRef save(const char *S)
LLVM Value Representation.
Iterator at(uint32_t Offset) const
given an offset into the array's underlying stream, return an iterator to the record at that offset.
Iterator begin(bool *HadError=nullptr) const
Provides amortized O(1) random access to a CodeView type stream.
std::optional< TypeIndex > getNext(TypeIndex Prev) override
std::optional< CVType > tryGetType(TypeIndex Index)
CVType getType(TypeIndex Index) override
uint32_t getOffsetOfType(TypeIndex Index)
uint32_t capacity() override
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
StringRef getTypeName(TypeIndex Index) override
bool contains(TypeIndex Index) override
std::optional< TypeIndex > getFirst() override
void reset(ArrayRef< uint8_t > Data, uint32_t RecordCountHint)
LazyRandomTypeCollection(uint32_t RecordCountHint)
static TypeIndex fromArrayIndex(uint32_t Index)
uint32_t toArrayIndex() const
static StringRef simpleTypeName(TypeIndex TI)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
This is an optimization pass for GlobalISel generic memory operations.
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
void consumeError(Error Err)
Consume a Error without doing anything.