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));
94 auto EC = ensureTypeExists(Index);
105 if (
auto EC = ensureTypeExists(Index)) {
122 if (
auto EC = ensureTypeExists(Index)) {
124 return "<unknown UDT>";
128 ensureCapacityFor(Index);
129 if (Records[I].
Name.data() ==
nullptr) {
131 Records[
I].Name = Result;
133 return Records[
I].Name;
155 return visitRangeForType(TI);
158 void LazyRandomTypeCollection::ensureCapacityFor(
TypeIndex Index) {
165 uint32_t NewCapacity = MinSize * 3 / 2;
168 Records.resize(NewCapacity);
173 if (PartialOffsets.
empty())
174 return fullScanForType(TI);
178 return Value < IO.Type;
182 auto Prev = std::prev(Next);
191 return make_error<CodeViewError>(
"Invalid type index");
195 if (Next == PartialOffsets.
end()) {
201 visitRange(TIB, Prev->Offset, TIE);
207 if (
auto EC = ensureTypeExists(TI)) {
218 if (
auto EC = ensureTypeExists(Prev + 1)) {
231 auto Begin = Types.
begin();
243 CurrentTI = LargestTypeIndex + 1;
244 Begin = Types.
at(Offset);
248 auto End = Types.
end();
249 while (Begin != End) {
250 ensureCapacityFor(CurrentTI);
251 LargestTypeIndex =
std::max(LargestTypeIndex, CurrentTI);
252 auto Idx = CurrentTI.toArrayIndex();
253 Records[Idx].Type = *Begin;
254 Records[Idx].Offset = Begin.offset();
259 if (CurrentTI <= TI) {
260 return make_error<CodeViewError>(
"Type Index does not exist!");
267 auto RI = Types.
at(BeginOffset);
270 ensureCapacityFor(End);
271 while (Begin != End) {
272 LargestTypeIndex =
std::max(LargestTypeIndex, Begin);
274 Records[Idx].Type = *RI;
275 Records[Idx].Offset = RI.offset();
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
bool contains(TypeIndex Index) override
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
LazyRandomTypeCollection(uint32_t RecordCountHint)
Optional< TypeIndex > getNext(TypeIndex Prev) override
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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
auto upper_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
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.