LLVM  9.0.0svn
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 
15 using namespace llvm;
16 using namespace llvm::codeview;
17 
19  : NameStorage(Allocator), Records(Records) {
20  Names.resize(Records.size());
21 }
22 
24  if (empty())
25  return None;
26  return TypeIndex::fromArrayIndex(0);
27 }
28 
30  assert(contains(Prev));
31  ++Prev;
32  if (Prev.toArrayIndex() == size())
33  return None;
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 
58 uint32_t TypeTableCollection::size() { return Records.size(); }
59 
60 uint32_t TypeTableCollection::capacity() { return Records.size(); }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
Definition: RecordName.cpp:248
CVRecord< TypeLeafKind > CVType
Definition: TypeRecord.h:35
bool isNoneType() const
Definition: TypeIndex.h:115
A 32-bit type reference.
Definition: TypeIndex.h:95
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
uint32_t toArrayIndex() const
Definition: TypeIndex.h:117
static TypeIndex fromArrayIndex(uint32_t Index)
Definition: TypeIndex.h:122
bool contains(TypeIndex Index) override
TypeTableCollection(ArrayRef< ArrayRef< uint8_t >> Records)
static StringRef simpleTypeName(TypeIndex TI)
Definition: TypeIndex.cpp:70
Optional< TypeIndex > getFirst() override
StringRef getTypeName(TypeIndex Index) override
Basic Register Allocator
StringRef save(const char *S)
Definition: StringSaver.h:28
Optional< TypeIndex > getNext(TypeIndex Prev) override
CVType getType(TypeIndex Index) override
#define I(x, y, z)
Definition: MD5.cpp:58
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48