14 #ifndef LLVM_SUPPORT_REGISTRY_H
15 #define LLVM_SUPPORT_REGISTRY_H
30 std::unique_ptr<T> (*Ctor)();
34 : Name(N), Desc(D), Ctor(
C) {}
57 static node *Head, *Tail;
99 static iterator
begin();
114 template <
typename V>
119 static std::unique_ptr<T> CtorFn() {
return make_unique<V>(); }
123 : Entry(Name, Desc, CtorFn), Node(Entry) {
138 #define LLVM_INSTANTIATE_REGISTRY(REGISTRY_CLASS) \
140 template<typename T> typename Registry<T>::node *Registry<T>::Head = nullptr;\
141 template<typename T> typename Registry<T>::node *Registry<T>::Tail = nullptr;\
142 template<typename T> \
143 void Registry<T>::add_node(typename Registry<T>::node *N) { \
150 template<typename T> typename Registry<T>::iterator Registry<T>::begin() { \
151 return iterator(Head); \
153 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Head; \
154 template REGISTRY_CLASS::node *Registry<REGISTRY_CLASS::type>::Tail; \
156 void Registry<REGISTRY_CLASS::type>::add_node(REGISTRY_CLASS::node*); \
157 template REGISTRY_CLASS::iterator Registry<REGISTRY_CLASS::type>::begin(); \
160 #endif // LLVM_SUPPORT_REGISTRY_H
bool operator!=(const iterator &That) const
StringRef getName() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
A global registry used in conjunction with static constructors to make pluggable components (like tar...
A simple registry entry which provides only a name, description, and no-argument constructor.
static iterator_range< iterator > entries()
bool operator==(const iterator &That) const
Node in linked list of entries.
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
StringRef getDesc() const
SimpleRegistryEntry(StringRef N, StringRef D, std::unique_ptr< T >(*C)())
static void add_node(node *N)
Add a node to the Registry: this is the interface between the plugin and the executable.
SimpleRegistryEntry< T > entry
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
A range adaptor for a pair of iterators.
Iterators for registry entries.
const entry * operator->() const
const entry & operator*() const
std::unique_ptr< T > instantiate() const
StringRef - Represent a constant reference to a string, i.e.
Add(StringRef Name, StringRef Desc)
A static registration template.