42 : NameStorage(Allocator), Types(Types), PartialOffsets(PartialOffsets) {
43 Records.resize(RecordCountHint);
54 makeArrayRef(Data.bytes_begin(), Data.bytes_end()), RecordCountHint) {
70 Records.resize(RecordCountHint);
75 reset(Reader, RecordCountHint);
81 reset(Reader, RecordCountHint);
85 error(ensureTypeExists(Index));
92 auto EC = ensureTypeExists(Index);
100 if (
auto EC = ensureTypeExists(Index)) {
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;
150 return visitRangeForType(TI);
153 void LazyRandomTypeCollection::ensureCapacityFor(
TypeIndex Index) {
159 uint32_t NewCapacity = MinSize * 3 / 2;
162 Records.resize(NewCapacity);
166 if (PartialOffsets.
empty())
167 return fullScanForType(TI);
169 auto Next = std::upper_bound(PartialOffsets.
begin(), PartialOffsets.
end(), TI,
171 return Value < IO.Type;
175 auto Prev = std::prev(Next);
184 return make_error<CodeViewError>(
"Invalid type index");
188 if (Next == PartialOffsets.
end()) {
194 visitRange(TIB, Prev->Offset, TIE);
200 if (
auto EC = ensureTypeExists(TI)) {
211 if (
auto EC = ensureTypeExists(Prev + 1)) {
223 auto Begin = Types.
begin();
235 CurrentTI = LargestTypeIndex + 1;
236 Begin = Types.
at(Offset);
240 auto End = Types.
end();
241 while (Begin != End) {
242 ensureCapacityFor(CurrentTI);
243 LargestTypeIndex =
std::max(LargestTypeIndex, CurrentTI);
244 auto Idx = CurrentTI.toArrayIndex();
245 Records[Idx].Type = *Begin;
246 Records[Idx].Offset = Begin.offset();
251 if (CurrentTI <= TI) {
252 return make_error<CodeViewError>(
"Type Index does not exist!");
259 auto RI = Types.
at(BeginOffset);
262 ensureCapacityFor(End);
263 while (Begin != End) {
264 LargestTypeIndex =
std::max(LargestTypeIndex, Begin);
266 Records[Idx].Type = *RI;
267 Records[Idx].Offset = RI.offset();
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Compute iterated dominance frontiers using a linear time algorithm.
bool contains(TypeIndex Index) override
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
LazyRandomTypeCollection(uint32_t RecordCountHint)
Optional< TypeIndex > getNext(TypeIndex Prev) override
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
void reset(ArrayRef< uint8_t > Data, uint32_t RecordCountHint)
static void error(Error &&EC)
CVType getType(TypeIndex Index) override
uint32_t toArrayIndex() const
static TypeIndex fromArrayIndex(uint32_t Index)
uint32_t capacity() override
static StringRef simpleTypeName(TypeIndex TI)
Optional< CVType > tryGetType(TypeIndex Index)
void consumeError(Error Err)
Consume a Error without doing anything.
StringRef getTypeName(TypeIndex Index) override
static ErrorSuccess success()
Create a success value.
StringRef save(const char *S)
uint32_t getOffsetOfType(TypeIndex Index)
uint32_t bytesRemaining() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
FixedStreamArrayIterator< T > end() const
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
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
FixedStreamArrayIterator< T > begin() const
Optional< TypeIndex > getFirst() override
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 ...
Provides amortized O(1) random access to a CodeView type stream.