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
15
16using namespace llvm;
17using namespace llvm::codeview;
18
20 : NameStorage(Allocator), Records(Records) {
21 Names.resize(Records.size());
22}
23
24std::optional<TypeIndex> TypeTableCollection::getFirst() {
25 if (empty())
26 return std::nullopt;
28}
29
30std::optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
31 assert(contains(Prev));
32 ++Prev;
33 if (Prev.toArrayIndex() == size())
34 return std::nullopt;
35 return Prev;
36}
37
39 assert(Index.toArrayIndex() < Records.size());
40 return CVType(Records[Index.toArrayIndex()]);
41}
42
44 if (Index.isNoneType() || Index.isSimple())
46
47 uint32_t I = Index.toArrayIndex();
48 if (Names[I].data() == nullptr) {
49 StringRef Result = NameStorage.save(computeTypeName(*this, Index));
50 Names[I] = Result;
51 }
52 return Names[I];
53}
54
56 return Index.toArrayIndex() <= size();
57}
58
59uint32_t TypeTableCollection::size() { return Records.size(); }
60
61uint32_t TypeTableCollection::capacity() { return Records.size(); }
62
64 bool Stabilize) {
65 llvm_unreachable("Method cannot be called");
66}
#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:50
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