Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
MergingTypeTableBuilder.h
Go to the documentation of this file.
1//===- MergingTypeTableBuilder.h ---------------------------------*- 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
9#ifndef LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
10#define LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/ADT/DenseMap.h"
21#include <cstdint>
22
23namespace llvm {
24namespace codeview {
26
28
30 /// Storage for records. These need to outlive the TypeTableBuilder.
31 BumpPtrAllocator &RecordStorage;
32
33 /// A serializer that can write non-continuation leaf types. Only used as
34 /// a convenience function so that we can provide an interface method to
35 /// write an unserialized record.
36 SimpleTypeSerializer SimpleSerializer;
37
38 /// Hash table.
40
41 /// Contains a list of all records indexed by TypeIndex.toArrayIndex().
42 SmallVector<ArrayRef<uint8_t>, 2> SeenRecords;
43
44public:
47
48 // TypeCollection overrides
49 std::optional<TypeIndex> getFirst() override;
50 std::optional<TypeIndex> getNext(TypeIndex Prev) override;
51 CVType getType(TypeIndex Index) override;
52 StringRef getTypeName(TypeIndex Index) override;
53 bool contains(TypeIndex Index) override;
54 uint32_t size() override;
55 uint32_t capacity() override;
56 bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
57
58 // public interface
59 void reset();
61
62 BumpPtrAllocator &getAllocator() { return RecordStorage; }
63
64 ArrayRef<ArrayRef<uint8_t>> records() const;
65
66 TypeIndex insertRecordAs(hash_code Hash, ArrayRef<uint8_t> &Record);
67 TypeIndex insertRecordBytes(ArrayRef<uint8_t> &Record);
68 TypeIndex insertRecord(ContinuationRecordBuilder &Builder);
69
70 template <typename T> TypeIndex writeLeafType(T &Record) {
71 ArrayRef<uint8_t> Data = SimpleSerializer.serialize(Record);
72 return insertRecordBytes(Data);
73 }
74};
75
76} // end namespace codeview
77} // end namespace llvm
78
79#endif // LLVM_DEBUGINFO_CODEVIEW_MERGINGTYPETABLEBUILDER_H
This file defines the BumpPtrAllocator interface.
#define LLVM_ABI
Definition Compiler.h:213
static std::string getTypeName(OverloadKind Kind, Type *Ty)
This file defines the DenseMap class.
#define T
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:480
This file defines the SmallVector class.
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
std::optional< TypeIndex > getFirst() override
std::optional< TypeIndex > getNext(TypeIndex Prev) override
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override
TypeIndex insertRecordBytes(ArrayRef< uint8_t > &Record)
A 32-bit type reference.
Definition TypeIndex.h:97
An opaque object representing a hash code.
Definition Hashing.h:76
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Definition InstrProf.h:189
A locally hashed type represents a straightforward hash code of a serialized record.
Definition TypeHashing.h:35