LLVM  16.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 
16 using namespace llvm;
17 using namespace llvm::codeview;
18 
20  : NameStorage(Allocator), Records(Records) {
21  Names.resize(Records.size());
22 }
23 
25  if (empty())
26  return None;
27  return TypeIndex::fromArrayIndex(0);
28 }
29 
31  assert(contains(Prev));
32  ++Prev;
33  if (Prev.toArrayIndex() == size())
34  return None;
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 
59 uint32_t TypeTableCollection::size() { return Records.size(); }
60 
61 uint32_t TypeTableCollection::capacity() { return Records.size(); }
62 
64  bool Stabilize) {
65  llvm_unreachable("Method cannot be called");
66 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::codeview::computeTypeName
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
Definition: RecordName.cpp:254
llvm::codeview::TypeIndex::fromArrayIndex
static TypeIndex fromArrayIndex(uint32_t Index)
Definition: TypeIndex.h:123
ErrorHandling.h
llvm::codeview::TypeTableCollection::replaceType
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
Definition: TypeTableCollection.cpp:63
llvm::codeview::TypeTableCollection::TypeTableCollection
TypeTableCollection(ArrayRef< ArrayRef< uint8_t >> Records)
Definition: TypeTableCollection.cpp:19
RecordName.h
llvm::Optional
Definition: APInt.h:33
llvm::codeview::TypeTableCollection::size
uint32_t size() override
Definition: TypeTableCollection.cpp:59
llvm::codeview::TypeTableCollection::contains
bool contains(TypeIndex Index) override
Definition: TypeTableCollection.cpp:55
llvm::codeview::TypeTableCollection::getFirst
Optional< TypeIndex > getFirst() override
Definition: TypeTableCollection.cpp:24
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
CodeView.h
llvm::None
const NoneType None
Definition: None.h:24
I
#define I(x, y, z)
Definition: MD5.cpp:58
TypeTableCollection.h
llvm::codeview::TypeCollection::empty
bool empty()
Definition: TypeCollection.h:22
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::codeview::TypeIndex::simpleTypeName
static StringRef simpleTypeName(TypeIndex TI)
Definition: TypeIndex.cpp:71
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::codeview::TypeIndex::toArrayIndex
uint32_t toArrayIndex() const
Definition: TypeIndex.h:118
llvm::codeview::CVRecord< TypeLeafKind >
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
uint32_t
llvm::codeview::TypeTableCollection::getTypeName
StringRef getTypeName(TypeIndex Index) override
Definition: TypeTableCollection.cpp:43
TypeIndex.h
llvm::codeview::TypeTableCollection::capacity
uint32_t capacity() override
Definition: TypeTableCollection.cpp:61
llvm::codeview
Definition: AppendingTypeTableBuilder.h:22
llvm::codeview::TypeTableCollection::getType
CVType getType(TypeIndex Index) override
Definition: TypeTableCollection.cpp:38
llvm::codeview::TypeTableCollection::getNext
Optional< TypeIndex > getNext(TypeIndex Prev) override
Definition: TypeTableCollection.cpp:30
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:143
llvm::StringSaver::save
StringRef save(const char *S)
Definition: StringSaver.h:28
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:96
llvm::codeview::CVType
CVRecord< TypeLeafKind > CVType
Definition: CVRecord.h:64