38 : NameStorage(
Allocator), Types(Types), PartialOffsets(PartialOffsets) {
39 Records.resize(RecordCountHint);
65 Records.resize(RecordCountHint);
70 reset(Reader, RecordCountHint);
76 reset(Reader, RecordCountHint);
80 error(ensureTypeExists(Index));
83 return Records[Index.toArrayIndex()].Offset;
89 auto EC = ensureTypeExists(Index);
93 return Records[Index.toArrayIndex()].Type;
100 if (
auto EC = ensureTypeExists(Index)) {
106 return Records[Index.toArrayIndex()].Type;
110 if (Index.isNoneType() || Index.isSimple())
117 if (
auto EC = ensureTypeExists(Index)) {
119 return "<unknown UDT>";
123 ensureCapacityFor(Index);
124 if (Records[
I].
Name.data() ==
nullptr) {
126 Records[
I].Name = Result;
128 return Records[
I].Name;
132 if (Index.isSimple() || Index.isNoneType())
135 if (Records.size() <= Index.toArrayIndex())
137 if (!Records[Index.toArrayIndex()].Type.valid())
150 return visitRangeForType(TI);
153void LazyRandomTypeCollection::ensureCapacityFor(
TypeIndex Index) {
154 assert(!Index.isSimple());
155 uint32_t MinSize = Index.toArrayIndex() + 1;
160 uint32_t NewCapacity = MinSize * 3 / 2;
163 Records.resize(NewCapacity);
168 if (PartialOffsets.
empty())
169 return fullScanForType(TI);
177 auto Prev = std::prev(Next);
186 return make_error<CodeViewError>(
"Invalid type index");
190 if (Next == PartialOffsets.
end()) {
196 visitRange(TIB, Prev->Offset, TIE);
202 if (
auto EC = ensureTypeExists(TI)) {
213 if (
auto EC = ensureTypeExists(Prev + 1)) {
226 auto Begin = Types.
begin();
238 CurrentTI = LargestTypeIndex + 1;
244 while (Begin !=
End) {
245 ensureCapacityFor(CurrentTI);
246 LargestTypeIndex = std::max(LargestTypeIndex, CurrentTI);
248 Records[
Idx].Type = *Begin;
249 Records[
Idx].Offset = Begin.offset();
254 if (CurrentTI <= TI) {
255 return make_error<CodeViewError>(
"Type Index does not exist!");
262 auto RI = Types.
at(BeginOffset);
265 ensureCapacityFor(
End);
266 while (Begin !=
End) {
267 LargestTypeIndex = std::max(LargestTypeIndex, Begin);
269 Records[
Idx].Type = *RI;
270 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.