LLVM 20.0.0git
TypeTableCollection.cpp
Go to the documentation of this file.
1//===- TypeTableCollection.cpp -------------------------------- *- C++ --*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
14
15using namespace llvm;
16using namespace llvm::codeview;
17
19 : NameStorage(Allocator), Records(Records) {
20 Names.resize(Records.size());
21}
22
23std::optional<TypeIndex> TypeTableCollection::getFirst() {
24 if (empty())
25 return std::nullopt;
27}
28
29std::optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
30 assert(contains(Prev));
31 ++Prev;
32 if (Prev.toArrayIndex() == size())
33 return std::nullopt;
34 return Prev;
35}
36
38 assert(Index.toArrayIndex() < Records.size());
39 return CVType(Records[Index.toArrayIndex()]);
40}
41
43 if (Index.isNoneType() || Index.isSimple())
44 return TypeIndex::simpleTypeName(Index);
45
46 uint32_t I = Index.toArrayIndex();
47 if (Names[I].data() == nullptr) {
48 StringRef Result = NameStorage.save(computeTypeName(*this, Index));
49 Names[I] = Result;
50 }
51 return Names[I];
52}
53
55 return Index.toArrayIndex() <= size();
56}
57
58uint32_t TypeTableCollection::size() { return Records.size(); }
59
60uint32_t TypeTableCollection::capacity() { return Records.size(); }
61
63 bool Stabilize) {
64 llvm_unreachable("Method cannot be called");
65}
#define I(x, y, z)
Definition: MD5.cpp:58
Basic Register Allocator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
StringRef save(const char *S)
Definition: StringSaver.h:30
A 32-bit type reference.
Definition: TypeIndex.h:96
static TypeIndex fromArrayIndex(uint32_t Index)
Definition: TypeIndex.h:123
uint32_t toArrayIndex() const
Definition: TypeIndex.h:118
static StringRef simpleTypeName(TypeIndex TI)
Definition: TypeIndex.cpp:71
CVType getType(TypeIndex Index) override
bool contains(TypeIndex Index) override
TypeTableCollection(ArrayRef< ArrayRef< uint8_t > > Records)
std::optional< TypeIndex > getFirst() override
std::optional< TypeIndex > getNext(TypeIndex Prev) override
StringRef getTypeName(TypeIndex Index) override
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
CVRecord< TypeLeafKind > CVType
Definition: CVRecord.h:64
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
Definition: RecordName.cpp:254
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18