LLVM: include/llvm/IR/SymbolTableListTraits.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef LLVM_IR_SYMBOLTABLELISTTRAITS_H
25#define LLVM_IR_SYMBOLTABLELISTTRAITS_H
26
30#include
31
32namespace llvm {
33
43
44
45
46
47
49
50#define DEFINE_SYMBOL_TABLE_PARENT_TYPE(NODE, PARENT) \
51 template <> struct SymbolTableListParentType { using type = PARENT; };
59#undef DEFINE_SYMBOL_TABLE_PARENT_TYPE
60
61template <typename NodeTy, typename... Args> class SymbolTableList;
62
63
64
65
66
67template <typename ValueSubClass, typename... Args>
70 using iterator = typename simple_ilist<ValueSubClass, Args...>::iterator;
71 using ItemParentClass =
73
74public:
76
77private:
78
79
80 ItemParentClass *getListOwner() {
81 size_t Offset = reinterpret_cast<size_t>(
82 &((ItemParentClass *)nullptr->*ItemParentClass::getSublistAccess(
83 static_cast<ValueSubClass *>(
84 nullptr))));
85 ListTy *Anchor = static_cast<ListTy *>(this);
86 return reinterpret_cast<ItemParentClass*>(reinterpret_cast<char*>(Anchor)-
88 }
89
90 static ListTy &getList(ItemParentClass *Par) {
91 return Par->*(Par->getSublistAccess((ValueSubClass*)nullptr));
92 }
93
94 static ValueSymbolTable *getSymTab(ItemParentClass *Par) {
95 return Par ? toPtr(Par->getValueSymbolTable()) : nullptr;
96 }
97
98public:
102 iterator last);
103
104 template
108};
109
110
111
112
118
119
120
121
122
123
124template <class T, typename... Args>
126 SymbolTableListTraits<T, Args...>> {
127};
128
129}
130
131#endif
#define LLVM_TEMPLATE_ABI
Machine Check Debug Module
static bool getSymTab(Value *V, ValueSymbolTable *&ST)
#define DEFINE_SYMBOL_TABLE_PARENT_TYPE(NODE, PARENT)
Definition SymbolTableListTraits.h:50
This class represents an incoming formal argument to a Function.
LLVM Basic Block Representation.
A Module instance is used to store all the information related to an LLVM module.
static ValueSymbolTable * toPtr(ValueSymbolTable *P)
Definition SymbolTableListTraits.h:106
void setSymTabObject(TPtr *, TPtr)
setSymTabObject - This is called when (f.e.) the parent of a basic block changes.
void transferNodesFromList(SymbolTableListTraits &L2, iterator first, iterator last)
void addNodeToList(ValueSubClass *V)
static ValueSymbolTable * toPtr(ValueSymbolTable &R)
Definition SymbolTableListTraits.h:107
void removeNodeFromList(ValueSubClass *V)
SymbolTableListTraits()=default
List that automatically updates parent links and symbol tables.
Definition SymbolTableListTraits.h:126
This class provides a symbol table of name/value pairs.
A simple intrusive list implementation.
This file defines classes to implement an intrusive doubly linked list class (i.e.
This is an optimization pass for GlobalISel generic memory operations.
template class LLVM_TEMPLATE_ABI SymbolTableListTraits< Function >
template class LLVM_TEMPLATE_ABI SymbolTableListTraits< GlobalAlias >
template class LLVM_TEMPLATE_ABI SymbolTableListTraits< GlobalVariable >
template class LLVM_TEMPLATE_ABI SymbolTableListTraits< BasicBlock >
template class LLVM_TEMPLATE_ABI SymbolTableListTraits< GlobalIFunc >
Template metafunction to get the parent type for a symbol table list.
Definition SymbolTableListTraits.h:48
Use delete by default for iplist and ilist.