41 : NameStorage(
Allocator), Types(Types), PartialOffsets(PartialOffsets) {
42 Records.resize(RecordCountHint);
68 Records.resize(RecordCountHint);
73 reset(Reader, RecordCountHint);
79 reset(Reader, RecordCountHint);
86 return Records[
Index.toArrayIndex()].Offset;
92 auto EC = ensureTypeExists(
Index);
96 return Records[
Index.toArrayIndex()].Type;
100 if (
Index.isSimple())
103 if (
auto EC = ensureTypeExists(
Index)) {
109 return Records[
Index.toArrayIndex()].Type;
120 if (
auto EC = ensureTypeExists(
Index)) {
122 return "<unknown UDT>";
126 ensureCapacityFor(
Index);
127 if (Records[
I].
Name.data() ==
nullptr) {
129 Records[
I].Name = Result;
131 return Records[
I].Name;
138 if (Records.size() <=
Index.toArrayIndex())
140 if (!Records[
Index.toArrayIndex()].Type.valid())
153 return visitRangeForType(TI);
156void LazyRandomTypeCollection::ensureCapacityFor(
TypeIndex Index) {
163 uint32_t NewCapacity = MinSize * 3 / 2;
166 Records.resize(NewCapacity);
171 if (PartialOffsets.
empty())
172 return fullScanForType(TI);
180 auto Prev = std::prev(Next);
189 return make_error<CodeViewError>(
"Invalid type index");
193 if (Next == PartialOffsets.
end()) {
199 visitRange(TIB, Prev->Offset, TIE);
205 if (
auto EC = ensureTypeExists(TI)) {
216 if (
auto EC = ensureTypeExists(Prev + 1)) {
229 auto Begin = Types.
begin();
241 CurrentTI = LargestTypeIndex + 1;
247 while (Begin !=
End) {
248 ensureCapacityFor(CurrentTI);
249 LargestTypeIndex = std::max(LargestTypeIndex, CurrentTI);
251 Records[
Idx].Type = *Begin;
252 Records[
Idx].Offset = Begin.offset();
257 if (CurrentTI <= TI) {
258 return make_error<CodeViewError>(
"Type Index does not exist!");
265 auto RI = Types.
at(BeginOffset);
268 ensureCapacityFor(
End);
269 while (Begin !=
End) {
270 LargestTypeIndex = std::max(LargestTypeIndex, Begin);
272 Records[
Idx].Type = *RI;
273 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.